The easiest way to generate empty test results is such a script:
param(
	[int]$suites,
	[int]$scenarios,
	[int]$testResults
      )

1..$suites | `
	%{ $null = New-TMXTestSuite -Name "suite_$($_.ToString())";
		for ($i = 1; $i -le $scenarios; $i++) {
			$null = Add-TMXTestScenario -Name "scenario_$($i)";
			for ($j = 1; $j -le $testResults; $j++) {
				$null = Close-TMXTestResult -Name "test result $($i)" -TestPassed;
			}
		}
	}

Write-Host "Suites:" (Search-TMXTestSuite).Count;
Write-Host "Scenarios:" (Search-TMXTestScenario).Count;
Write-Host "Test results:" (Search-TMXTestResult).Count;
If you call this piece of code GenerateTestResults.ps1 and run the command:
GenerateTestResults.ps1 10 10 10 
output will be the following:
Suites: 10
Scenarios: 100
Test results: 1001
Any time you close a test result, a new is being generated, so that there are 1001 results instead of 1000.

You can clean up generated data by issuing the following piece of code:
[TMX.TestData]::ResetData();

If you need to generate test results with screenshots, you might use the following script:
param(
	[int]$suites,
	[int]$scenarios,
	[int]$testResults
      )

$testResultCounter = 0;
1..$suites | `
	%{ $null = New-TMXTestSuite -Name "suite_$($_.ToString())";
		for ($i = 1; $i -le $scenarios; $i++) {
			$null = Add-TMXTestScenario -Name "scenario_$($i)";
			for ($j = 1; $j -le $testResults; $j++) {
				$testResultCounter++;
				try { Get-UIAWindow -n "no window" -Timeout 100 -OnErrorScreenshot; } catch { Write-Host "$($testResultCounter/$testResults/$scenarios/$suites*100)%";}
				$null = Close-TMXTestResult -Name "test result $($i)" -TestPassed:$false -OnErrorScreenShot;
			}
		}
	}

Write-Host "Suites:" (Search-TMXTestSuite).Count;
Write-Host "Scenarios:" (Search-TMXTestScenario).Count;
Write-Host "Test results:" (Search-TMXTestResult).Count;
Supposed that it's called GenerateTestResultsWithScreenshots.ps1, run it with the following parameters:
GenerateTestResultsWithScreenshots.ps1 10 10 10 

Last edited Nov 14, 2012 at 2:31 PM by josekardano, version 4

Comments

No comments yet.