JUnit test case

De Software testing
Ir para: navegação, pesquisa

Concepts


Facts

  • In general, each test case is defined in a different method within a Java class. <bib>maldonado-vincenzi:2007</bib>
  • Test method neither accept parameters nor return a value. <bib>maldonado-vincenzi:2007</bib>
  • To ignore a JUnit test case, add the annotation @Ignore to the method declaration. <bib>maldonado-vincenzi:2007</bib>
  • JUnit test cases can be parameterized if their structures are similar, and The difference is the parameters and the returned values.
  • To define a parameterized JUnit test case, you must create a collection of pairs (parameters values and expected results) and define the test method structure based on the collection of values. Two special annotations should be used: @RunWith(Parameterized.class) and @Parameters.