Sign in to follow this  
Followers 0
zfisherdrums

Unit Testing in AutoIt...sorta

2 posts in this topic

#1 ·  Posted (edited)

While working on an automation framework for my company, I found myself missing some of the xUnit testing capabilities that more "traditional" development environments employ. Then I remembered hearing Martin Fowler at a conference speak of the somewhat trivial task of implementing unit testing frameworks for companies he had worked for.

So what follows is my attempt at providing some unit testing functions in AutoIt. It is by no means as robust as the xUnit frameworks nor is it a highly-optimized, textbook implementation - but it suited my needs at the time.

Edit:

TestSetup and TestTearDown functionality added. These functions are accessed using "Call()" and are not required per se. But AU3Check will kickback non-fatal errors if they are not defined in the Test Script. See the examples uploaded for further clarification.

The example "CalcCore.zip" contains a minature automation framework for testing some functionality in "Calculator". The included "FunctionLibTests" and "ActionLibTests" describe the tests associated with their respective libraries. Run these to see Testing.au3 in action.

Here is Testing.au3:

Testing.au3

After placing Testing.au3 in the include directory, download this example:

CalcCore.zip

Current Limitations:

> Output File does not contain the periods and "F"'s that appear in the console.

> Only 3 Assertions

> Others only you know about

Edited by zfisherdrums

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