我的代码用java编写,用于移动应用测试。 Appium +的java + IOS。 JUst现在想如何在我的本地机器mac OS上安排这个。任何指导或帮助如何做到这一点将不胜感激。或者,如果有任何我可以使用的在线服务。
答案 0 :(得分:1)
试试这个:
0 2 * * * cd ~/your_project_folder/ && mvn clean test
您需要将测试套件文件testng.xml添加到maven构建标记(pom.xml)
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-version}</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${basedir}/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>true</value>
</property>
</properties>
<reportsDirectory>test-output/</reportsDirectory>
<testFailureIgnore>false</testFailureIgnore>
</configuration>
</build>
上面的代码片段将有助于运行您的testng.xml文件。
答案 1 :(得分:1)
使用上面解释过的cron job并添加maven命令: 这是cron jib设置的链接 https://ole.michelsen.dk/blog/schedule-jobs-with-crontab-on-mac-osx.html
运行测试:
(testng xml suite)
mvn -Dsurefire.suiteXmlFiles=testsuite.xml test
单一测试
mvn -Dtest=UI_testrun_Chrome test#testLogin
班级考试
mvn -Dtest=UI_testrun_Chrome test
答案 2 :(得分:0)
创建项目的jar,然后编辑/创建一个cron作业。在你的cron工作中,如下所示:
0 2 * * * java -jar / path / to / your / jarFile
这将在每天凌晨2点运行您的脚本。
如果您需要,可以查看下面的链接:
答案 3 :(得分:0)
你可以用cron job作为解释,但最有效的方法是拥有本地Jenkins,或者在任何计算机上设置Jenkins(如果有任何额外的)并以任何可能的方式启动工作,并报告邮件,短信,不管......