Exemplo n.º 1
0
        public override int ExecuteVariation(CXmlDriverParam param)
        {
            CError.WriteLine("Test Parameters : ");
            CError.WriteLine(this.CurVariation.Desc);
            CFactory f = null;
            string   factoryToInvoke = param.SelectExistingValue("DriverFunction");

            switch (factoryToInvoke) //separates whether to call Reader or Writer
            {
            case "XmlReader":
                f = new CReaderFactory();
                break;

            case "XmlWriter":
                f = new CWriterFactory();
                break;

            default:
                throw new
                      CTestFailedException("Invalid XmlDriverScenario passed in : " + factoryToInvoke);
            }
            CFactory.TestState testResult = f.TestVariation(param);
            if (testResult == CFactory.TestState.Pass)
            {
                return(TEST_PASS);
            }
            else if (testResult == CFactory.TestState.Skip)
            {
                return(TEST_SKIPPED);
            }

            return(TEST_FAIL);
        }
Exemplo n.º 2
0
        public override int ExecuteVariation(CXmlDriverParam param)
        {
            CError.WriteLine("Test Parameters : ");
            CError.WriteLine(this.CurVariation.Desc);
            CFactory f = null;
            string factoryToInvoke = param.SelectExistingValue("DriverFunction");
            switch (factoryToInvoke) //seperates whether to call Reader or Writer
            {
                case "XmlReader":
                    f = new CReaderFactory();
                    break;
                case "XmlWriter":
                    f = new CWriterFactory();
                    break;
                default:
                    throw new
                            CTestFailedException("Invalid XmlDriverScenario passed in : " + factoryToInvoke);
            }
            CFactory.TestState testResult = f.TestVariation(param);
            if (testResult == CFactory.TestState.Pass)
                return TEST_PASS;
            else if (testResult == CFactory.TestState.Skip)
                return TEST_SKIPPED;

            return TEST_FAIL;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Init does the following :
        /// Store Parameter Info.
        /// Parse out the commonly required and universal tags
        /// </summary>
        public virtual void Init(CXmlDriverParam param)
        {
            varInfo = param;
            string resultType = varInfo.SelectExistingValue("Result/@Type", "Data");

            if (resultType == "Valid")
            {
                isValid = true;
            }
            else
            {
                isValid = false;
            }

            exceptionType = varInfo.SelectValue("Result/ExceptionType", "Data");
            exceptionMsg  = varInfo.SelectValue("Result/ExceptionMessage", "Data");
            xmlFile       = varInfo.SelectValue("Result/TestXmlFile", "Data");
            filePath      = varInfo.SelectValue("filepath", "Data");
            filePath      = FilePathUtil.ExpandVariables(filePath);
            if (filePath == null)
            {
                Log("Setting filePath = " + filePath);
            }
            httpPath = varInfo.SelectValue("httppath", "Data");
        }
Exemplo n.º 4
0
        /// <summary>
        /// Reads the value of the tag in the Spec file under the FilterCriteria Section
        /// </summary>
        /// <param name="tag">Name of the tag to read.</param>
        /// <param name="throwOnNull">IF true, will check for null and throw,
        /// set to true if you want to throw an exception if value is not found.
        /// If set to false, the return value can be null</param>
        /// <returns>Value of the tag under FilterCriteria Section</returns>
        protected string ReadFilterCriteria(string tag, bool throwOnNull)
        {
            CError.WriteIgnore("Filtering " + tag + " : ");
            string s = null;

            if (throwOnNull)
            {
                s = varInfo.SelectExistingValue(tag, "FilterCriteria");
                Log(s);
            }
            else
            {
                s = varInfo.SelectValue(tag, "FilterCriteria");
                Log(s);
            }
            return(s);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Init does the following :
        /// Store Parameter Info.
        /// Parse out the commonly required and universal tags
        /// </summary>
        public virtual void Init(CXmlDriverParam param)
        {
            varInfo = param;
            string resultType = varInfo.SelectExistingValue("Result/@Type", "Data");
            if (resultType == "Valid")
                isValid = true;
            else
                isValid = false;

            exceptionType = varInfo.SelectValue("Result/ExceptionType", "Data");
            exceptionMsg = varInfo.SelectValue("Result/ExceptionMessage", "Data");
            xmlFile = varInfo.SelectValue("Result/TestXmlFile", "Data");
            filePath = varInfo.SelectValue("filepath", "Data");
            filePath = FilePathUtil.ExpandVariables(filePath);
            if (filePath == null)
            {
                Log("Setting filePath = " + filePath);
            }
            httpPath = varInfo.SelectValue("httppath", "Data");
        }