Name | Desc |
@After | If you allocate external resources in a Before method you need to release them after the test runs. Annotating a public void method with @After causes that method to be run after the Test method. |
@AfterClass | This will perform the method after all tests have finished. This can be used to perform clean-up activities. |
@Before | Several tests need similar objects created before they can run. Annotating a public void method with @Before causes that method to be run before each Test method. |
@BeforeClass | Annotating a public static void method with @BeforeClass causes it to be run once before any of the test methods in the class. |
@Ignore | The Ignore annotation is used to ignore the test and that test will not be executed. |
@Test | The Test annotation tells JUnit that the public void method to which it is attached can be run as a test case. |
Enumeration<TestFailure> errors() | Returns an Enumeration for the errors. |
int countTestCases() | Counts the number of test cases executed by run(TestResult result). |
int countTestCases() | Counts the number of test cases that will be run by this test. |
int errorCount() | Gets the number of detected errors. |
int failureCount() | Gets the number of detected failures. |
int int runCount() | Gets the number of run tests. |
int testCount() | Returns the number of tests in this suite. |
static Test warning(String message) | Returns a test which will fail and log a warning message. |
String getName() | Gets the name of a TestCase. |
String getName() | Returns the name of the suite. |
String toString() | Returns a string representation of the test case. |
Test testAt(int index) | Returns the test at the given index. |
TestResult createResult() | Creates a default TestResult object. |
TestResult run() | A convenience method to run this test, collecting the results with a default TestResult object. |
void addError(Test test, Throwable t) | Adds an error to the list of errors. |
void addFailure(Test test, AssertionFailedError t) | Adds a failure to the list of failures. |
void addTest(Test test) | Adds a test to the suite. |
void addTestSuite(Class extends TestCase> testClass) | Adds the tests from the given class to the suite. |
void assertArrayEquals(expectedArray, resultArray) | method will test whether two arrays are equal to each other. |
void assertEquals(boolean expected, boolean actual) | Check that two primitives/Objects are equal |
void assertFalse(boolean condition) | Check that a condition is false |
void assertNotNull(Object object) | Check that an object isn't null. |
void assertNotSame(boolean condition) | The assertNotSame() methods tests if two object references not point to the same object |
void assertNull(Object object) | Check that an object is null |
void assertSame(boolean condition) | The assertSame() methods tests if two object references point to the same object |
void assertTrue(boolean expected, boolean actual) | Check that a condition is true |
void endTest(Test test) | Informs the result that a test was completed. |
void run(TestCase test) | Runs a TestCase. |
void run(TestResult result) | Runs the test case and collects the results in TestResult. |
void run(TestResult result) | Runs the tests and collects their result in a TestResult. |
void setName(String name) | Sets the name of a TestCase. |
void setName(String name) | Sets the name of the suite. |
void setUp() | Sets up the fixture, for example, open a network connection. |
void startTest(Test test) | Informs the result that a test will be started. |
void stop() | Marks that the test run should stop. |
void tearDown() | Tears down the fixture, for example, close a network connection. |