Yea and good job on what you have learnt.
And yes I do mean that, I also use the message option on the asserts as in the following example.
rc.email = ‘isthisanemail@.com’;
errors = blogService.addComment(instance.event);
assertTrue(arrayLen(errors), ‘Did not return an array of errors for incorrect email’);
assertEquals(‘Please enter a valid email address’, errors.getMessage(), ‘When checking to see if the email was valid it went wrong.’ );
This is just one of many, and is example of multiple things that need to be checked. This is adding a comment to a blog post, and checks that the email is valid. Which first’s checks to see if an array of errors are returned, and then checks that the message returned is indeed what we expect.
Same as what you did with your example, but I also have all other known inputs and outputs catered for in the one test here.
I know that many people will argue the fact that you don’t need to do it the way I do it, but I wanted to suggest it and give you an oppurtunity to make up what works for you. I have the ability to run 3 sets of tests in development, one with just running the one test I am working on and if I am satisified that this works. Then I run the entire suite in the view to double check it all passes, and the last but not least is when building the staging server, is when it is run again just to make sure the build is stable.
But if you imagine in a life cycle how many times you run your tests while you code, and then having to wait for your suite to end. You can see how much time is wasted very quickly, and which is why I have chosen to implment it this way. Take a great deal of patience and persistence, but it is worth it in the end.