public void AppendCopyOfTestCaseSampleProjectTest() { TestCasesRoot tcr = new TestCasesRoot(); tcr.CreateSampleProject(); TestUtils.CheckTestCasesAndConditionsAndActions(tcr); int testCasesCount = tcr.TestCases.Count; for (int tcIdx = 0; tcIdx < testCasesCount; tcIdx++) { TestCase newTestCase = tcr.InsertTestCase(); TestCase templateTestCase = tcr.TestCases[tcIdx]; tcr.CopyTestCaseSettings(templateTestCase, newTestCase); } // create and save the sample project string savePath = Path.Combine(TestSupport.CreatedFilesDirectory, "SimpleProject.dtc"); tcr.Save(savePath); ProcessStartInfo info = new ProcessStartInfo(@"C:\Program Files (x86)\Notepad++\notepad++.exe", savePath); Process.Start(info); for (int tcIdx = 0; tcIdx < testCasesCount; tcIdx++) { CompareTestCases(tcr, tcIdx, tcIdx + testCasesCount); } }
public void LoadOldProjectFiles(int idx, string fileName) { string loadPath = Path.Combine(TestSupport.TestFilesDirectory, fileName); string savePath = Path.Combine(TestSupport.CreatedFilesDirectory, fileName); TestCasesRoot root = new TestCasesRoot(); root.Load(loadPath); root.Save(savePath); // only to view the diffrence TestSupport.CompareFile(TestSupport.CreatedFilesDirectory, TestSupport.TestFilesDirectory, Path.GetFileName(savePath)); Assert.That(TestSupport.CompareFile(TestSupport.CreatedFilesDirectory, TestSupport.ReferenceFilesDirectory, Path.GetFileName(savePath))); //ProcessStartInfo info = new ProcessStartInfo(@"C:\Program Files (x86)\Notepad++\notepad++.exe", savePath); //Process.Start(info); }
public void Save100() { string savePath = Path.Combine(TestSupport.CreatedFilesDirectory, "Save.dtc"); TestCasesRoot root = TestCasesRoot.CreateSimpleTable(); root.Save(savePath); root.New(); root.Load(savePath); Assert.That(TestSupport.CompareFile(TestSupport.CreatedFilesDirectory, TestSupport.ReferenceFilesDirectory, Path.GetFileName(savePath))); //ProcessStartInfo info = new ProcessStartInfo(@"C:\Program Files (x86)\Notepad++\notepad++.exe", savePath); //Process.Start(info); }
public void ClearAllFieldsOnNewTest() { TestCasesRoot testCasesRoot = new TestCasesRoot(); testCasesRoot.CreateSampleProject(); // create and save the sample project string savePath = Path.Combine(TestSupport.CreatedFilesDirectory, "SampleProject.dtc"); testCasesRoot.Save(savePath); //ProcessStartInfo info = new ProcessStartInfo(@"C:\Program Files (x86)\Notepad++\notepad++.exe", savePath); //Process.Start(info); testCasesRoot.New(); savePath = Path.Combine(TestSupport.CreatedFilesDirectory, "EmptyProject.dtc"); testCasesRoot.Save(savePath); //ProcessStartInfo info = new ProcessStartInfo(@"C:\Program Files (x86)\Notepad++\notepad++.exe", savePath); //Process.Start(info); Assert.That(testCasesRoot.Description == String.Empty); Assert.That(testCasesRoot.Actions != null && testCasesRoot.Actions.Count == 0); Assert.That(testCasesRoot.Conditions != null && testCasesRoot.Conditions.Count == 0); Assert.That(testCasesRoot.TestCases != null && testCasesRoot.TestCases.Count == 0); }
public void SaveTestCaseDescription() { string savePath = Path.Combine(TestSupport.CreatedFilesDirectory, "Save.dtc"); TestCasesRoot root = TestCasesRoot.CreateSimpleTable(); root.TestCases[0].Description = "test description"; Assert.True(root.TestCases[1].Description == ""); root.Save(savePath); root.New(); root.Load(savePath); Assert.True(root.TestCases[0].Description == "test description"); Assert.True(root.TestCases[1].Description == ""); }
public void CreateMissingTestCases(int idx, string fileName, int expectedTestCasesCount) { string testOutput = Path.Combine(TestSupport.CreatedFilesDirectory, fileName + ".Output.txt"); string source = Path.Combine(TestSupport.TestFilesDirectory, fileName); string target = Path.Combine(TestSupport.CreatedFilesDirectory, fileName); TestCasesRoot tcr = new TestCasesRoot(); tcr.Load(source); StringBuilder sb = new StringBuilder(); foreach (TestCase tc in tcr.TestCases) { DumpTestCase(sb, tc); sb.AppendLine(); } tcr.CalculateMissingTestCases(); sb.AppendLine("After calculation"); foreach (TestCase tc in tcr.TestCases) { DumpTestCase(sb, tc); sb.AppendLine(); } File.WriteAllText(testOutput, sb.ToString()); ProcessStartInfo info = new ProcessStartInfo(@"C:\Program Files (x86)\Notepad++\notepad++.exe", testOutput); //Process.Start(info); tcr.Save(target); var statistics = tcr.CalculateStatistics(); if (tcr.TestCases.Count > 0) { Assert.IsTrue(statistics.Coverage >= 99.9); } Assert.IsTrue(tcr.TestCases.Count == expectedTestCasesCount); TestUtils.CheckTestCasesAndConditionsAndActions(tcr); }