public void Conversion() { UITestNode test1 = testSuite; Assert.AreEqual("MyTestSuite", test1.Name); Assert.AreEqual("MyTestSuite", test1.FullName); Assert.IsTrue(test1.ShouldRun, "ShouldRun"); Assert.IsTrue(test1.IsSuite, "IsSuite"); Assert.IsFalse(test1.IsTestCase, "!IsTestCase"); Assert.IsFalse(test1.IsFixture, "!IsFixture"); Assert.AreEqual(MockTestFixture.Tests, test1.CountTestCases()); UITestNode test2 = testFixture; Assert.AreEqual("MockTestFixture", test2.Name); Assert.AreEqual("NUnit.Tests.Assemblies.MockTestFixture", test2.FullName); Assert.IsTrue(test2.ShouldRun, "ShouldRun"); Assert.IsTrue(test2.IsSuite, "IsSuite"); Assert.IsFalse(test2.IsTestCase, "!IsTestCase"); Assert.IsTrue(test2.IsFixture, "IsFixture"); Assert.AreEqual(MockTestFixture.Tests, test2.CountTestCases()); UITestNode test3 = testCase1; Assert.AreEqual("MockTest1", test3.Name); Assert.AreEqual("NUnit.Tests.Assemblies.MockTestFixture.MockTest1", test3.FullName); Assert.IsTrue(test3.ShouldRun, "ShouldRun"); Assert.IsFalse(test3.IsSuite, "!IsSuite"); Assert.IsTrue(test3.IsTestCase, "IsTestCase"); Assert.IsFalse(test3.IsFixture, "!IsFixture"); Assert.AreEqual(1, test3.CountTestCases()); }
public void ServerTimeoutTest() { // Delay after loading the test Thread.Sleep(timeout); // Copy all the tests from the remote domain // to verify that Test object is connected. UITestNode node = new UITestNode(test, true); // Run the tests, which also verifies that // RemoteTestRunner has not been disconnected TestResult result = domain.Run(NullListener.NULL); // Delay again to let the results "ripen" Thread.Sleep(timeout); // Visit the results of the test after another delay ResultSummarizer summarizer = new ResultSummarizer(result); Assert.AreEqual(5, summarizer.ResultCount); Assert.AreEqual(2, summarizer.TestsNotRun); // Make sure we can still access the tests // using the Test property of the result node = new UITestNode(result.Test, true); }
public void UpdateUsingWrongTest() { TestSuiteTreeNode node = new TestSuiteTreeNode(suiteInfo); UITestNode suiteInfo2 = new UITestNode(new TestSuite("NotMyTestSuite")); node.UpdateTest(suiteInfo2); }
public void PopulateTests() { UITestNode test1 = new UITestNode(testSuite); Assert.IsFalse(test1.Populated, "Default should be to not populate"); test1.PopulateTests(); Assert.IsTrue(test1.Populated, "Should be populated after call"); UITestNode test1Child = test1.Tests[0] as UITestNode; Assert.IsTrue(test1Child.Populated, "Child should be populated"); UITestNode test2 = new UITestNode(testSuite, true); Assert.IsTrue(test2.Populated, "Should be populated initialy"); UITestNode test2Child = test2.Tests[0] as UITestNode; Assert.IsTrue(test2Child.Populated, "Child should be populated"); UITestNode test3 = new UITestNode(testSuite); int count = test3.CountTestCases(); Assert.IsTrue(test3.Populated, "CountTestCases should populate"); UITestNode test4 = new UITestNode(testSuite); UITestNode test4Child = test4.Tests[0] as UITestNode; Assert.IsTrue(test4.Populated, "Accessing Tests should populate"); UITestNode test5 = new UITestNode(testSuite); bool fixture = test5.IsFixture; Assert.IsTrue(test5.Populated, "IsFixture should populate"); }
public void Construction() { UITestNode test1 = new UITestNode(testSuite); Assert.AreEqual("MyTestSuite", test1.Name); Assert.AreEqual("MyTestSuite", test1.FullName); Assert.IsTrue(test1.ShouldRun, "ShouldRun"); Assert.IsTrue(test1.IsSuite, "IsSuite"); Assert.IsFalse(test1.IsTestCase, "!IsTestCase"); Assert.IsFalse(test1.IsFixture, "!IsFixture"); Assert.AreEqual(MockTestFixture.Tests, test1.CountTestCases()); UITestNode test2 = new UITestNode(testFixture, true); Assert.AreEqual("MockTestFixture", test2.Name); Assert.AreEqual("NUnit.Tests.Assemblies.MockTestFixture", test2.FullName); Assert.IsTrue(test2.ShouldRun, "ShouldRun"); Assert.IsTrue(test2.IsSuite, "IsSuite"); Assert.IsFalse(test2.IsTestCase, "!IsTestCase"); Assert.IsTrue(test2.IsFixture, "IsFixture"); Assert.AreEqual(MockTestFixture.Tests, test2.CountTestCases()); Assert.IsNotNull(test2.Categories, "Categories should not be null"); Assert.AreEqual(1, test2.Categories.Count); Assert.AreEqual("FixtureCategory", (string)test2.Categories[0]); UITestNode test3 = new UITestNode(testCase1); Assert.AreEqual("MockTest1", test3.Name); Assert.AreEqual("NUnit.Tests.Assemblies.MockTestFixture.MockTest1", test3.FullName); Assert.IsTrue(test3.ShouldRun, "ShouldRun"); Assert.IsFalse(test3.IsSuite, "!IsSuite"); Assert.IsTrue(test3.IsTestCase, "IsTestCase"); Assert.IsFalse(test3.IsFixture, "!IsFixture"); Assert.AreEqual(1, test3.CountTestCases()); }
public UITestNode[] GetCheckedTests(SelectionFlags flags) { int count = 0; foreach (CheckedTestInfo info in checkedTests) { if (isSelected(info, flags)) { count++; } } UITestNode[] result = new UITestNode[count]; int index = 0; foreach (CheckedTestInfo info in checkedTests) { if (isSelected(info, flags)) { result[index++] = info.Test; } } return(result); }
private void tests_SelectedTestChanged(UITestNode test) { if (SelectedTestsChanged != null) { SelectedTestsChangedEventArgs args = new SelectedTestsChangedEventArgs(test.Name, test.CountTestCases()); SelectedTestsChanged(tests, args); } }
public void UpdateTest(UITestNode test) { if (Test.FullName != test.FullName) { throw(new ArgumentException("Attempting to update node with an entirely different test")); } this.test = test; }
private void OnTestChanged(object sender, TestEventArgs e) { UITestNode test = e.Test; Invoke(new LoadHandler(Reload), new object[] { test }); if (ClearResultsOnChange) { ClearResults(); } }
/// <summary> /// Reload the tree with a changed test hierarchy /// while maintaining as much gui state as possible /// </summary> /// <param name="test">Test suite to be loaded</param> public void Reload(UITestNode test) { TestSuiteTreeNode rootNode = (TestSuiteTreeNode)Nodes[0]; // Temporary change till framework is updated // if ( !Match( rootNode, test ) ) // throw( new ArgumentException( "Reload called with non-matching test" ) ); UpdateNode(rootNode, test); }
public void SetUp() { MockTestFixture mock = new MockTestFixture(); testSuite = new TestSuite("MyTestSuite"); testSuite.Add(mock); suiteInfo = new UITestNode(testSuite); testFixture = (TestSuite)testSuite.Tests[0]; fixtureInfo = new UITestNode(testFixture); testCase = (NUnit.Core.TestCase)testFixture.Tests[0]; testCaseInfo = new UITestNode(testCase); }
public void UpdateTest() { TestSuiteTreeNode node; node = new TestSuiteTreeNode(suiteInfo); UITestNode suiteInfo2 = new UITestNode(new TestSuite("MyTestSuite")); node.UpdateTest(suiteInfo2); Assert.AreEqual("MyTestSuite", node.Test.FullName); Assert.AreEqual(0, node.Test.CountTestCases()); node.UpdateTest(suiteInfo); Assert.AreEqual("MyTestSuite", node.Test.FullName); Assert.AreEqual(MockTestFixture.Tests, node.Test.CountTestCases()); }
/// <summary> /// A node has been matched with a test, so update it /// and then process child nodes and tests recursively. /// If a child was added or removed, then this node /// will expand itself. /// </summary> /// <param name="node">Node to be updated</param> /// <param name="test">Test to plug into node</param> /// <returns>True if a child node was added or deleted</returns> private bool UpdateNode(TestSuiteTreeNode node, UITestNode test) { node.UpdateTest(test); if (!test.IsSuite) { return(false); } bool showChildren = UpdateNodes(node.Nodes, test.Tests); if (showChildren) { node.Expand(); } return(showChildren); }
/// <summary> /// Load the tree with a test hierarchy /// </summary> /// <param name="test">Test to be loaded</param> public void Load(UITestNode test) { using (new CP.Windows.Forms.WaitCursor()) { Clear(); BeginUpdate(); try { AddTreeNodes(Nodes, test, false); SetInitialExpansion(); } finally { EndUpdate(); contextNode = null; } } }
/// <summary> /// Construct a TestNode given a TestResult /// </summary> public TestSuiteTreeNode(TestResult result) : base(result.Test.Name) { this.test = new UITestNode(result.Test); this.result = result; UpdateImageIndex(); }
/// <summary> /// Construct a TestNode given a test /// </summary> public TestSuiteTreeNode(ITest test) : base(test.Name) { this.test = new UITestNode(test); UpdateImageIndex(); }
/// <summary> /// Helper routine that compares a node with a test /// </summary> /// <param name="node">Node to compare</param> /// <param name="test">Test to compare</param> /// <returns>True if the test has the same name</returns> private bool Match(TestSuiteTreeNode node, UITestNode test) { return(node.Test.FullName == test.FullName); }
private void RunTest(UITestNode test) { RunTests(new UITestNode[] { test }); }
public void ShowPropertiesDialog(UITestNode test) { ShowPropertiesDialog(this[test]); }
public CheckedTestInfo(UITestNode test, bool topLevel) { this.Test = test; this.TopLevel = topLevel; }