Jump to content

Unit Testing in AutoIt...sorta

Recommended Posts

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.


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:


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


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
Link to comment
Share on other sites

  • 14 years later...

Your work is pretty good, I'm trying to apply your framework for my automation testing project. However, there is still issue with the Func CloseApp inside FunctionLib.au3. None of the app instances are closed after test. Could you please help a look on this please.

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...