Sign in to follow this  
Followers 0
CygnusX1

Testcases and Verify Results

4 posts in this topic

Hey,

I would like to set up functions names as TestCase1(), TestCase2(), etc...

I'd like to be able to use this structure to test features of the program. One thing I'm having trouble is when a TestCase "fails" or has some sort problem all other TestCases cease to run. How do you tell AutoIt to 'break' if failure and continue with the rest of the TestCases? Is this something the @error macro is for?

Also, in the same vein, if a TestCase fails and/or passes. How would you display the results? Write to a text file or HTML file? I understand that I'll have to set up some sort of flag that determines failures and passes.

Thank for any help or ideas.

Cygnus


Cygnus

Share this post


Link to post
Share on other sites



I usually log to TXT files... I set up all scripts to start from a static point. And when they end or error, I set up a cleanup to get me back to square one before the next test starts. Or you can have different "stages" to start from, and scripts that get you to, or back to, that "stage". It is very complicated, but rewarding when done right.

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

Hey Lar,

Thanks for your response.

I do have a "base_state" function which does clean up the program after each test, which get me back to square one.

However, there are some instances when my TestCase fails due to an unknown failure right in the middle. It's in this cases I need to break from the TestCase, log the error and move on to the next TestCase.

I have my script set up like this:

TestCase1()

TestCase2()

TestCase3()

If TestCase2() has a problem and errors out i.e. "subscript used on a non-array variable" and write to the console. TestCase3() never gets called and all my TestCasses cease to run. Is this the problem I'm having, my base_state() never gets called. How do you get around a script that errors out and stops all TestCases from running?

Thank you.

Cygnus


Cygnus

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You've got to write code that can't generate fatal errors like that.

Ensure variables exist before calling them.

If you're expecting an array, test its size before using an element that may not exist.

If that's too much work, at least take a look a the options relating to fatal errors and autoit exit.

edited for brevity.

Edited by flyingboz

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0