Created
March 10, 2017 09:15
-
-
Save lawrencegripper/bf370eb9ae5cd9cfea5f2cad6d8826b8 to your computer and use it in GitHub Desktop.
Quick script to run a simple webtest from powershell, setting contextParameters and capturing the results.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Run_PostDeployWebTest.ps1 | |
| # | |
| Param( | |
| [string][Parameter(Mandatory=$true)]$WebTestPath, | |
| [string][Parameter(Mandatory=$true)]$PublicUrl, | |
| [string][Parameter(Mandatory=$true)]$OutputDir, | |
| [string]$OutputFileName = "WebTestResult.xml" | |
| ) | |
| #Runs the basic browse test to check things are behaving. | |
| if (Test-Path $OutputDir/$OutputFileName) | |
| { | |
| Remove-Item $OutputDir/$OutputFileName | |
| } | |
| #Test vars are picked up from the environment variables. The test var needs to be prefixed with "Test." then the name of the var | |
| [Environment]::SetEnvironmentVariable("Test.publicwww",$PublicUrl) | |
| & "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Mstest.exe" /TestContainer:"$WebTestPath" /resultsfile:"$OutputDir/$OutputFileName" /detail:errormessage /detail:outcometext /detail:duration /usestderr |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sure don't see why not, you should be able to invoke it with
Process.Startor similar but I haven't tried so wouldn't be able to give you guidance.