Software QA FYI - SQAFYI

Automated Software Testing With Macro Scheduler

By: MJT Net Ltd

Part:   1  2  

(Continued from previous part...)

Adding Test Cases
As software products grow the need for more test cases arises. We can simply add more steps to the script, or add new test scripts and chain them together. For example, we may add another button to our sample application to reverse the conversion to convert from centimetres to inches. We use the same methods described here but working with a different button and checking the inches field rather than the centimetres field for the outcome.

Testing Web Applications
Web pages and web applications introduce a different kind of problem. Web pages are dynamic in nature and objects do not have absolute positions. The best way to build automated test scripts for web applications is to use MacroScript WebRecorder, which builds scripts automatically by recording web activity. These scripts can then be edited to add the validation, outcome and range checks and result output needed for the test plan.

Conclusion
Automated testing streamlines the QA process and saves precious resources, time and money. As the project continues along it s life cycle it is easy to run previously created test scripts and add new test cases. The time saved by running test scripts over manual checklists is enormous and bugs can be found more quickly. Test scenarios can easily be run repeatedly for added confidence in your product. Developers, QA engineers and customers all benefit.

With Macro Scheduler s powerful GUI automation routines, output functions, VBScript capability and complex expressions it is easy to build advanced test scenarios for all applications.



The Complete Script
//set up our log file here
Let>logfile=d:\testresults.log
//Focus the app
SetFocus>Imperial - Metric Conversion
//check we get an error if we click 
//Convert without entering a number
Press ALT
Send>c
Release ALT
//wait for error box
Let>WW_TIMEOUT=5
WaitWindowOpen>Error
If>WW_RESULT=TRUE
//ok, the Error window appeared
TimeStamp>logfile,No data Error: Success
//cancel the error box
Wait>1
Press Esc
Else
//No error window
TimeStamp>logfile,No data Error: Fail
Endif
//Enter some invalid data
SetFocus>Imperial - Metric Conversion
Press ALT
Send>i
Release ALT
Send>abc
//Click Convert
Press ALT
Send>c
Release ALT
//wait for error box
Let>WW_TIMEOUT=5
WaitWindowOpen>Error
If>WW_RESULT=TRUE
//ok, the Error window appeared
TimeStamp>logfile,Bad data Error: Success
//cancel the error box
Wait>1
Press Esc
Else
//No error window
TimeStamp>logfile,Bad data Error: Fail
Endif
//Send some valid data
SetFocus>Imperial - Metric Conversion
//clear inches box
SetControlText>Imperial - Metric Conversion,TEdit,2,
//focus inches box and send value 
//(we could just use SetControlText!)
Press ALT
Send>i
Release ALT
Send>1
//Click Convert
Press ALT
Send>c
Release ALT
//result should be 2.54
GetControlText>Imperial - Metric Conversion,TEdit,1,result
If>result=2.54
TimeStamp>logfile,1inch=2.54cm: Success
Else
TimeStamp>logfile,1inch=2.54cm: Fail
Endif
//try another value - this time we'll use SetControlText ...
SetControlText>Imperial - Metric Conversion,TEdit,2,20
Press ALT
Send>>c
Release ALT
GetControlText>Imperial - Metric Conversion,TEdit,1,result
If>result=50.8
TimeStamp>logfile,20inch=50.8cm: Success
Else
TimeStamp>logfile,20inch=50.8cm: Fail
Endif

Part:   1  2  


Other Resource

... to read more articles, visit http://sqa.fyicenter.com/art/

Automated Software Testing With Macro Scheduler