CygnusX1 Posted March 16, 2008 Share Posted March 16, 2008 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 Link to comment Share on other sites More sharing options...
LarryDalooza Posted March 16, 2008 Share Posted March 16, 2008 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. AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
CygnusX1 Posted March 16, 2008 Author Share Posted March 16, 2008 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 Link to comment Share on other sites More sharing options...
flyingboz Posted March 16, 2008 Share Posted March 16, 2008 (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 March 16, 2008 by flyingboz Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now