public static void ExecuteTestFromJson(string jsonFile) { var test = TestBookHelper.ReadTestFromJson(jsonFile); test.ConvertFromPageObject(); test.Execute(); }
public static ITest ExecuteTestFromJson(string jsonFile) { var test = TestBookHelper.ReadTestFromJson(jsonFile); test.ConvertScenarioToElementarySteps(ContextLoader.Instance, ScenarioLoader.Instance); test.InsertScreenshotSteps(); test.ConvertFromPageObject(SiteMap.Models.SiteMap.Instance); TestBookHelper.SaveTestToJson(test, $"{test.FilePath.Replace(".json", "-conv.json")}"); test.Execute(); TestBookHelper.SaveTestToJson(test, $"{test.FilePath.Replace(".json", "-result.json")}"); return((ITest)test); }
public static async Task <ITest> ExecuteTestFromJsonAsync(string jsonFile, ExecutionEnvironment executionEnvironment) { var test = TestBookHelper.ReadTestFromJson(jsonFile); test.ConvertScenarioToElementarySteps(executionEnvironment); test.InsertScreenshotSteps(); test.ConvertFromPageObject(executionEnvironment); //to use on debug mode only //TestBookHelper.SaveTestToJson(test, $"{test.FilePath.Replace(".json", "-conv.json")}"); var sessionId = await test.ExecuteAsync(executionEnvironment); //TestBookHelper.SaveTestToJson(test, $"{test.FilePath.Replace(".json", "-result.json")}"); var outputFile = Path.Combine(executionEnvironment.OutputDirectoryLocation, sessionId, test.FileName.Replace(".json", "-result.json")); TestBookHelper.SaveTestToJson(test, outputFile); return(test); }
public void TestBook_ReadTestFromJson_CheckTestStepsCount(string jsonFile, int stepCount) { Test test = TestBookHelper.ReadTestFromJson(jsonFile); Assert.AreEqual(stepCount, test.Steps.Count); }