public static void RegenerateApiExpectedData(string actualResult) { if (!DataDriver.GetSystemPropertyString("REGENERATEDATA").Contains("YES")) { return; } ExternalFileServer.SaveStringAsTextFile(actualResult, GenerateExpectedFilePath()); }
protected override void ExecuteTest() { //DataDriver.OverrideEnvironmentValueForKey("REGENERATEDATA", "YES"); //Get API test data var baseUrl = SharedSteps.GetBaseUrl(); var uri = DataDriver.GetTestCaseDataValueByName(TestDataParameters.URI.ToString()); ServiceDriver.InitializeRestClient(baseUrl + uri, HttpVerb.GET); var actualResult = ServiceDriver.ExecuteRequestAndReadIntoString(); SharedSteps.RegenerateApiExpectedData(actualResult); var expectedResults = ExternalFileServer.ReadFileAsString(SharedSteps.GenerateExpectedFilePath()); //ServiceDriver.Assertions_CompareStringMessages(expectedResults, actualResult); ServiceDriver.Assertions_CompareJsonMessages(expectedResults, actualResult); }