I remember I read related topic somewhere but couldn't find it now. so I start a new thread here
I have multiple automation tests, I plan to have a cmd file to order those tests, like:
call Test1.exe
call Test2.exe
....
how can I know Test1 pass or fail so that I can put a logic here before test2 starts.
Thank you
how to signal when test is done
Re: how to signal when test is done
There really are multiple ways of doing this...
One of the simplest is to write to a text file at the end of each test Pass or Fail then the beginning of the next test would be to read that file.
In your case, rather than using a CMD file to kick off the tests, why not write a wrapper script that calls each test in succession. Then that wrapper script can read the results of the last test and determine whether or not to kick off the next test.
One of the simplest is to write to a text file at the end of each test Pass or Fail then the beginning of the next test would be to read that file.
In your case, rather than using a CMD file to kick off the tests, why not write a wrapper script that calls each test in succession. Then that wrapper script can read the results of the last test and determine whether or not to kick off the next test.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: how to signal when test is done
If you just need to know whether a test passed or failed, you could also use the process return value. E.g. return a negative value on fail and a positive when the test passed from your TestX.exe applications. In your batch/cmd file you can then check for that return value using the errorlevel variable (see http://support.microsoft.com/kb/69576).Ruser wrote:how can I know Test1 pass or fail so that I can put a logic here before test2 starts.
However, in general I think ciege's suggestions are better - especially since I always have to look up the Windows command batch syntax. It's either me or the Windows command line syntax that is too stupid

Regards,
Alex
Ranorex Support Team
Re: how to signal when test is done
That has to be one of the best April Fools jokes I have seen in years! Thanks for the laughs...Support Team wrote:However, in general I think ciege's suggestions are better

If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: how to signal when test is done
It's nearly too late for April Fools jokes here in Austria... Well, I didn't want that "general" to sound that general, but I think the statement fits the quality of your postsCiege wrote:That has to be one of the best April Fools jokes I have seen in years!

Re: how to signal when test is done
Hiya,
This is one thing missing from alot of "Runner" programs like MSTest, NUnit etc.
The ability to define dependencies between tests....
e.g.
- Test1
- Test2
- - Test3
- - - Test4
Here Test3 is conditional on Test2, and Test4 conditional on Test3
We had the same requirement, and the way we did that was to design "test cases" as classes, each implementing an ITestCase interface. The interface defines one method "Execute", which returns a TestResult enumerated type (Pass, Fail, etc.).
We then developed a TestRunner program, that loads an assembly containing test classes, reflects it looking for all ITestCase types. The runner then takes an xml file of what classes to execute, and in what order, and with what dependencies.... took about a week to develop, but is nice!
This is one thing missing from alot of "Runner" programs like MSTest, NUnit etc.
The ability to define dependencies between tests....
e.g.
- Test1
- Test2
- - Test3
- - - Test4
Here Test3 is conditional on Test2, and Test4 conditional on Test3
We had the same requirement, and the way we did that was to design "test cases" as classes, each implementing an ITestCase interface. The interface defines one method "Execute", which returns a TestResult enumerated type (Pass, Fail, etc.).
We then developed a TestRunner program, that loads an assembly containing test classes, reflects it looking for all ITestCase types. The runner then takes an xml file of what classes to execute, and in what order, and with what dependencies.... took about a week to develop, but is nice!