How to run suite multiple times

The best is to use the UI Vision RPA command line api. You can tell UI Vision to run the complete test suite with -folder teststuite and then loop over it.

Here is a solution for Powershell.

function PlayAndWaitCCC ([string]$macro)
{


$timeout_seconds = 60 #max time in seconds allowed for macro to complete (change this value if  your macros takes longer to run)
$path_downloaddir = "c:\1tmp\" #where the kantu log file is stored ("downloaded") *THIS MUST BE THE BROWSER DOWNLOAD FOLDER*, as specified in the browser settings
$path_autorun_html = "c:/1tmp/dc2.html"

#Optional: Kill Chrome instances (if any open)
#taskkill /F /IM chrome.exe /T 

#Create log file. Here Kantu will store the result of the macro run
$log = "log_" + $(get-date -f MM-dd-yyyy_HH_mm_ss) + ".txt" 
$path_log = $path_downloaddir + $log 

#Build command line
#$cmd = "${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe"
##For FIREFOX use: 
$cmd = "${env:ProgramFiles}\Mozilla Firefox\firefox.exe"
$arg = """file:///"+ $path_autorun_html + "?folder="+ $macro + "&storage=xfile&closeKantu=1&closeBrowser=1&continueInLastUsedTab=1&direct=1&savelog="+$log+""""

#direct=1&closeKantu=1&closeBrowser=1&continueInLastUsedTab=1&savelog=eod_log.txt

Start-Process -FilePath $cmd -ArgumentList $arg #Launch the browser and run the macro

#############Wait for macro to complete => Wait for log file to appear in download folder
$status_runtime = 0
Write-Host  "Log file will show up at " + $path_log
while (!(Test-Path $path_log) -and ($status_runtime -lt $timeout_seconds)) 
{ 
    Write-Host  "Waiting for macro to finish, seconds=" $status_runtime
    Start-Sleep 1
    $status_runtime = $status_runtime + 1 
}


#Macro done - or timeout exceeded:
if ($status_runtime -lt $timeout_seconds)
{
    #Read FIRST line of log file, which contains the status of the last run
    $status_text = Get-Content $path_log -First 1


    #Check if macro completed OK or not
    $status_int = -1     
    If ($status_text -contains "Status=OK") {$status_int = 1}

}
else
{
    $status_text =  "Macro did not complete within the time given:" + $timeout_seconds
    $status_int = -2
    #Cleanup => Kill Chrome instance 
    #taskkill /F /IM chrome.exe /T   
}

remove-item $path_log #clean up
return $status_int, $status_text, $status_runtime
}



###############################################################
#        Main program starts here
###############################################################

$testreport = "c:\test\test-folder.txt"

For ($i=0; $i -le 20000; $i++) {

#$result = PlayAndWait demo/core/demoautofill

$errortext = $result[1] #Get error text or OK
$runtime = $result[2] #Get runtime
#$report =[string] $i + "part1: ("+$runtime+" seconds), result: "+ $errortext
#Write-Host $report
#Add-content $testreport -value ($report)

Start-Sleep -s 2

}
1 Like