I had my code written in java for mobile app testing. Appium+java+IOS. JUst wanted to now how to schedule this on my local machine mac OS. Any guide or help how to do it will be appreciated. Or if there is any online service which i can use.
4 Answers
Try this:
0 2 * * * cd ~/your_project_folder/ && mvn clean test
you need to add your test suite file testng.xml to your maven build tag (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>
Above code snippet will help to run your testng.xml file.

- 1,199
- 2
- 9
- 22
-
It gives compilation error if i compile it from eclipise and it show mvn command not found on ruuning it from command line. How can i find out where is my maven-apache is installed. – Akif Hazarvi Oct 12 '16 at 06:16
-
if you are using mac just install "brew install maven" or run this command "which mvn", if you are using windows download maven and set the environment variable. – Mani Oct 12 '16 at 06:28
Use cron job like guys above explained and add maven command: Here is link for cron jib setup https://ole.michelsen.dk/blog/schedule-jobs-with-crontab-on-mac-osx.html
Run tests:
(testng xml suite)
mvn -Dsurefire.suiteXmlFiles=testsuite.xml test
single test
mvn -Dtest=UI_testrun_Chrome test#testLogin
class test(s)
mvn -Dtest=UI_testrun_Chrome test

- 1,473
- 6
- 21
Create a jar of your project and then edit/create a cron job. In your cron job put the line like this:
0 2 * * * java -jar /path/to/your/jarFile
This will run your scripts everyday at 2am.
You can have a look at the link below if you need:

- 2,739
- 3
- 23
- 37
-
-
How do you run your test cases? From eclipse testng plugin or programmatically from your main method? If you follow the second option then just create a jar and do your job accordingly. – optimistic_creeper Oct 02 '16 at 14:37
-
You can do this with cron job as guys above explaine, but most effective way is to have local Jenkins, or setup Jenkins on any computer (if have any extra) and start jobs in any possible way, with reporting on mail, sms, whatever...

- 1,473
- 6
- 21