public Task RunTestCases(TestCaseDataObject testData) { var testCase = testData.GetObject <TestCase>(); Logger.LogInformation(JsonConvert.SerializeObject(testCase, Formatting.Indented)); // TODO: Implement tests and scripts //var runner = new XUnitTestRunner(new TestClientFactory(testCase.ChannelId).GetTestClient(), Logger); //await runner.RunTestAsync(Path.Combine(_testScriptsFolder, testCase.Script)); // TODO: remove this line once we implement the test and we change the method to public async task return(Task.CompletedTask); }
public async Task RunTestCases(TestCaseDataObject testData) { var testCase = testData.GetObject <TestCase>(); Logger.LogInformation(JsonConvert.SerializeObject(testCase, Formatting.Indented)); var options = TestClientOptions[testCase.HostBot]; var runner = new XUnitTestRunner(new TestClientFactory(testCase.ChannelId, options, Logger).GetTestClient(), TestRequestTimeout, ThinkTime, Logger); var testParams = new Dictionary <string, string> { { "DeliveryMode", testCase.DeliveryMode }, { "TargetSkill", testCase.TargetSkill } }; await runner.RunTestAsync(Path.Combine(_testScriptsFolder, testCase.Script), testParams); }
public async Task RunTestCases(TestCaseDataObject testData) { var userId = string.Empty; var url = string.Empty; var testCase = testData.GetObject <TestCase>(); Logger.LogInformation(JsonConvert.SerializeObject(testCase, Formatting.Indented)); var options = TestClientOptions[testCase.HostBot]; var runner = new XUnitTestRunner(new TestClientFactory(testCase.ChannelId, options, Logger).GetTestClient(), TestRequestTimeout, ThinkTime, Logger); var testParamsStart = new Dictionary <string, string> { { "DeliveryMode", testCase.DeliveryMode }, { "TargetSkill", testCase.TargetSkill } }; // Execute the first part of the conversation. await runner.RunTestAsync(Path.Combine(_testScriptsFolder, testCase.Script), testParamsStart); await runner.AssertReplyAsync(activity => { Assert.Equal(ActivityTypes.Message, activity.Type); Assert.Contains("Navigate to http", activity.Text); var message = activity.Text.Split(" "); url = message[2]; userId = url.Split("user="******"UserId", userId }, { "TargetSkill", testCase.TargetSkill } }; // Execute the rest of the conversation passing the messageId. await runner.RunTestAsync(Path.Combine(_testScriptsFolder, "ProactiveEnd.json"), testParamsEnd); }
public async Task RunTestCases(TestCaseDataObject testData) { var testGuid = Guid.NewGuid().ToString(); var fileName = $"TestFile-{testGuid}.txt"; var testCase = testData.GetObject <TestCase>(); Logger.LogInformation(JsonConvert.SerializeObject(testCase, Formatting.Indented)); var options = TestClientOptions[testCase.HostBot]; var runner = new XUnitTestRunner(new TestClientFactory(testCase.ChannelId, options, Logger).GetTestClient(), TestRequestTimeout, ThinkTime, Logger); // Execute the first part of the conversation. var testParams = new Dictionary <string, string> { { "DeliveryMode", testCase.DeliveryMode }, { "TargetSkill", testCase.TargetSkill }, { "FileName", fileName }, { "TestGuid", testGuid } }; await runner.RunTestAsync(Path.Combine(_testScriptsFolder, testCase.Script), testParams); // Create a new file to upload. await using var stream = File.Create(Directory.GetCurrentDirectory() + $"/Skills/FileUpload/{fileName}"); await using var writer = new StreamWriter(stream); await writer.WriteLineAsync($"GUID:{testGuid}"); writer.Close(); // Upload file. await using var file = File.OpenRead(Directory.GetCurrentDirectory() + $"/Skills/FileUpload/{fileName}"); await runner.UploadAsync(file); // Execute the rest of the conversation. await runner.RunTestAsync(Path.Combine(_testScriptsFolder, "FileUpload2.json"), testParams); }
public async Task RunTestCases(TestCaseDataObject testData) { var signInUrl = string.Empty; var testCase = testData.GetObject <TestCase>(); Logger.LogInformation(JsonConvert.SerializeObject(testCase, Formatting.Indented)); var options = TestClientOptions[testCase.HostBot]; var runner = new XUnitTestRunner(new TestClientFactory(testCase.ChannelId, options, Logger).GetTestClient(), TestRequestTimeout, Logger); var testParams = new Dictionary <string, string> { { "DeliveryMode", testCase.DeliveryMode }, { "TargetSkill", testCase.TargetSkill } }; // Execute the first part of the conversation. await runner.RunTestAsync(Path.Combine(_testScriptsFolder, testCase.Script), testParams); await runner.AssertReplyAsync(activity => { Assert.Equal(ActivityTypes.Message, activity.Type); Assert.True(activity.Attachments.Count > 0); var card = JsonConvert.DeserializeObject <SigninCard>(JsonConvert.SerializeObject(activity.Attachments.FirstOrDefault().Content)); signInUrl = card.Buttons[0].Value?.ToString(); Assert.False(string.IsNullOrEmpty(signInUrl)); }); // Execute the SignIn. await runner.ClientSignInAsync(signInUrl); // Execute the rest of the conversation passing the messageId. await runner.RunTestAsync(Path.Combine(_testScriptsFolder, "SignIn2.json"), testParams); }