[英]Selenium Java automation runs fast in some machine and slow in some machine
[英]Need some help to schedule my automation script on my local machine Mac OS (Java+appium+selenium)
我的代碼是用 Java 編寫的,用於移動應用程序測試。 Appium+java+IOS。 只是現在想知道如何在我的本地機器 mac OS 上安排這個。 任何指導或幫助如何做到這一點將不勝感激。 或者如果有任何我可以使用的在線服務。
嘗試這個:
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 文件。
像上面解釋的人一樣使用 cron 作業並添加 maven 命令:這是 cron jib 設置的鏈接https://ole.michelsen.dk/blog/schedule-jobs-with-crontab-on-mac-osx.html
運行測試:
(testng xml 套件)
mvn -Dsurefire.suiteXmlFiles=testsuite.xml test
單項測試
mvn -Dtest=UI_testrun_Chrome test#testLogin
課堂測試
mvn -Dtest=UI_testrun_Chrome test
創建一個項目的 jar,然后編輯/創建一個 cron 作業。 在你的 cron 工作中,把這樣的行:
0 2 * * * java -jar /path/to/your/jarFile
這將在每天凌晨 2 點運行您的腳本。
如果需要,您可以查看以下鏈接:
您可以像上面解釋的那樣使用 cron 作業來完成此操作,但最有效的方法是擁有本地 Jenkins,或在任何計算機上設置 Jenkins(如果有額外的)並以任何可能的方式開始工作,並報告郵件、短信等...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.