The official website of Autolt defines it as a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. Autolt runs on all versions of Windows. This third-generation programming language can be used to automate any specific task by simply writing a few lines of script.
It can hardly be denied that many of us are becoming a bit lazy about performing tasks manually, and try our best to make the system do all repetitive tasks to the highest extent possible. If you are running out of time for completing a specific task on some online application within a deadline, you will rely on the system to do so with accuracy, reducing the chance of last minute errors that might creep in if the task is done manually. That is why automation is so important in the current technology-driven era.
Automation testing gauges the quality of software with other tools or software code, which compare the actual outcomes with the predicted outcomes. The entire test suite is run without any manual intervention. The tool itself generates the final outcome of the testing performed in the form of a test report, which features the expected and actual outcomes. The specific method or process that is used to implement the automated process is called a test automation framework.
The tool can even help us log defects if required. Automation testing is one of the most happening areas of the software quality assurance industry, as most organisations prefer to rid themselves of manual testing as much as possible. They want to rely on the system or on some tool. Let’s have a look at the possible reasons for this.
■ Manual testing is time- and cost-consuming when it comes to covering all workflows, all fields and all negative scenarios. If the same set of validations is performed at different intervals, as in the case of regression testing, then automation testing is quite important.
■ Automation testing does not require any human intervention. The automated test suite can be run unattended (even overnight).
■ It increases the speed of test execution.
■ It increases test coverage.
■ Manual testing can also become boring at times and, therefore, it is error prone.
Some open source automation testing tools
There are many options to test any type of software. Some tools are available as open source while some are licensed, for which one has to pay before use. The first choice of any organisation is always for open source tools as they are free of cost. But there are certain limitations associated with these tools, due to which some firms opt for licensed tools. Table 1 lists some open source tools that are being used to test various types of software applications.
The Autolt tool
Autolt is an open source tool that can be used to automate various processes involving Windows and desktop
applications. The official website of Autolt defines it as a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It basically uses a combination of different keystrokes, mouse movements and window/control manipulation to automate different tasks. Autolt runs on all versions of Windows. Since its initial release around 17 years ago by Jonathan Bennett and the Autolt team in January 1999, it has become a very powerful language that supports various complex expressions, user functions, loops and other such features.
The syntax of the scripting language used in Autolt programming language with a classical data model and various data types which can store several types of data.
It can be used to automate any specific task by simply writing a few lines of script or even record that process using the Autolt Recorder. Once the recording is done, the script is automatically generated and we can use the same to further play back the recorded process.
It identifies several elements of the application by using their various properties like the control ID, coordinates, the element’s name and other such smart identifiers. All such identifiers’ values are stored in a repository in the form of objects, and they are used during playback to identify various elements and perform actions on them.
The AU3 Info object identifier helps retrieve these values for a specific element of an application. It also has several inbuilt function libraries containing predefined functions that must be imported so that different functions can be used in the script. It has a SciTE editor, which
helps to build and run various programs. The SciTE editor also provides all the configuration settings and other utility programs like Code Folding, Auto-complete, Syntax Highlighting and Intellisense. Autolt is distributed with an IDE which is based on the free SciTE editor. The compiler and its help text are fully integrated and provide a standard environment for developers. We can create various GUIs such as Input Box, Label, Browser window, etc, which can be used to get a feel of the built application while creating a script. Once we have created a script, we can save it in the form of a .au3 executable file. It can be converted into a compressed and standalone executable, which can even be run on computers that do not have the Autolt interpreter installed.
Features of Autolt
Let’s check the various features of Autolt.
Easy to learn syntax: Autolt uses a very simple syntax for its scripting language, which can be easily leamt and implemented for the automation of any process. The SciTE editor makes it easy by providing the syntax highlighting feature, using which one can get an idea of the syntax of the various predefined functions used.
Record and playback: As previously discussed, Autolt can even record and generate a script on its own for specific processes that need to be automated. Once recorded, the same script, without any modification, can be used to run and play back the recorded process when required.
Interaction with all standard Windows controls: Autolt can easily interact with all types of standard Windows controls and other GUIs without any object identification issue. It identifies a specific control with the help of the control ID, class name, title, position coordinates, visible text, etc – all of which are associated with that Windows control. It can get such properties of an element using the AU3 Info tool.
Simulates keystrokes and various mouse movements: Autolt can even simulate various mouse movements and different keystrokes using the inbuilt ‘Send Key’ function. These movements and different key actions can also be recorded and played back afterwards.
Graphical User Interfaces (GUIs): Different GUIs can be provided to different processes, wherever required while automating a specific task, using Autolt. There are several inbuilt functions under ‘GUI Control Create’ for different GUIs, which can be incorporated. Each of the separate GUI functions has a different syntax, following which we can generate different GUIs like the input box, label, browser window, drop-down menu, etc.
Calling external DLL and Windows API functions directly: We can directly call any DLL using Autolt with the help of its predefined function, DLLcall. We can also call any API using this, and can even perform different operations on the Windows API using several _WinAPI_ functions.
RunAs function: Autolt has an inbuilt RurtAs function, which helps in running any external program using some external user.
Detailed ‘Help’ file and large community-based support forums: Autolt comes with Autolt Help.exe, which provides all the possible help and support information for any learner.
It even illustrates the automation of several scenarios, where the tool was used.
Compatibility: Autolt is compatible with all Windows versions — Windows XP, 2003, Vista and 2008; Windows 7, 2008 R2, Windows 8 and 2012 R2.
Compilation of scripts into standalone executables: The entire script written using Autolt can be stored in the form of a ,au3 executable, which can be easily compiled and executed by simply clicking on the ,au3 executive file. We need not open the script to run it.
How to automate a process using Autolt
We first need to have Autolt installed on our system. It just takes a few minutes to install it—simply click on autoit setup.exe. We need to additionally install Scite Editor.exe as well, in order to have the script editor in Autolt.
Once we are done with the installation part, we need to simply right-click anywhere on the location where Autolt has been installed, and follow the steps shown below to get the new ,au3 file created on our system.
Right click New -> Autolt v3 script -> Give a name to the file -> Press Enter.
Once we have created the ,au3 file using the above steps, we need to just right click on this file and select the Edit script option to get an Autolt script editor window, as shown in Figure 5.
This is where we can try our hand at scripting in order to make the Autolt tool perform some task or action. Let’s automate a simple scenario where the user is asked his/her name, and once that is entered in the input box, the user gets a ‘Welcome’ message. Before proceeding with the scripting part, we can add our name as the Author in the autogenerated template of the script editor window.
The requirements are:
1. The ability to display the question asking the user for his/her user name and to accept this input. To incorporate this, we need to have the predefined InputBox function of Autolt.
2. The inbuilt Message Box function to display a Welcome message for the user. We will have to import the MessageBoxConstants library to use the Message Box function in our script.
Let’s start scripting with the following steps:
1. Import all the required library files — we need to include the MessageBoxConstants library file.
2. Declare all the types of variables required (integer, string, etc) using the keyword Dim.
3. As discussed in Requirement 1, use the InputBox function to ask and take the input from the user. We just need to type Input and then click Ctrl + Space to get various hints, and then we can select InputBox out of the options provided.
4. Insert an opening round brace just after InputBox; Autolt will display the hint of the syntax to be followed for that specific function. So here, for InputBox, we need to enter the following parameters in sequence.
• Title – title to appear on top of the Input Box window
• Prompt – the question for which the user needs to provide input.
5. Once the user enters his/her name, we need to display the Welcome message using the name; so we will store the value of InputBox in a variable. We also need to verify whether the user has entered a name or not, so that we can display the Welcome or Error message accordingly. Hence, we will use the conditional If-else for that.
Finally, we are ready with the following Autolt code:
; Including library files ffinclude <MsgBoxConstants.au3>
; Variable Declaration Dim SuserName
; Taking input from User
SuserName=InputBox(“User Name”,”Please enter the User Name”)
; Validating if User has entered some User Name and then displaying Welcome Message If SuserName <> Then
MsgBox(0,”Welcome Message”,”Hey ” & SuserName & “, Welcome to Autolt..!!!”)
MsgBox(0,”Error Message”, “Please enter the User Name”)
Once we run the above code using F5, we will get an input box for the user to enter his/her name (Figure 6).
Once the user enters some name, a Welcome message will be displayed (Figure 7).
If the user does not enter any name and clicks on OK, then an Error message is generated.
Advantages of Autolt
1. Supports easy record/playback and simple scripting
2. Loglines can be debugged easily with consolewritecommand.
3. Autolt is an open source tool for which we do not need to pay.
4. Small standalone executables can be created using Autolt.
5. Autolt can recognise specific areas with pixelchecksum and pixelsearch.
6. It recognises all basic Windows controls and also has the option to create different GUIs.
Disadvantages of Autolt
1. All types of objects are not identified by the AU3 Info tool.
2. Autolt has no Java support available so far.
3. It has no control repository to give an object a logical or technical name.
4. It does not support all browsers, but only supports Internet Explorer controls by using IE.AU3 or its own COM object references.
5. Users need to import separate libraries for using different predefined utility functions.
There are several open source tools available in the market, but we need to evaluate and analyse any specific tool based on our requirements. Autolt is one tool which can be used to automate various processes associated with Windows and desktop based applications with simple, user-friendly scripting.
By: Vivek Ratan
The author is a B. Tech in electronics and instrumentation engineering. He currently works as an automation test engineer at Infosys, Pune. He can be reached at ratanvivekt email@example.com