Test Overview
This test runs a simple JUnit test case and generates both XML and HTML reports. It verifies that the test passes and that the reports are created successfully.
This test runs a simple JUnit test case and generates both XML and HTML reports. It verifies that the test passes and that the reports are created successfully.
import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class SimpleTest { @Test public void additionTest() { assertEquals(4, 2 + 2, "2 + 2 should equal 4"); } } // To generate reports, run tests with Maven or Gradle configured to produce surefire reports. // Example Maven command: mvn test // XML reports are generated in target/surefire-reports/ // HTML reports can be generated using plugins like surefire-report-plugin.
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test runner starts and loads SimpleTest class | JUnit test environment initialized | - | PASS |
| 2 | Runs additionTest method | Executing test method additionTest | assertEquals(4, 2 + 2) | PASS |
| 3 | Test runner completes execution | Test finished with all tests passing | - | PASS |
| 4 | JUnit generates XML report in target/surefire-reports/TEST-SimpleTest.xml | XML report file created with test results | XML report contains test case result with status 'passed' | PASS |
| 5 | HTML report generated using surefire-report-plugin | HTML report file created in target/site/surefire-report.html | HTML report displays test summary with passed test | PASS |