/// <summary> /// initializes new instance with the testPriority and testType /// </summary> public AutomationTest(AutomationTest originalTest, TestPriorities testPriority, TestTypes testType) { this.TestCaseAttribute = originalTest.TestCaseAttribute; this.Method = originalTest.Method; this._testPriority = testPriority; this._testType = testType; }
/// <summary> /// This method add test to list of all test. /// </summary> internal void AddTest(AutomationTest test, AutomationElement automationElement) { //creare ListView item for the test ListViewItem item = new ListViewItem(); item.Text = GetTestName(test); item.SubItems.Add(GetAutomationElementName(automationElement)); item.SubItems.Add(GetTestResultName(TestResults.ReadyToRun)); item.ImageIndex = GetImageIndexForStatus(TestResults.ReadyToRun); this._testListView.Items.Add(item); //ad it to the collection of all tests this._testList.Add(new object[] { test, automationElement, item }); }
public override bool Fit(AutomationTest test) { return true; }
/// <summary> /// Method which return TRUE if test fits this filter. Otherwise FALSE. /// </summary> public abstract bool Fit(AutomationTest test);
public override bool Fit(AutomationTest test) { return test.IsPatternTestForSupportedPatterns(this._patternName); }
public override bool Fit(AutomationTest test) { return test.IsControlTestForControlType(this._controlTypeName); }
public override bool Fit(AutomationTest test) { return (test.Type & this._testType) == this._testType; }
/// <summary> /// returns name for the test /// </summary> private string GetTestName(AutomationTest test) { return(test.Name); }
/// <summary> /// returns test suite for the test /// </summary> private string GetTestSuite(AutomationTest test) { return test.Method.ReflectedType.FullName; }
/// <summary> /// returns name for the test /// </summary> private string GetTestName(AutomationTest test) { return test.Name; }
/// <summary> /// this method performs automation test on automation element. /// </summary> public TestResults PerformTest(AutomationTest test, AutomationElement element) { try { bool result = false; switch (test.Type) { case TestTypes.AutomationElementTest: { if(!this._testChildren) result = TestRuns.RunAutomationElementTest(element, this._testEvents, GetTestName(test), false, null, true, GetFakeApplicationCommands()); else result = TestRuns.RunAutomationElementTests(element, this._testEvents, test.TestCaseAttribute.Priority, test.TestCaseAttribute.TestCaseType, this._testChildren, true, GetFakeApplicationCommands()); break; } case TestTypes.ControlTest: { if (!this._testChildren) result = TestRuns.RunControlTest(element, this._testEvents, GetTestSuite(test), GetTestName(test), null, GetFakeApplicationCommands()); else result = TestRuns.RunControlTests(element, this._testEvents, this._testChildren, test.TestCaseAttribute.Priority, test.TestCaseAttribute.TestCaseType, GetFakeApplicationCommands()); break; } case TestTypes.PatternTest: { if (!this._testChildren) result = TestRuns.RunPatternTest(element, this._testEvents, false, GetTestSuite(test), GetTestName(test), null, GetFakeApplicationCommands()); else result = TestRuns.RunPatternTests(element, this._testEvents, this._testChildren, GetTestSuite(test), test.TestCaseAttribute.TestCaseType, GetFakeApplicationCommands()); break; } //case TestTypes.ScenarioTest: // { // if (!this._testChildren) // result = TestRuns.RunScenarioTest(GetTestSuite(test), GetTestName(test), null, this._testEvents, GetFakeApplicationCommands()); // break; // } default: throw new ArgumentException("not supported test type! test.Type = " + test.Type.ToString() ); } return (result ? TestResults.Succeed : TestResults.Failed); } catch (Exception ex) { ApplicationLogger.LogException(ex); return TestResults.UnexpectedError; } }
/// <summary> /// create subtree for parentNode according to the testPriority, testType and testFilter /// </summary> private void CreateTestPrioritySubtree(TestPriorities testPriority, TestTypes testType, TreeNode parentNode, AutomationTestsFilter testFilter) { //create node for the priority TreeNode priorityNode = new TreeNode(GetPriorityName(testPriority)); parentNode.Nodes.Add(priorityNode); TreeNode currentRootNode = priorityNode; //create filter for the priority AndFilter priorityFilter = new AndFilter(new TestFilterPriority(testPriority), testFilter); //for all filtered available automation tests lets create tree node foreach (AutomationTest test in AutomationTestCollection.Filter(priorityFilter)) { //lets make copy ot the test with only TestType and TestPriority belonging to this //branch AutomationTest testClone = new AutomationTest(test, testPriority, testType); TreeNode testNode = new TreeNode(testClone.Name); testNode.Tag = testClone; currentRootNode.Nodes.Add(testNode); } //if no child currentTestTypeRootNode was added then remove priority currentTestTypeRootNode if (currentRootNode.Nodes.Count == 0) currentRootNode.Remove(); }
/// <summary> /// returns test suite for the test /// </summary> private string GetTestSuite(AutomationTest test) { return(test.Method.ReflectedType.FullName); }
public override bool Fit(AutomationTest test) { return _a.Fit(test) && _b.Fit(test); }
private string GetTestName(AutomationTest test) { return test.Method.ReflectedType.Name + "." + test.Name; }
public override bool Fit(AutomationTest test) { return (test.Priority & this._testPriority) == this._testPriority; }
/// <summary> /// this method performs automation test on automation element. /// </summary> public TestResults PerformTest(AutomationTest test, AutomationElement element) { try { bool result = false; switch (test.Type) { case TestTypes.AutomationElementTest: { if (!this._testChildren) { result = TestRuns.RunAutomationElementTest(element, this._testEvents, GetTestName(test), false, null, true, GetFakeApplicationCommands()); } else { result = TestRuns.RunAutomationElementTests(element, this._testEvents, test.TestCaseAttribute.Priority, test.TestCaseAttribute.TestCaseType, this._testChildren, true, GetFakeApplicationCommands()); } break; } case TestTypes.ControlTest: { if (!this._testChildren) { result = TestRuns.RunControlTest(element, this._testEvents, GetTestSuite(test), GetTestName(test), null, GetFakeApplicationCommands()); } else { result = TestRuns.RunControlTests(element, this._testEvents, this._testChildren, test.TestCaseAttribute.Priority, test.TestCaseAttribute.TestCaseType, GetFakeApplicationCommands()); } break; } case TestTypes.PatternTest: { if (!this._testChildren) { result = TestRuns.RunPatternTest(element, this._testEvents, false, GetTestSuite(test), GetTestName(test), null, GetFakeApplicationCommands()); } else { result = TestRuns.RunPatternTests(element, this._testEvents, this._testChildren, GetTestSuite(test), test.TestCaseAttribute.TestCaseType, GetFakeApplicationCommands()); } break; } //case TestTypes.ScenarioTest: // { // if (!this._testChildren) // result = TestRuns.RunScenarioTest(GetTestSuite(test), GetTestName(test), null, this._testEvents, GetFakeApplicationCommands()); // break; // } default: throw new ArgumentException("not supported test type! test.Type = " + test.Type.ToString()); } return(result ? TestResults.Succeed : TestResults.Failed); } catch (Exception ex) { ApplicationLogger.LogException(ex); return(TestResults.UnexpectedError); } }