【jenkins】jenkins+maven+gitlab+testng,jenkins配置

电脑版本:windows10企业版

jenkins配置

1.general配置,这里的配置比较简单,基本默认就可以了

2.源码管理

  2.1填写git地址,从你的git项目里去找。不会的自行百度。

   2.2点击添加按钮,弹出下面的框,填写jenkins登录的账号密码

  

  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>

  

然后我们来看看执行结果

猜你喜欢

转载自www.cnblogs.com/Jourly/p/10469780.html