1、報告框架分類
-
xUnit style xml報告
-
mvn surefire插件的html報告
-
Allure2多語言測試報告
2、生成測試報告
2.1 xUnit style xml報告
所有XUnit的測試報告都適用,如Java的Junit,Python的pytest等
- 1)現有如下測試類
Junit4DemoTest
package junit4demo;
import org.junit.*;import org.junit.runners.MethodSorters;import static org.junit.Assert.assertTrue;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)public class Junit4DemoTest {
@BeforeClass public static void beforeAllTestCase(){ System.out.println("我是@BeforeClass,我是第一步"); }
@AfterClass public static void afterAllTestCase(){ System.out.println("我是@AfterClass,我是最後一步"); }
@Before public void beforeTestCase(){ System.out.println("我是@Before,用例執行前先到我這"); }
@After public void afterTestCase(){ System.out.println("我是@After,用例執行後到我這"); }
@Test public void testDemoC(){ System.out.println("testDemoC"); assertTrue(true); }
@Test public void testDemoA(){ System.out.println("testDemoA"); assertTrue(false ); }
@Test public void testDemoB(){ System.out.println("testDemoB"); assertTrue(true ); }}
2)用mvn test -Dtest=Junit4DemoTest
執行Junit4DemoTest
測試類,執行完畢之後我們可以在target.surefire- report.Surefile suite
路徑下看到文件TEST-junit4demo.Junit4DemoTest.xml
,這就是xUnit
style xml報告
來霍格沃茲測試開發學社,學習更多軟件測試與測試開發的進階技術,知識點涵蓋web自動化測試 app自動化測試、接口自動化測試、測試框架、性能測試、安全測試、持續集成/持續交付/DevOps,測試左移、測試右移、精準測試、測試平臺開發、測試管理等內容,課程技術涵蓋bash、pytest、junit、selenium、appium、postman、requests、httprunner、jmeter、jenkins、docker、k8s、elk、sonarqube、jacoco、jvm-sandbox等相關技術,全面提升測試開發工程師的技術實力
QQ交流羣:484590337
公衆號 TestingStudio
點擊獲取更多信息