Intellij IDEA maven配置执行自动化测试
来源:互联网 发布:淘宝新店运营计划表 编辑:程序博客网 时间:2024/06/06 12:51
从下面网址下载maven安装包:
http://maven.apache.org/download.cgi ,当前最新的版本是3.5.2,就下载最新的,因为这个版本里面有surefire report
解压到一个地方:
进入 apache-maven-3.5.2/conf,编辑settings.xml:把mirrors部分替换为阿里云的maven镜像,会快点
<mirrors><mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> </mirror> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>central</id> <name>Maven Repository Switchboard</name> <url>http://repo1.maven.org/maven2/</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> <mirror> <id>ibiblio</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url> </mirror> <mirror> <id>jboss-public-repository-group</id> <mirrorOf>central</mirrorOf> <name>JBoss Public Repository Group</name> <url>http://repository.jboss.org/nexus/content/groups/public</url> </mirror> <mirror> <id>google-maven-central</id> <name>Google Maven Central</name> <url>https://maven-central.storage.googleapis.com </url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>maven.net.cn</id> <name>oneof the central mirrors in china</name> <url>http://maven.net.cn/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors>
添加M2_HOME到环境变量:
在IDEA中点击右上角的搜索图标,然后在Search Everywhere中输入maven,点击maven settings
设置Maven home directory等:
按Alt+F12,调出命令行终端,输入
mvn -Dtest=Case* test
D:\workspace\AppiumTest>mvn -Dtest=Case* test[INFO] Scanning for projects...[INFO][INFO] ------------------------------------------------------------------------[INFO] Building AppiumTest 1.0-SNAPSHOT[INFO] ------------------------------------------------------------------------[INFO][INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ AppiumTest ---[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent![INFO] Copying 0 resource[INFO][INFO] --- maven-compiler-plugin:2.1:compile (default-compile) @ AppiumTest ---[INFO] Nothing to compile - all classes are up to date[INFO][INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ AppiumTest ---[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent![INFO] skip non existing resourceDirectory D:\workspace\AppiumTest\src\test\resources[INFO][INFO] --- maven-compiler-plugin:2.1:testCompile (default-testCompile) @ AppiumTest ---[INFO] Nothing to compile - all classes are up to date[INFO][INFO] --- maven-surefire-plugin:2.5:test (default-test) @ AppiumTest ---[INFO] Surefire report directory: D:\workspace\AppiumTest\target\surefire-reports------------------------------------------------------- T E S T S-------------------------------------------------------Running android.Case000308:29:17.381 [main] INFO android.Case0003 - ANDROID.CASE0003 Start =====>十二月 11, 2017 8:29:45 上午 org.openqa.selenium.remote.ProtocolHandshake createSession信息: Detected dialect: OSS08:29:45.555 [main] INFO android.Case0003 - photoView Start =====>08:29:47.790 [main] INFO utils.ActionUtil - step1:模拟用户点击引导页跳过按钮...08:29:49.791 [main] INFO utils.ActionUtil - step2:等待2秒08:29:59.486 [main] ERROR utils.ScreenshotUtil - 测试失败,保存异常截图目录:D:\workspace\AppiumTest/ScreenshotTests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 42.483 sec <<< FAILURE!Results :Tests in error: photoView(android.Case0003) photoView(android.Case0003)Tests run: 2, Failures: 0, Errors: 2, Skipped: 0[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time: 44.288 s[INFO] Finished at: 2017-12-11T08:29:59+08:00[INFO] Final Memory: 12M/307M[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test (default-test) on project AppiumTest: There are test failures.[ERROR][ERROR] Please refer to D:\workspace\AppiumTest\target\surefire-reports for the individual test results.[ERROR] -> [Help 1][ERROR][ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR][ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExceptionD:\workspace\AppiumTest>mvn -Dtest=Case* test[INFO] Scanning for projects...[INFO][INFO] ------------------------------------------------------------------------[INFO] Building AppiumTest 1.0-SNAPSHOT[INFO] ------------------------------------------------------------------------[INFO][INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ AppiumTest ---[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent![INFO] Copying 0 resource[INFO][INFO] --- maven-compiler-plugin:2.1:compile (default-compile) @ AppiumTest ---[INFO] Nothing to compile - all classes are up to date[INFO][INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ AppiumTest ---[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent![INFO] skip non existing resourceDirectory D:\workspace\AppiumTest\src\test\resources[INFO][INFO] --- maven-compiler-plugin:2.1:testCompile (default-testCompile) @ AppiumTest ---[INFO] Nothing to compile - all classes are up to date[INFO][INFO] --- maven-surefire-plugin:2.5:test (default-test) @ AppiumTest ---[INFO] Surefire report directory: D:\workspace\AppiumTest\target\surefire-reports------------------------------------------------------- T E S T S-------------------------------------------------------Running android.Case000308:33:22.583 [main] INFO android.Case0003 - ANDROID.CASE0003 Start =====>十二月 11, 2017 8:33:38 上午 org.openqa.selenium.remote.ProtocolHandshake createSession信息: Detected dialect: OSS08:33:38.054 [main] INFO android.Case0003 - photoView Start =====>08:33:39.747 [main] INFO utils.ActionUtil - step1:模拟用户点击引导页跳过按钮...08:33:41.748 [main] INFO utils.ActionUtil - step2:等待2秒08:33:47.144 [main] INFO utils.ActionUtil - step3:模拟用户发送账号..08:33:49.145 [main] INFO utils.ActionUtil - step4:等待2秒08:33:54.844 [main] INFO utils.ActionUtil - step5:模拟用户发送密码..08:33:56.844 [main] INFO utils.ActionUtil - step6:等待2秒08:33:57.457 [main] INFO utils.ActionUtil - step7:模拟用户点击手机用户登录..08:34:12.458 [main] INFO utils.ActionUtil - step8:等待15秒08:34:12.693 [main] INFO utils.ActionUtil - step9:点击图片模块08:34:14.693 [main] INFO utils.ActionUtil - step10:等待2秒08:34:14.921 [main] INFO utils.ActionUtil - step11:点击打开第一张图08:34:19.921 [main] INFO utils.ActionUtil - step12:等待5秒08:34:19.921 [main] INFO android.Case0003 - photoView Over =====>08:34:22.146 [main] INFO android.Case0003 - ANDROID.CASE0003 Test Over =====>Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 59.71 secResults :Tests run: 1, Failures: 0, Errors: 0, Skipped: 0[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 01:01 min[INFO] Finished at: 2017-12-11T08:34:22+08:00[INFO] Final Memory: 12M/307M[INFO] ------------------------------------------------------------------------D:\workspace\AppiumTest>
注意maven的jdk配置,不要用IDE自带的jdk,否则可能会出现一些错误
执行 mvn surefire-report:report,会在target/site下生成surefire-report.html:可以看到执行了2个用例,1个出错
阅读全文
0 0
- Intellij IDEA maven配置执行自动化测试
- intelliJ IDEA maven配置
- IntelliJ IDEA配置maven
- intellij Idea 配置maven
- IntelliJ IDEA 配置 maven
- IntelliJ IDEA 配置Maven
- intellij idea maven 配置使用
- IntelliJ IDEA Maven 安装配置
- 使用IntelliJ IDEA 配置Maven
- intellij idea maven 配置使用
- 使用IntelliJ IDEA 配置Maven
- intellij idea maven 配置使用
- intellij idea maven 配置使用
- 使用IntelliJ IDEA 配置Maven
- 使用IntelliJ IDEA 配置Maven
- 使用IntelliJ IDEA 配置Maven
- IntelliJ IDEA Maven安装配置
- IntelliJ IDEA配置Maven详解
- Tomcat9源代码分析(二)-初始化
- 412. Fizz Buzz
- Http Client 客户端编码
- 面向对象
- Zookeeper_典型应用场景
- Intellij IDEA maven配置执行自动化测试
- Spring中bean的三种装配机制之一—java configure
- 区块链与程序员:赚钱还是创业
- 浅谈接口测试相关概念
- Android中的ANR
- unity自动录音功能
- signalr初体验...
- PHP 输出缓存 Output Buffer
- 关于DOTween的一些控制(随时更新)