Sign in to follow this  
Followers 0
bhavesh803

Need help for testcase fail over condition in Autoit.

4 posts in this topic

Hi,

I want to know how we can rescue in Autoit.

What i mean is like, for eg i have 4 testcases.

Testcase1

find checkbox by name "allow" and click it

find checkbox by name "edit" and click it

Testcase2

find checkbox by name "allow2" and click it

find checkbox by name "copy" and click it

Testcase3

find checkbox by name "allow3" and click it

find checkbox by name "move" and click it

Testcase4

find checkbox by name "allow4" and click it

find checkbox by name "store" and click it

Now currently if i execute script and if in testcase1, script is not able to find checkbox "allow", it does not throw any error.

It just moved ahead with another line.

But what i want to do is like :

1. If it is not able to find any checkbox then it should skip this testcases and go to next testcases i.e. testcase2.

2. OR If it is not able to find any checkbox then simply call the cleanup function, which will close the current window and then go to next testcase.

How we can achieve this.

Im using Micro framework for unit test, so i created the testcases, but if test case fails then im not able to track it where it failed.

Any help is appreciated.

Thanks

Bhavesh

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

What I want is: find help file and click on search. :idiot:

Edited by FireFox
1 person likes this

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

You need to provide some type of code to see where you are in the process. It's hard to help you if you don't show what you have so far.


EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites

@EndFunc :

Something like this i have :

;TEST1

ShellExecute("C:DataExcel_Docsprotfile1.xlsx")

call("WaitforWindow", "Microsoft Excel - file1")

$titletext = WinGetTitle("Microsoft Excel - file1")

$var1 = "fail"

If $titletext = "Microsoft Excel - file1" Then

FileWrite("result.txt", "TestCase : 0003 : Passed : Excel File Opened Properly" & @CRLF)

$var1 = "pass"

EndIf

If $var1 == "fail" Then

FileWrite("result.txt", "TestCase : 0003 : Failed : Excel File Not Opened Properly" & @CRLF)

EndIf

call("Close_MSWord")

;TEST2

ShellExecute("C:DataExcel_Docsprotfile2.xlsx")

call("WaitforWindow", "Microsoft Excel - file2")

$titletext = WinGetTitle("Microsoft Excel - file2")

$var1 = "fail"

If $titletext = "Microsoft Excel - file2" Then

FileWrite("result.txt", "TestCase : 0004 : Passed : Excel File Opened Properly" & @CRLF)

$var1 = "pass"

EndIf

If $var1 == "fail" Then

FileWrite("result.txt", "TestCase : 0004 : Failed : Excel File Not Opened Properly" & @CRLF)

EndIf

call("Close_MSWord")

Now if it is not able to open the file or if there is any other failure, i want this to move to next testcase.

I mean i can add cleanup setps and then ask the script to move to next text case or may be move to next line.

But im not sure how to verify that command which is executed is passed or failed.

Becasue in most of the cases we usually script to click some button, and if it is not found it just go ahead without any error that button is not found.

If i get such error that buton is not found then i will know that comman is not sucessfull and then i stop that testcase there only and ask script to move to next testcase.

Can anybody help.

Bhavesh

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