public void ShouldCreateXmlFile() { // Arrange var testCaseExecution = new TestCaseExecution(); testCaseExecution.Name = "TestCase01"; testCaseExecution.Ended = DateTime.Now.AddDays(1); testCaseExecution.Started = DateTime.Now; testCaseExecution.Status = ExecutionStatus.Failed; testCaseExecution.Steps = new TestStepCollection() { new LoadAssemblyStep(), new SetClassStep(), new FormattingStep(), new ExecuteMethodStep(), new ExecuteMethodStep(), new FormattingStep(), new ExecuteMethodStep() }; var xml = testCaseExecution.ToXml(); // Act testCaseRepository.AddExecution("testCaseName", testCaseExecution); // Assert Mock.Get(fileSystemRepository) .Verify(r => r.CreateFile("Root\\testCaseName\\Executions\\TestCase01.xml", xml), Times.Once()); }
private TestCaseExecution NewExecution(DateTime created) { var result = new TestCaseExecution(); result.CreatedDateTime = created; return(result); }
public void Test_ShouldMapExecutionFile() { // Arrange var dummy = new TestCaseExecution(); dummy.Started = DateTime.Now.AddDays(-1); dummy.Ended = DateTime.Now; var xml = dummy.ToXml(); var file = NewFile("file1.xml", xml, DateTime.Now.AddDays(-2)); var files = new File[] { file }; Mock.Get(fileSystemRepository) .Setup(r => r.FetchAllFiles("Root\\TestCase01\\Executions")) .Returns(files); // Act var testCase = testCaseRepository.Get("TestCase01"); var execution = testCase.Executions.First(); // Assert execution.Name.ShouldEqual("file1"); execution.Started.ShouldEqual(dummy.Started); execution.Ended.ShouldEqual(dummy.Ended); execution.CreatedDateTime.ShouldEqual(file.CreatedDateTime); }
public void AddExecution(string testCaseName, TestCaseExecution execution) { var filePath = Path.Combine(this.path, testCaseName, "Executions", execution.Name + ".xml"); var file = fileSystemRepository.CreateFile(filePath, execution.ToXml()); execution.CreatedDateTime = file.CreatedDateTime; }
public TestCaseResultViewModel(TestCaseExecution result) { this.result = result; this.Name = result.Name; this.CreatedDateTime = result.CreatedDateTime; this.Error = result.Error; this.Started = result.Started; this.Ended = result.Ended; this.Duration = (this.Ended ?? DateTime.Now) - this.Started; this.Status = result.Status; }
public void Test_ShouldStillCreateInstance_OnErrorParsingXml() { // Arrange var xml = "<invalid xml></format>"; // Act var instance = TestCaseExecution.FromXml(xml); // Assert instance.ShouldNotBeNull(); instance.Error.ShouldNotBeNull(); }
public void ShouldSetCreatedDateTime() { // Arrange createdFile.CreatedDateTime = DateTime.Now; var testCaseExecution = new TestCaseExecution(); testCaseExecution.Name = "TestCaseExecution01"; // Act testCaseRepository.AddExecution("testCaseName", testCaseExecution); // Assert testCaseExecution.CreatedDateTime.ShouldEqual(createdFile.CreatedDateTime); }
public void Run(TestCaseExecution testCaseExecution) { hasError = false; using (testEngine = new TestEngineProxy()) { testCaseExecution.Started = DateTime.Now; testCaseExecution.Status = ExecutionStatus.InProgress; testCaseExecution.Steps.Accept(this); testCaseExecution.Status = hasError ? ExecutionStatus.Failed : ExecutionStatus.Passed; testCaseExecution.Ended = DateTime.Now; } }
private IEnumerable <TestCaseExecution> GetTestCaseExecutions(string testCaseName) { var result = new List <TestCaseExecution>(); var executionsPath = Path.Combine(this.path, testCaseName, "Executions"); var executionFiles = this.fileSystemRepository.FetchAllFiles(executionsPath); foreach (var execution in executionFiles) { var tce = TestCaseExecution.FromXml(execution.Contents); tce.CreatedDateTime = execution.CreatedDateTime; tce.Name = Path.GetFileNameWithoutExtension(execution.Name); result.Add(tce); } return(result); }
public void ShouldSortByCreatedDateTime() { // Arrange var execution1 = NewExecution(created: DateTime.Today.AddDays(-3)); var execution2 = NewExecution(created: DateTime.Today.AddDays(-2)); var execution3 = NewExecution(created: DateTime.Today.AddDays(-1)); var executions = new TestCaseExecution[] { execution1, execution2, execution3 }; // Act testCase.Executions = executions; // Assert var result = testCase.Executions.ToList(); result[0].ShouldEqual(execution3); result[1].ShouldEqual(execution2); result[2].ShouldEqual(execution1); }
public void UpdateExecution(string testCaseName, TestCaseExecution execution) { var filePath = Path.Combine(this.path, testCaseName, "Executions", execution.Name + ".xml"); var file = fileSystemRepository.UpdateFile(filePath, execution.ToXml()); }