Exemplo n.º 1
0
        public void PopulateTestSuitePropertiesList()
        {
            ClearPropertyFromList(ActSoapUiInputValue.ePropertyType.TestSuite);

            if (TestSuiteComboBox.SelectedValue == null)
            {
                return;
            }
            string testSuite = TestSuiteComboBox.SelectedValue.ToString();

            XmlDocument doc           = new XmlDocument();
            string      XMLFiledValue = mAct.GetInputParamCalculatedValue(ActSoapUI.Fields.XMLFile);

            if (!XMLFiledValue.Equals(string.Empty))
            {
                if (XMLFiledValue.Substring(0, 1).Equals("~"))
                {
                    string SolutionFolder = mAct.SolutionFolder;
                    XMLFiledValue = System.IO.Path.Combine(SolutionFolder, XMLFiledValue.Substring(2));
                }
                if (!System.IO.File.Exists(XMLFiledValue))
                {
                    Reporter.ToUser(eUserMsgKey.FileNotExist);
                    return;
                }
                doc.Load(XMLFiledValue);
                XmlNamespaceManager manager    = XMLDocExtended.GetAllNamespaces(doc);
                XmlNodeList         properties = doc.SelectNodes("//*[local-name()='soapui-project']/*[local-name()='testSuite'][@name='" + testSuite + "']/*[local-name()='properties']/*[local-name()='property']", manager);

                PopulatePropertiesGrid(properties, ActSoapUiInputValue.ePropertyType.TestSuite);
            }
        }
Exemplo n.º 2
0
        public void Init(eUserType UserType)
        {
            XmlDocument doc = new XmlDocument();
            string      ConfigFileSourcePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\UserTypeConfiguration.XML";

            // for unit test we might not have this file
            if (System.IO.File.Exists(ConfigFileSourcePath))
            {
                doc.Load(ConfigFileSourcePath);
                XmlNamespaceManager manager = XMLDocExtended.GetAllNamespaces(doc);
                IsSupportAutomate      = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='Automate']", manager).Attributes["Enable"].Value);
                IsSupportExecution     = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='Execution']", manager).Attributes["Enable"].Value);
                IsSupportReports       = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='Reports']", manager).Attributes["Enable"].Value);
                IsSupportSourceControl = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='SourceControl']", manager).Attributes["Enable"].Value);
                IsSupportALM           = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='ALM']", manager).Attributes["Enable"].Value);
                IsSupportSupport       = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='Support']", manager).Attributes["Enable"].Value);
                IsSupportAnalyzer      = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='Analyzer']", manager).Attributes["Enable"].Value);
            }
            else
            {
                IsSupportAutomate      = true;
                IsSupportExecution     =
                    IsSupportReports   = true;
                IsSupportSourceControl = true;
                IsSupportALM           = true;
                IsSupportSupport       = true;
                IsSupportAnalyzer      = true;
            }
        }
Exemplo n.º 3
0
        private void FillSuiteComboBox()
        {
            TestSuiteComboBox.Items.Clear();
            TestSuiteComboBox.Items.Add(string.Empty);
            XmlDocument doc = new XmlDocument();

            ProcessInputForDriver();

            string XMLFiledValue = mAct.GetInputParamCalculatedValue(ActSoapUI.Fields.XMLFile);

            if (!XMLFiledValue.Equals(string.Empty))
            {
                if (XMLFiledValue.ToUpper().Substring(XMLFiledValue.Length - 4).Equals(".XML"))
                {
                    if (XMLFiledValue.Substring(0, 1).Equals("~"))
                    {
                        string SolutionFolder = WorkSpace.Instance.Solution.Folder;
                        XMLFiledValue = System.IO.Path.Combine(SolutionFolder, XMLFiledValue.Substring(2));
                    }
                    if (!System.IO.File.Exists(XMLFiledValue))
                    {
                        Reporter.ToUser(eUserMsgKey.FileNotExist);
                        return;
                    }
                    doc.Load(XMLFiledValue);
                    XmlNamespaceManager manager   = XMLDocExtended.GetAllNamespaces(doc);
                    XmlNodeList         testSuits = doc.DocumentElement.SelectNodes("(//*[local-name()='soapui-project']/*[local-name()='testSuite'])", manager);
                    foreach (XmlNode testSuit in testSuits)
                    {
                        string testSuitName = testSuit.Attributes["name"].Value;
                        TestSuiteComboBox.Items.Add(testSuitName);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void PopulateProjectPropertiesList()
        {
            ClearPropertyFromList(ActSoapUiInputValue.ePropertyType.Project);
            XmlDocument doc           = new XmlDocument();
            string      XMLFiledValue = mAct.GetInputParamCalculatedValue(ActSoapUI.Fields.XMLFile);

            if (!XMLFiledValue.Equals(string.Empty))
            {
                {
                    if (XMLFiledValue.Substring(0, 1).Equals("~"))
                    {
                        string SolutionFolder = mAct.SolutionFolder;
                        XMLFiledValue = SolutionFolder + XMLFiledValue.Substring(2);
                    }
                    if (!System.IO.File.Exists(XMLFiledValue))
                    {
                        Reporter.ToUser(eUserMsgKeys.FileNotExist);
                        return;
                    }
                    doc.Load(XMLFiledValue);
                    XmlNamespaceManager manager = XMLDocExtended.GetAllNamespaces(doc);

                    XmlNodeList properties = doc.SelectNodes("//*[local-name()='soapui-project']/*[local-name()='properties']/*[local-name()='property']", manager);

                    PopulatePropertiesGrid(properties, ActSoapUiInputValue.ePropertyType.Project);
                }
            }
        }
Exemplo n.º 5
0
        public void Validation()
        {
            //Handling test result from report XML file.
            //creating the report path string
            bool ignoreValidation;

            bool.TryParse(mAct.GetInputParamCalculatedValue(ActSoapUI.Fields.IgnoreValidation), out ignoreValidation);
            if (ignoreValidation)
            {
                return;
            }

            string testCaseRunLogReport = ReportPath + "\\test_case_run_log_report.xml";

            //checking if the content is less then 2 means the run was failed to execute if bigger then 2 means one txt file at lease was generated.
            string[] fileEntries = Directory.GetFiles(ReportPath);
            if (fileEntries.Length <= 1)
            {
                throw new Exception("Failed to execute the command, see Extra Info for more details.");
            }

            //fetching all teststeps from the xml file in order to check the status of each on of them.
            XmlDocument doc = new XmlDocument();

            doc.Load(testCaseRunLogReport);
            XmlNamespaceManager manager      = XMLDocExtended.GetAllNamespaces(doc);
            XmlNodeList         CasesResults = doc.DocumentElement.SelectNodes("(//*[local-name()='testCaseRunLog'])", manager);

            int CasesCounter = 0;

            foreach (XmlNode caseNode in CasesResults)
            {
                string testCaseName   = caseNode.Attributes["testCase"].Value;
                string testCaseStatus = caseNode.Attributes["status"].Value;
                CasesCounter++;
                XmlNodeList StepsResults = doc.DocumentElement.SelectNodes("(//*[local-name()='testCaseRunLog'][" + CasesCounter + "]/*[local-name()='testCaseRunLogTestStep'])", manager);
                foreach (XmlNode Stepnode in StepsResults)
                {
                    string TestStepStatus = Stepnode.Attributes["status"].Value;
                    string testStepName   = Stepnode.Attributes["name"].Value;
                    if (!TestStepStatus.Equals("OK"))
                    {
                        if ((mAct.Error == null))
                        {
                            mAct.Error = "The below list of test steps have been failed: " + Environment.NewLine + "TestCase: " + testCaseName + ", TestStep: " + testStepName + ", Status: " + TestStepStatus;
                        }
                        else
                        {
                            mAct.Error = mAct.Error + Environment.NewLine + "TestCase: " + testCaseName + ", TestStep: " + testStepName + ", Status: " + TestStepStatus;
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        public void XMLDocExtendedValidateXpathGenerated()

        {
            int    max  = XDE.GetAllNodes().Count;
            Random r    = new Random();
            int    rInt = r.Next(1, max);

            XMLDocExtended XDM = XDE.GetAllNodes().ToArray()[rInt];

            XmlNamespaceManager XNS = XMLDocExtended.GetAllNamespaces(XDoc);

            Assert.AreSame(XDoc.SelectSingleNode(XDM.XPath, XNS), XDM.GetXmlNode());
        }
Exemplo n.º 7
0
        private void FillCaseComboBox()
        {
            TestCaseComboBox.SelectionChanged -= TestCaseComboBox_SelectionChanged;

            TestCaseComboBox.Items.Clear();
            mAct.TestCaseProperties.Clear();

            TestCaseComboBox.Items.Add(string.Empty);
            TestCaseComboBox.SelectedIndex = 0;

            XmlDocument doc = new XmlDocument();

            App.AutomateTabGingerRunner.ProcessInputValueForDriver(mAct);
            string XMLFiledValue = mAct.GetInputParamCalculatedValue(ActSoapUI.Fields.XMLFile);

            if (XMLFiledValue.ToUpper().Substring(XMLFiledValue.Length - 4).Equals(".XML"))
            {
                if (XMLFiledValue.Substring(0, 1).Equals("~"))
                {
                    string SolutionFolder = App.UserProfile.Solution.Folder;
                    XMLFiledValue = System.IO.Path.Combine(SolutionFolder, XMLFiledValue.Substring(2));
                }
                if (!System.IO.File.Exists(XMLFiledValue))
                {
                    Reporter.ToUser(eUserMsgKeys.FileNotExist);
                    return;
                }
                doc.Load(XMLFiledValue);
                XmlNamespaceManager manager     = XMLDocExtended.GetAllNamespaces(doc);
                int         SuiteSelectedItemID = TestSuiteComboBox.SelectedIndex;
                XmlNodeList testCases;
                if (SuiteSelectedItemID > 0)
                {
                    testCases = doc.DocumentElement.SelectNodes("(//*[local-name()='soapui-project']/*[local-name()='testSuite'][" + SuiteSelectedItemID + "]/*[local-name()='testCase'])", manager);
                    foreach (XmlNode testCase in testCases)
                    {
                        string testCaseName = testCase.Attributes["name"].Value;
                        TestCaseComboBox.Items.Add(testCaseName);
                    }
                }
            }

            TestCaseComboBox.SelectionChanged += TestCaseComboBox_SelectionChanged;
        }
Exemplo n.º 8
0
        public string UpdateXMLProperty()
        {
            string userFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            string userFolderWithGingerTemp = userFolder + @"\Temp\GingerTemp";
            string fileForCommand           = userFolder + @"\Temp\GingerTemp\fileForCommand.xml";

            if (!System.IO.Directory.Exists(userFolderWithGingerTemp))
            {
                System.IO.Directory.CreateDirectory(userFolderWithGingerTemp);
            }

            string testSuite     = mAct.GetInputParamCalculatedValue(ActSoapUI.Fields.TestSuite);
            string testCase      = mAct.GetInputParamCalculatedValue(ActSoapUI.Fields.TestCase);
            string XMLFiledValue = mAct.GetInputParamCalculatedValue(ActSoapUI.Fields.XMLFile);
            ObservableList <ActInputValue> TestSuitePlaceHolder = mAct.TestSuitePlaceHolder;

            ObservableList <ActSoapUiInputValue> AllProperties = mAct.AllProperties;

            if (!XMLFiledValue.Equals(string.Empty))
            {
                if (XMLFiledValue.Substring(XMLFiledValue.Length - 4).ToUpper().Equals(".XML"))
                {
                    if (XMLFiledValue.Substring(0, 1).Equals("~"))
                    {
                        string SolutionFolder = mAct.SolutionFolder;
                        XMLFiledValue = System.IO.Path.Combine(SolutionFolder, XMLFiledValue.Substring(2));
                    }

                    XmlDocument doc = new XmlDocument();
                    doc.Load(XMLFiledValue);
                    XmlNamespaceManager manager = XMLDocExtended.GetAllNamespaces(doc);

                    XmlNodeList caseProperties    = doc.SelectNodes("//*[local-name()='soapui-project']/*[local-name()='testSuite'][@name='" + testSuite + "']/*[local-name()='testCase'][@name='" + testCase + "']/*[local-name()='properties']/*[local-name()='property']", manager);
                    XmlNodeList suiteProperties   = doc.SelectNodes("//*[local-name()='soapui-project']/*[local-name()='testSuite'][@name='" + testSuite + "']/*[local-name()='properties']/*[local-name()='property']", manager);
                    XmlNodeList stepProperties    = doc.SelectNodes("//*[local-name()='soapui-project']/*[local-name()='testSuite'][@name='" + testSuite + "']/*[local-name()='testCase'][@name='" + testCase + "']/*[local-name()='testStep'][@type='properties']/*[local-name()='config']/*[local-name()='properties']/*[local-name()='property']", manager);
                    XmlNodeList projectProperties = doc.SelectNodes("//*[local-name()='soapui-project']/*[local-name()='properties']/*[local-name()='property']", manager);

                    foreach (ActSoapUiInputValue AIV in AllProperties)
                    {
                        if (AIV.Type == ActSoapUiInputValue.ePropertyType.Project.ToString())
                        {
                            UpdateProperty(projectProperties, AIV);
                        }
                        if (AIV.Type == ActSoapUiInputValue.ePropertyType.TestSuite.ToString())
                        {
                            UpdateProperty(suiteProperties, AIV);
                        }
                        if (AIV.Type == ActSoapUiInputValue.ePropertyType.TestCase.ToString())
                        {
                            UpdateProperty(caseProperties, AIV);
                        }
                        if (AIV.Type == ActSoapUiInputValue.ePropertyType.TestStep.ToString())
                        {
                            UpdateProperty(stepProperties, AIV);
                        }
                    }

                    doc.Save(fileForCommand);

                    if (mAct.TestSuitePlaceHolder.Count > 0)
                    {
                        string fileContent;
                        if (File.ReadAllText(fileForCommand).Equals(string.Empty))
                        {
                            fileContent = File.ReadAllText(XMLFiledValue);
                        }
                        else
                        {
                            fileContent = File.ReadAllText(fileForCommand);
                        }

                        foreach (ActInputValue AIV in TestSuitePlaceHolder)
                        {
                            string propertyName  = AIV.Param;
                            string propertyValue = AIV.ValueForDriver;
                            fileContent = fileContent.Replace(propertyName, propertyValue);
                        }
                        File.WriteAllText(fileForCommand, fileContent, Encoding.ASCII);
                    }
                }
            }
            return(fileForCommand);
        }