namespace QuerySurgeConnector.ExecuteScenarioBySuiteIdExample; [TestClass] public sealed class ExecuteScenarioBySuiteIdExample { [TestMethod] public async Task QuerySurgeConnectionBySuiteIdTest() { // Declare and initialize variables string username = "admin"; string password = "admin"; string projectId = "1"; string scenarioName = "TFSScenario-" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string suiteIdList = "1"; //A folder for test results must be created //as a network shared folder with read/write permissions //This must be done even if the folder is on the same machine as Visual Studio string outputPath = "\\\\WIN-1RR16IP5RK6\\TestResults\\ExecutionScenarioBySuiteIdResults.html"; //Create the QuerySurgeConnection object QuerySurgeConnection querySurgeConnection = new QuerySurgeConnection(); //Login to QuerySurge await querySurgeConnection.Login(username,password); //Call the ExecuteScenarioBySuiteId method //This will make the request to the QuerySurge REST API //The execution result will be returned //The HTML Output will be created to the specified network path string runstatus = await querySurgeConnection.ExecuteScenarioBySuiteId(projectId,scenarioName,suiteIdList,outputPath); //Logout await querySurgeConnection.Logout(); //Add the HTML Output to the standard output of the test this.TestContext.AddResultFile(outputPath); //Determine if the test passed using the run status returned from QuerySurge Assert.AreEqual("Passed", runstatus); } //Create test context variable public TestContext TestContext { get { return testContextInstance; } set { testContextInstance = value; } } private TestContext testContextInstance; }