【解决办法】记录自动化测试持续集成过程中遇到的问题与解决方法
2017-09-15 14:18
651 查看
记录Appium自动化测试持续集成环境搭建过程中遇到的若干问题
1.在pom文件中添加了maven-compiler-plugin插件后,在Terminal窗口执行 mvn clean test -DsuiteXmlFile=suite.xml 后报,mvn不是内部命令。
此问题是由于没有配置maven的环境变量导致的。虽然idea已经集成了maven,但是还是必须手动配置环境变量。在idea的安装目录下的\plugins\maven\lib目录下有idea集成的maven文件夹。配置环境变量如下:
MAVEN_HOME:idea安装目录\plugins\maven\lib\maven3 (maven3为笔者本地的maven文件夹)
path:%MAVEN_HOME%\bin
2.在idea内手动执行suite.xml脚本是可以成功通过的,但是使用mvn clean test -DsuiteXmliFile=suite.xml 执行suite.xml中的用例时设计toast内容判断的用例全部执行失败。
此问题是由于两者的编码格式不同导致的,仅需同意编码格式即可解决问题。在pom文件中配置maven-compiler-plugin插件的编码格式。文末会贴上pom文件的内容。
3.为代码添加了失败截图与失败重跑机制,但是部分用例失败了直接导致jenkins构建停止并且没有截图与重跑,但是部分脚本却有截图与重跑。
此问题由于导致jenkins构建停止的用例均在setUp()或tearDown()模块出错抛出异常导致jenkins构建停止,所以没有重跑和截图,在setUp()和tearDown()代码处加上try..catch逻辑即可解决问题。
4.jenkins构建完成后HTML Report打开全部空白,没有任何内容。
此问题是由于jenkins的默认配置导致的。有如下2种解决方法
1>在jenkins->系统管理->脚本命令行中执行如下脚本,但此解决方法并不能一劳永逸,每当重启后还是会发生次问题:
2>在jenkins的所属服务器的catalina文件添加如下代码,如笔者的tomcat是部署在windows下所以在catalina.bat文件中添加如下代码。
附录:
<?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.dpp.appium</groupId>
<artifactId>appium</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>5.0.0-BETA1</version>
</dependency>
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>velocity</groupId>
<artifactId>velocity-dep</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>suite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugin> </plugins> </build></project>
1.在pom文件中添加了maven-compiler-plugin插件后,在Terminal窗口执行 mvn clean test -DsuiteXmlFile=suite.xml 后报,mvn不是内部命令。
此问题是由于没有配置maven的环境变量导致的。虽然idea已经集成了maven,但是还是必须手动配置环境变量。在idea的安装目录下的\plugins\maven\lib目录下有idea集成的maven文件夹。配置环境变量如下:
MAVEN_HOME:idea安装目录\plugins\maven\lib\maven3 (maven3为笔者本地的maven文件夹)
path:%MAVEN_HOME%\bin
2.在idea内手动执行suite.xml脚本是可以成功通过的,但是使用mvn clean test -DsuiteXmliFile=suite.xml 执行suite.xml中的用例时设计toast内容判断的用例全部执行失败。
此问题是由于两者的编码格式不同导致的,仅需同意编码格式即可解决问题。在pom文件中配置maven-compiler-plugin插件的编码格式。文末会贴上pom文件的内容。
3.为代码添加了失败截图与失败重跑机制,但是部分用例失败了直接导致jenkins构建停止并且没有截图与重跑,但是部分脚本却有截图与重跑。
此问题由于导致jenkins构建停止的用例均在setUp()或tearDown()模块出错抛出异常导致jenkins构建停止,所以没有重跑和截图,在setUp()和tearDown()代码处加上try..catch逻辑即可解决问题。
4.jenkins构建完成后HTML Report打开全部空白,没有任何内容。
此问题是由于jenkins的默认配置导致的。有如下2种解决方法
1>在jenkins->系统管理->脚本命令行中执行如下脚本,但此解决方法并不能一劳永逸,每当重启后还是会发生次问题:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
2>在jenkins的所属服务器的catalina文件添加如下代码,如笔者的tomcat是部署在windows下所以在catalina.bat文件中添加如下代码。
set JAVA_OPTS="-Dhudson.model.DirectoryBrowserSupport.CSP=\"\""
附录:
<?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.dpp.appium</groupId>
<artifactId>appium</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>5.0.0-BETA1</version>
</dependency>
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>velocity</groupId>
<artifactId>velocity-dep</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>suite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<!--以下为pom文件中添加的编译插件及设置编码格式为utf-8--><plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.1</version> <configuration> <source>1.6</source> <target>1.6</target> <encoding>utf8</encoding> </configuration>
</plugin> </plugins> </build></project>
相关文章推荐
- 记录自己集成支付宝遇到的问题及解决方法
- 集成shareSDk过程中遇到的问题及解决办法,慢慢整理中
- 在写代码过程中遇到的问题,以及当时的解决方法(如实记录)
- 记flume部署过程中遇到的问题以及解决方法(持续更新)
- 微信支付开发的流程以及开发过程中遇到的问题和解决办法,持续整理中
- 集成——Jenkins持续集成+蒲公英上传内测遇到的问题及解决方法
- Caffe搭建:常见问题解决办法和ubuntu使用中遇到问题解决方法(持续更新)
- 记录linux学习过程中,遇到的问题与解决办法
- 记录使用vmware workstation11安装CentOS-6.6-x86_64-minimal.iso过程中遇到的问题及解决办法
- Caffe搭建:常见问题解决办法和ubuntu使用中遇到问题解决方法(持续更新)
- 从 .net 1.1 升级到 2.0过程中遇到的问题及解决方法
- SQL Server 2008 安装过程中遇到“性能计数器注册表配置单元一致性”检查失败 问题的解决方法
- 从 .net 1.1 升级到 2.0过程中遇到的问题及解决方法
- 遇到repair filesystem 1 #的问题记录下解决办法
- 使用busybox-1.9.2制作CRAMFS问题系统过程中遇到的问题及解决的办法
- 记录编译vnc-4_1_3-unixsrc的时候遇到的问题与解决办法
- 安装MySQL数据库的图形管理界面jspmyadmin过程遇到的问题及解决方法
- 硬盘安装Ubuntu9.10 的过程,遇到的问题及解决方法
- 搭建配置服务器过程中遇到的问题及其解决办法(转)
- SQL Server 2008 安装过程中遇到“性能计数器注册表配置单元一致性”检查失败 问题的解决方法