-1

I'm searching how to run my testng file in a loop for example each hour with a batch file

To run my test I use this

mvn clean test

and it's working fine (I have the maven surefire plugin inside my pom)

I also tried to make an infinite loop in batch like this

:while
if %var% equ %var% (
   timeout /t %time_to_wait%
   goto :while
)

and this also works fine

but for some reason if I'm doing the 2 at the same times like this

:while
if %var% equ %var% (
   mvn clean test
   timeout /t %time_to_wait%
   goto :while
)

It will run my test, wait for the x seconds then instead of going back inside the loop it just stops

Any idea ?

user3718160
  • 481
  • 2
  • 11
  • 23
  • 1
    before going into possible solutions, why do you need to run the same tests so many times? – A_Di-Matteo Jun 20 '16 at 14:59
  • Also, did you already check software solution, like the `@Repeat` annotation described in [this Stack Overflow post](http://stackoverflow.com/questions/1492856/easy-way-of-running-the-same-junit-test-over-and-over)? – A_Di-Matteo Jun 20 '16 at 15:07
  • What is `if %var% equ %var%` for? why not simply omit it? and what did you set `var` to? it will fail of `var` is empty! and what is `mvn`? is it a batch file on its own? if so, precede it with `call `... – aschipfl Jun 20 '16 at 15:21
  • @aschipfl yes, it's a batch on its own, but I still have doubts about the whole approach, the idea behind, and the context (continuous integration?) – A_Di-Matteo Jun 20 '16 at 15:34
  • The goal is to run a battery of tests on multiple device each day for example to verify that the app is running the way it should mvn is the cmd to run maven tests – user3718160 Jun 21 '16 at 07:08

1 Answers1

2

As I understand, you need some continuous integration.

Have you already try jenkins or any other servers ?

juherr
  • 5,640
  • 1
  • 21
  • 63