zoukankan      html  css  js  c++  java
  • xUnit框架整合定制测试报告Allure2

    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
    点击获取更多信息

  • 相关阅读:
    Angular vs. React vs. Vue
    探索Virtual DOM的前世今生
    GRPC 负载均衡
    揭秘!用标准Go语言能写脚本吗?
    grpc 连接 复用 在 Go 中发现竞态条件 (Race Conditions)
    读取网络包
    User Datagram Protocol
    注册表项 DeviceInstance
    gopacket 抓包 过滤器
    Mysql 通信协议抓包分析
  • 原文地址:https://www.cnblogs.com/hogwarts/p/15845418.html
Copyright © 2011-2022 走看看