首页 > 其他分享 >Allure常用命令

Allure常用命令

时间:2023-08-25 23:12:36浏览次数:32  
标签:allure Test Allure clean 常用命令 test org mvn

命令格式:

allure  [option]   [command]   [command options]

allure --help 帮助

allure --version 查看版本信息

allure serve  生成在线版本的测试

allure generate <allure-result中间文件>  -o   输出目录 (默认路径:allure-report)

引入依赖

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.hogwarts</groupId>
    <artifactId>AllureDemo2</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>RELEASE</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-junit5</artifactId>
            <version>2.13.6</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <aspectj.version>1.8.10</aspectj.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <includes>
                        <include>**/*Test.java</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

代码示例

import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

public class DemoTest {
    @Test
    public void demo1() {
        assert 1 + 1 == 2;
    }

    @Test
    public void demo2() {
        assertThat(2, equalTo(2));
    }

    @Test
    public void demo3() {
        assertThat(2, equalTo(0));
    }
}

 

pom.xml右键:open in / terminal,命令执行:

mvn clean test

查看在线allure报告:

方式一

allure serve ./target/surefire-reports

 

 

方式二

allure serve ./allure-results

 

 

target目录下的数据当执行mvn clean时会自动清楚,这样生成的报告就是最新的,allure-results下要手动删除

 


// 运行所有用例

mvn clean test

// 运行指定一个文件,或者多个文件,以逗号隔开

mvn clean package -Dtest=<文件名1> test

mvn clean package -Dtest=<文件名1>,<文件名2>,... test

测试报告位置

  • 测试结果保存在两个位置
    • target/surefire-reports/
    • allure-results/ 

 

标签:allure,Test,Allure,clean,常用命令,test,org,mvn
From: https://www.cnblogs.com/ixtao/p/17658148.html

相关文章

  • Allure环境安装
    1、安装Java(推荐1.8版本),需要配置环境变量2、安装Allure(2.13以上版本),需要配置环境变量【下载地址】https://repo1.maven.org/maven2/io/qameta/allure/allure-commandline/mac/linux:下载tarwindows:下载zip配置环境变量:解压后将bin目录加入PATH环境变量安......
  • 安卓 adb常用命令
    什么是adb:adb是PC电脑与android手机进行通信操作的工具软件,类似于Xshell可以通过windows访问操作Linux如何安装adb软件(环境):下载adb绿色免安装版什么是adbshell:切换进入Linux内核的命令行界面(android的底层使用的是Linux内核,所以切换进入Linux内核命令行界面后,可以使用Lin......
  • uiautomator2 截图+压缩图片+放入allure报告中
    defsave_screenshot(self,screenshot_path):"""截图保存到某个路径:paramscreenshot_path::return:"""self.d.screenshot(screenshot_path) screenshot_path=f&quo......
  • npm 常用命令 常用知识
    1、常用命令参考:https://www.cnblogs.com/BJQE/p/16510627.htmlhttps://zhuanlan.zhihu.com/p/4424078791、清除缓存有时候安装或卸载模块时,出现错误,有可能是缓存未清理的缘故。npmcacheclean--force2、知识点2.1 npmi和npminstall的区别实际使用的区别点主要如下(......
  • centos系统firewalld&iptables常用命令
    firewalld添加规则:firewall-cmd--permanent--add-rich-rule="rulefamily="ipv4"sourceaddress="192.168.142.166"portprotocol="tcp"port="5432"accept" 允许192.168.142.166访问5432端口firewall-cmd--add-port=80/t......
  • allure报告中firefox信息不展示(多浏览器或多线程执行时只显示一个浏览器的日志)
    安装的allure-pytest的版本要是2.11.1之前的(之后的版本有test_result.historyId,但位置及方法不一样,我目前没研究怎么修改)在依赖包Lib--site-packages--allure_pytest--listener.py文件里修改test_result.historyId=md5(item.nodeid)变成test_result.historyId=md5(item.nod......
  • 防火墙常用命令(Centos)
    开放端口firewall-cmd--zone=public--add-port=80/tcp--permanent#开放80端口systemctlrestartfirewalls.service#重启防火墙查看已开启的端口firewall-cmd--list-ports启动与停止firewall-cmd--state#查看防火墙状态systemctlstopfirewalls.service......
  • Git 常用命令
    Git基础部分配置用户gitconfig--globaluser.name'USERName'gitconfig--globaluser.email'USEREmail'初始化仓库#初始化一个git仓库gitinit#克隆远程仓库gitclone<url>[directory]上传仓库将文件添加到缓存#将所有文件添加到缓存gitadd.#......
  • docker 常用命令--todo....
    docker常用命令docker设置开机自启docker-v启动dockersystemctlstartdocker查看docker状态systemctlstatusdockerdocker设置开机自启systemctlenbaledocker修改docker仓库的地址---------------------------基础设置--------------------------开机自启su......
  • 华为ENSP学习之常用命令总结
    system:进入配置模式quit:退出当前窗口return:退回到用户模式ctrl+c:结束当前显示undoinfo-centerenable:关闭信息提示displaycurrent-configuration:查看设备配置信息displayvlan:查看vlan相关信息displaymac-address:查看交换机管理的mac地址列表displayinterface:查看接......