電腦版本:windows10企業版
maven和jenkins區別,?
jenkins配置:
gitlab webhook jenkins、1.general配置,這里的配置比較簡單,基本默認就可以了
2.源碼管理
? 2.1填寫git地址,從你的gitlib項目里去找。不會的自行百度。
? ?然后將git的公鑰配置到gitlab里面【必須要配置,和后面jenkins里面的私鑰對應起來】
? ?2.2點擊添加按鈕,彈出下面的框,填寫git私鑰
?
?
? 2.3選擇master分支
?
?
?3.構建環境和構建觸發器,暫時省略,不配,點擊立即構建也可以跑起來
4.構建
clean install
5.構建后操作-->測試報告。我選的是allure report。
? 備注:先在插件里安裝allure report
?6.還需要和工程下的testng.xml文件關聯起來,我的是maven工程
<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>ppwx</groupId><artifactId>autotest</artifactId><version>0.0.1-SNAPSHOT</version><packaging>jar</packaging><name>test</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version></properties><dependencies><!--此處省略--></dependencies><build><finalName>Test</finalName><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><configuration><systemPropertyVariables><org.uncommons.reportng.escape-output>false</org.uncommons.reportng.escape-output></systemPropertyVariables><forkMode>once</forkMode><argLine>-Dfile.encoding=UTF-8</argLine><suiteXmlFiles><suiteXmlFile>./testng.xml</suiteXmlFile></suiteXmlFiles><workingDirectory>target/</workingDirectory></configuration></plugin></plugins></build></project>
?
配置完后,重啟jenkins,重啟電腦(比較保險,有時不重啟,不生效)
?
然后我們來看看執行結果
?
如果allure report沒有生成,看一下全局設置里。把這里配置一下。
?