Purpose: to demonstrate the following SDA functionality:
- select Objects from repository
- entering text into a text field
- clicking a button
- checking to see if a page contains text.
Including SDA Core
#include <../../lib/sda.core.au3>
Get a new Test object instance
Func SimpleTest()
Local $oTest,$oRepo,$Page
;New Test object
$oTest = NewTest("Simple Test")
;Start Test
$oTest.Setup()
Starting a new Test report and new browser
;New Browser
$oTest.NewBrowser('firefox','http://es.altavista.com/')
$oTest.Browser.start
Get Object repository
$oRepo = $oTest.SetRepository("AltaVistaRepo")
and going to our site
;Search in Altavista
$Page = $oRepo.WebPage("Page.AltaVista")
$Page.open("/")
$Page.windowMaximize
$Page.input.item("search").type("BlueDuck SDA")
$Page.button.item("search").click
Use checkpoints to verify your results
If $Page.WaitForText("Try Blueduck SDA") = 1 Then
$oTest.AddStepResult("Step 1","Search",1)
Else
$oTest.AddStepResult("Step 2","Search",0)
EndIf
Close Test and Browser
$oTest.Report.Close
$oTest.Browser.stop
EndFunc
Running
SimpleTest()
Running Test
It is possible to take your Test script and compile it into a standalone executable; this executable can be used without the need for AutoIt to be installed and without the need to have AutoIt3.exe on the machine.
In addition, the compiled script is compressed and encrypted and there is the option to bind additional files (also compressed/encrypted) to the exe using the FileInstall function. Also, any #include
files will also be compiled into the script so they are not required at run-time.
Aut2Exe can be used in three ways:
- Method 1 - Start Menu
- Open the Start Menu and browse to the AutoIt v3 group./li>
- Click Script Compiler \ Convert .au3 to .exe
- The main Aut2Exe interface should appear.
- Use the Browse buttons to select your input (.au3) and output (.exe) files.
- If you like you can change the icon of the resulting .exe - just browse to the icon you want (some example icons are supplied in Program Files\AutoIt3\Aut2Exe\Icons).
- The only other option you might wish to change is the compression level (especially if using FileInstall to add extra files). Use the Compression menu to set this. As with all compression routines the better the compression you select the slower it will be. However, no matter what compression level you select the decompression speed (when the .exe is run) is the same.
- Click on Convert to compile the script.
- Method 2 - Right Click
- In Explorer browse to the Test file that you wish to compile
- Right-click the file to access the pop-up menu.
- The file will be silently compiled with the same filename - just with a .exe extension.
When compiling in this way, Aut2Exe uses current icon/compression settings (from the last time Aut2Exe was run manually as in method 1).
- Method 3 - The Command Line
The Aut2Exe.exe program can be run from the command line as follows:
Aut2exe.exe /in (infile.au3) [/out (outfile.exe)] [/icon (iconfile.ico)] [/comp 0-4] [/nopack] [x64] [/bin (binfile.bin)]
Analyzing Run Results
Designing Tests
The Result Reports displays the detailed result log of actions performed on a System Under Test (SUT) on each script run.
The Test Results reports contains two sections:
- Summary section
- Test Detail section