how to signal when test is done

Ask general questions here.
Ruser
Posts: 24
Joined: Wed Oct 07, 2009 3:26 pm

how to signal when test is done

Post by Ruser » Thu Apr 01, 2010 4:58 pm

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

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: how to signal when test is done

Post by Ciege » Thu Apr 01, 2010 6:16 pm

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.
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...

User avatar
Support Team
Site Admin
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

Post by Support Team » Thu Apr 01, 2010 6:45 pm

Ruser wrote:how can I know Test1 pass or fail so that I can put a logic here before test2 starts.
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).

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

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: how to signal when test is done

Post by Ciege » Thu Apr 01, 2010 6:49 pm

Support Team wrote:However, in general I think ciege's suggestions are better
That has to be one of the best April Fools jokes I have seen in years! Thanks for the laughs... :lol:
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...

User avatar
Support Team
Site Admin
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

Post by Support Team » Thu Apr 01, 2010 7:16 pm

Ciege wrote:That has to be one of the best April Fools jokes I have seen in years!
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 posts :D

atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

Re: how to signal when test is done

Post by atom » Wed Apr 07, 2010 5:43 pm

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!