0

So I am making an eclipse project with cucumber and selenium in order to automate execution of some test cases.I have a runner class,which can be executed as a Junit test and lead to execution of all feature files consecutively. My question is can I execute this runner class through windows 7 cmd. The idea is to make a script(cron job/scheduled task) who can trigger tests execution at given time.

STD
  • 5
  • 3
  • Why not use something like [Jenkins](https://jenkins.io/)? – Andy Turner Feb 19 '17 at 18:40
  • Are you using maven? – kevcodez Feb 19 '17 at 18:41
  • Windows has a scheduled task service. Your machine should remain on for this purpose. Found an earlier answer: http://stackoverflow.com/a/132975/259889 – Sid Feb 19 '17 at 18:41
  • @Andy Tuner Could you tell me the basic steps of doing so,anyway thank you for the idea,I will make a further investigation about Jenkins. – STD Feb 19 '17 at 18:43
  • Yes,I am using maven. – STD Feb 19 '17 at 18:43
  • @STD sorry, don't use it myself. I just know that it's a CI framework, and lets you do this sort of thing and a lot more. – Andy Turner Feb 19 '17 at 18:44
  • If you just want to run the test using cmd, you could use maven `mvn -Dtest=ClassName`. You need to add maven to your Path environment variable in order to run mvn. – kevcodez Feb 19 '17 at 18:45
  • @kevcodez running mvn -Dtest="class name" leads to -> Scanning for projects.....->Build failure->ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. – STD Feb 19 '17 at 18:55
  • @kevcodez,@Sid,@Andy Turner I went in Eclipse,right click project->Maven build->Specified Goal:package.Then in the cmd I navigated to the directory of the project ,executed mvn package and that successfuly triggered the execution of the tests.For now this seems to do the job.Thank you guys for the help,I will make further research on maven,jenkins and scheduled task services. – STD Feb 19 '17 at 19:31
  • @STD can you try `mvn test -Dtest=YourClass` – kevcodez Feb 19 '17 at 19:53

1 Answers1

0

Follow this to see how you can schedule it:

http://www.digitalcitizen.life/how-create-task-basic-task-wizard. Not pasting the contents of this article since it contains a lot of images.

In the scheduler, go to the directory, and run mvn test -Dtest=com.package.ClassName

Sandeep Kaul
  • 2,369
  • 2
  • 17
  • 32