Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

         If some of your test cases, which expect the exceptions to be thrown from application, use “expected” attribute like this. Try avoiding catching exception in catch block and using fail/ or asset method to conclude the test.

               @Test(expected=SomeDomainSpecificException.SubException.class)

 

  • Use the most appropriate assertion methods
  • Put assertion parameters in the proper order
  • Ensure that test code is separated from production code
  • Do not print anything out in unit tests
  • Do not use static members in a test class. If you have used then re-initalize for each test case
  • Do not skip unit tests
  • Capture results using the XML formatter

...