public TestScreenshot() { var now = DateTime.Now; Name = LocationsProvider.GetScreenshotFileName(now); Date = now; }
public static void Save(this TestRun testRun, string path) { path.Create(); var fullPath = Path.Combine(path, LocationsProvider.GetTestRunFileName(testRun.TestInfo.Finish)); using (var file = File.CreateText(fullPath)) { var serializer = new JsonSerializer(); serializer.Serialize(file, testRun); } }
public static ItemInfo MapTestRunInfo(this ItemInfoDto itemInfoDto) { var run = new ItemInfo { Guid = itemInfoDto.Guid, Start = itemInfoDto.Start, Finish = itemInfoDto.Finish, FileName = LocationsProvider.GetTestRunFileName(itemInfoDto.Finish) }; return(run); }
public static void Save(this Run run, string path) { var fileName = LocationsProvider.GetRunFileName(run.RunInfo.Guid); run.RunInfo.FileName = fileName; path.Create(); var fullRunPath = Path.Combine(path, fileName); using (var file = File.CreateText(fullRunPath)) { var serializer = new JsonSerializer(); serializer.Serialize(file, run); } }
public static Run Map(this RunDto runDto) { var run = new Run { TestRunFiles = runDto.TestsInfo.Select( ti => Path.Combine(ti.Guid.ToString(), LocationsProvider.GetTestRunFileName(ti.Finish))).ToList(), Name = runDto.Name, RunInfo = runDto.RunInfo.MapRunInfo(), RunSummary = runDto.RunSummary.Map(), Sprint = runDto.Sprint }; return(run); }
public void SaveScreenshot(TestScreenshotDto testScreenshot) { using (var image = Image.FromStream(new MemoryStream(testScreenshot.Data))) { var screenPath = _locationsProvider.GetScreenshotPath(testScreenshot.TestGuid.ToString()); screenPath.Create(); var screenName = LocationsProvider.GetScreenshotFileName(testScreenshot.Date); var file = Path.Combine(screenPath, screenName); var screen = new Bitmap(image); screen.Save(file, ImageFormat.Png); var fileInfo = new FileInfo(file); fileInfo.Refresh(); fileInfo.CreationTime = testScreenshot.Date; } }
public static TestRun Map(this TestRunDto testRunDto) { var testRun = new TestRun { Categories = testRunDto.Categories, Description = testRunDto.Description, Events = testRunDto.Events.Select(teDto => new TestEvent { Started = teDto.Started, Finished = teDto.Finished, Name = teDto.Name }).ToList(), FullName = testRunDto.FullName, Name = testRunDto.Name, Output = testRunDto.Output, Priority = testRunDto.Priority, Result = testRunDto.Result, RunGuid = testRunDto.RunGuid, Screenshots = testRunDto.Screenshots.Select(sDto => new TestScreenshot { Date = sDto.Date, Name = LocationsProvider.GetScreenshotFileName(sDto.Date) }).ToList(), TestInfo = testRunDto.TestInfo.MapTestRunInfo(), TestDuration = (testRunDto.TestInfo.Finish - testRunDto.TestInfo.Start).TotalSeconds, TestMessage = testRunDto.TestMessage, TestStackTrace = testRunDto.TestStackTrace, TestType = testRunDto.TestType, TestData = testRunDto.TestData.Select(tdDto => new TestData { Actual = tdDto.Actual, Expected = tdDto.Expected, Comment = tdDto.Comment, Date = tdDto.Date }).ToList() }; return(testRun); }
public TestScreenshot(DateTime date) { Name = LocationsProvider.GetScreenshotFileName(date); Date = date; }
public void Initialize(ReporterSettings settings) { _locationsProvider = new LocationsProvider(settings.OutputPath); ReporterSettings = settings; }