public TestProcessor(TestProcessor originalTestProcessor)
 {
     _testAutomationDefinition = new TestAutomationDefinition(originalTestProcessor._testAutomationDefinition);
     _parentID     = originalTestProcessor._parentID;
     _status       = originalTestProcessor._status;
     _ignoreResult = originalTestProcessor._ignoreResult;
 }
Пример #2
0
        internal void Read(TestCase parent, XPathNavigator nav)
        {
            _parentID = parent.SystemID;

            // Start parsing
            Enum.TryParse(nav.GetAttribute("status", ""), out _status);
            Enum.TryParse(nav.GetAttribute("testType", ""), out _testType);
            _systemId = new Guid(TestUtils.GetXPathValue(nav, "SystemID"));
            _userId   = TestUtils.GetXPathValue(nav, "UserID");
            _title    = TestUtils.GetXPathValue(nav, "Title");
            Enum.TryParse(TestUtils.GetXPathValue(nav, "ExpectedTestVerdict"), out _expectedTestVerdict);
            bool.TryParse(TestUtils.GetXPathValue(nav, "AlwaysExecute"), out _alwaysExecute);

            var dependsOn = TestUtils.GetXPathValue(nav, "DependsOn");

            _dependsOn = string.IsNullOrEmpty(dependsOn) ? null : new Guid(dependsOn) as Guid?;

            //_dependsOn = new Guid(TestUtils.GetXPathValue(nav, "DependsOn"));
            int.TryParse(TestUtils.GetXPathValue(nav, "Iterations"), out _iterations);
            _description       = TestUtils.GetXPathValue(nav, "Description");
            _expectedBehaviour = TestUtils.GetXPathValue(nav, "ExpectedBehaviour");

            // Get test automation definition
            XPathNodeIterator iterator = nav.Select("TestAutomationDefinition");

            iterator.MoveNext();
            _testAutomationDefinition = new TestAutomationDefinition(iterator.Current);
        }
Пример #3
0
        internal TestStepResult Execute(Dictionary <int, TestClassBase> testClassDictionary)
        {
            TestAssert.IsNotNull(TestAutomationDefinition,
                                 "The test step is marked as active, however its automation definition has not been set.");

            string currentUser = Thread.CurrentThread.Name;

            TestStepResult result = new TestStepResult();

            result.SetReferenceID(SystemID);
            result.SetVirtualUser(currentUser);
            result.SetTestVerdict(TestVerdict.Pass);

            FireExecutionBeginEvent(this, new TestStepBeginExecutionArgs(currentUser));

            TestAutomationDefinition.ResultStruct resultStruct = TestAutomationDefinition.Invoke(testClassDictionary);

            result.SetStartTime(resultStruct.StartTime);
            result.SetEndTime(resultStruct.EndTime);
            result.SetTestVerdict(determineVerdict(ExpectedTestVerdict, resultStruct.TestVerdict));
            result.SetTestMessage(resultStruct.TestMessage);
            result.SetTestChecks(resultStruct.TestChecks);
            result.SetTestWarnings(resultStruct.TestWarnings);
            result.SetTestData(resultStruct.TestData);

            FireExecutionCompleteEvent(this, result);

            return(result);
        }
Пример #4
0
 public TestStep(TestStep originalTestStep, TestCase parentTestCase)
     : base(originalTestStep, parentTestCase)
 {
     this._expectedBehaviour        = originalTestStep._expectedBehaviour;
     this._testType                 = originalTestStep._testType;
     this._expectedTestVerdict      = originalTestStep._expectedTestVerdict;
     this._alwaysExecute            = originalTestStep._alwaysExecute;
     this._iterations               = originalTestStep._iterations;
     this._testAutomationDefinition = new TestAutomationDefinition(originalTestStep.TestAutomationDefinition);
 }
        public TestProcessor(TestSuite parent)
            : this()
        {
            _parentID = parent.SystemID;

            _status       = Status.Incomplete;
            _ignoreResult = false;

            _testAutomationDefinition = new Core.TestAutomationDefinition();
        }
Пример #6
0
 public TestStep(string title, TestCase parent)
     : base(title, parent)
 {
     _testAutomationDefinition = new Core.TestAutomationDefinition();
     _testType            = Core.TestType.Manual;
     _expectedTestVerdict = TestVerdict.Pass;
     _alwaysExecute       = false;
     _status     = Core.Status.Incomplete;
     _iterations = 1;
     TestScriptObject.OnPrepareToSave += TestScriptObject_OnPrepareToSave;
 }
Пример #7
0
        public TestAutomationDefinition(TestAutomationDefinition originalTestAutomationDefinition)
            : this()
        {
            this._testAssembly = TestUtils.SafeCopyString(originalTestAutomationDefinition._testAssembly);
            this._testClass    = TestUtils.SafeCopyString(originalTestAutomationDefinition._testClass);
            this._testMethod   = TestUtils.SafeCopyString(originalTestAutomationDefinition._testMethod);

            foreach (TestParameter parameter in originalTestAutomationDefinition._testParameters)
            {
                _testParameters.Add(new TestParameter(parameter));
            }
        }
        public TestProcessor(TestSuite parent, XPathNavigator navigator)
        {
            _parentID = parent.SystemID;

            _systemId = new Guid(TestUtils.GetXPathValue(navigator, "SystemID"));
            _title    = TestUtils.GetXPathValue(navigator, "Title");

            _description = TestUtils.GetXPathValue(navigator, "Description");
            Enum.TryParse(TestUtils.GetXPathValue(navigator, "Status"), out _status);
            bool.TryParse(TestUtils.GetXPathValue(navigator, "IgnoreResult"), out _ignoreResult);
            Enum.TryParse(TestUtils.GetXPathValue(navigator, "TestType"), out _testType);

            XPathNodeIterator iterator = navigator.Select("TestAutomationDefinition");

            iterator.MoveNext();
            _testAutomationDefinition = new TestAutomationDefinition(iterator.Current);
        }
Пример #9
0
        private bool areParamsEqual(TestAutomationDefinition target)
        {
            bool isEqual = true;

            if (this._testParameters.Count == target._testParameters.Count)
            {
                for (int i = 0; i < this._testParameters.Count; i++)
                {
                    if (!this._testParameters[i].DisplayName.ToUpper().Equals(target._testParameters[i].DisplayName.ToUpper()) ||
                        !this._testParameters[i].TypeAsString.ToUpper().Equals(target._testParameters[i].TypeAsString.ToUpper()) ||
                        !this._testParameters[i].ValueAsString.ToUpper().Equals(target._testParameters[i].ValueAsString.ToUpper()))
                    {
                        isEqual = false;
                    }
                }
            }

            return(isEqual);
        }
Пример #10
0
        /// <summary>
        /// Displays test parameters dialog for edit from properties window.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            PropertyGrid             grid       = provider.GetType().GetProperty("OwnerGrid").GetGetMethod().Invoke(provider, null) as PropertyGrid;
            TestSuite                testSuite  = grid.SelectedObject as TestSuite;
            TestAutomationDefinition definition = null;

            if (context.Instance is TestPreprocessor)
            {
                TestScriptObjectEditorDialog dlg = new TestScriptObjectEditorDialog(null, testSuite.TestPreprocessor);
                DialogResult result = dlg.ShowDialog();
                definition = testSuite.TestPreprocessor.TestAutomationDefinition;
            }
            else if (context.Instance is TestPostprocessor)
            {
                TestScriptObjectEditorDialog dlg = new TestScriptObjectEditorDialog(null, testSuite.TestPostprocessor);
                DialogResult result = dlg.ShowDialog();
                definition = testSuite.TestPostprocessor.TestAutomationDefinition;
            }

            return(definition);
        }
Пример #11
0
        internal void Write(XmlTextWriter xmlWriter)
        {
            // Setup up test element container.
            xmlWriter.WriteStartElement("TestScriptObject");
            xmlWriter.WriteAttributeString("type", "TestStep");
            xmlWriter.WriteAttributeString("status", _status.ToString());
            xmlWriter.WriteAttributeString("testType", _testType.ToString());

            // Suite header information.
            xmlWriter.WriteElementString("SystemID", _systemId.ToString());
            //xmlWriter.WriteElementString("ParentID", _parentId.ToString());
            xmlWriter.WriteElementString("UserID", _userId);
            xmlWriter.WriteElementString("Title", "", _title);

            // Write automated test expected results (Pass/Fail)
            xmlWriter.WriteElementString("ExpectedTestVerdict", _expectedTestVerdict.ToString());
            xmlWriter.WriteElementString("AlwaysExecute", _alwaysExecute.ToString());
            xmlWriter.WriteElementString("DependsOn", _dependsOn.ToString());

            // Currently unused
            xmlWriter.WriteElementString("Iterations", _iterations.ToString());

            // Write description
            xmlWriter.WriteStartElement("Description");
            xmlWriter.WriteCData(Description);
            xmlWriter.WriteEndElement();

            // Write expected
            xmlWriter.WriteStartElement("ExpectedBehaviour");
            xmlWriter.WriteCData(_expectedBehaviour);
            xmlWriter.WriteEndElement();

            // Write automation definition.
            TestAutomationDefinition.Write(xmlWriter);

            xmlWriter.WriteEndElement();  // TestScriptObject
        }