Reputation: 1023
I'm using AutoIt for testing my application. There are different test cases for that. I will create these test cases as au3 files. Now I want to run all these scripts one after other. That is, a main script which call all sub script files one after other. How can I do that?
Upvotes: 3
Views: 3898
Reputation: 1
modified code as follows:
#include <File.au3>
$Path = @ScriptDir & '\TestCases\'
$files = _FileListToArray($Path, "*.au3")
MsgBox(0,"path", $files[0])
For $i = 1 To $files[0]
RunWait(@AutoItExe & " /AutoIt3ExecuteScript "& '"'& $Path & $files[$i] & '"')
Next
Upvotes: 0
Reputation: 1
#include <File.au3>
$Path = @ScriptDir & 'TestCases\'
$files = _FileListToArray($Path, "*.au3")
For $i = 1 To $files[0]
RunWait(@ScriptFullPath & '/AutoIt3ExecuteScript "' & $Path & $files[$i] & '.au3"')
Next
Upvotes: 0
Reputation: 714
In a main AutoIt script (main.au3) you just add:
#include <UDF_function_1.au3>
#include <UDF_function_2.au3>
#include <UDF_function_3.au3>
Func _lanch_all()
; In order to run AutoIt function
_function_1() ; from UDF_function_1.au3
_function_2() ; from UDF_function_2.au3
_function_3() ; from UDF_function_3.au3
Run(PATH_to_script\"script_1.bat") ; In order to run a batch script windows
Run(PATH_to_executable\"script_2.exe") ; In order to run an executable
EndFunc
And for example UDF_function_1.au3 contains:
#include-once
Func _function_1()
ConsoleWrite("Call of _function_1"&@CRLF)
EndFunc
Upvotes: 2
Reputation: 2946
If you don't want to compile these test cases, you just compile the main exe:
Compiled.exe [/ErrorStdOut] [/AutoIt3ExecuteScript file] [params ...] Execute another script file from a compiled AutoIt3 Script File. Then you don't need to fileinstall another copy of AutoIT3.exe in your compiled file.
#include <File.au3>
$Path = @ScriptDir & 'TestCases\'
$files = _FileListToArray($Path, "*.au3")
For $i = 1 To $files[0]
RunWait(@ScriptFullPath & '/AutoIt3ExecuteScript "' & $Path & $files[$i] & '.au3"')
Next
Upvotes: 1
Reputation: 285440
Just create a master AutoIt program and have this program run the other sub programs. If they are present in .au3 format, simply have the master program include the sub programs via the include
keyword:
#include "[path\]filename"
This will allow the master program to call functions of the included sub-program.
Upvotes: 0