Esempio n. 1
0
        public override tagVARIATION_STATUS Execute()
        {
            List <object> children = Children;

            if (children != null && children.Count > 0)
            {
                // this is not a leaf node, just invoke all the children's execute
                foreach (object child in children)
                {
                    CTestCase childTc = child as CTestCase;
                    if (childTc != null)    //nested test test case class will be child of a test case
                    {
                        childTc.Init();
                        childTc.Execute();
                        continue;
                    }
                    CVariation var = child as CVariation;
                    if (var != null && CModInfo.IsVariationSelected(var.Desc))
                    {
                        const string indent = "\t";
                        try
                        {
                            CurVariation = var;
                            tagVARIATION_STATUS ret = var.Execute();
                            if (tagVARIATION_STATUS.eVariationStatusPassed == ret)
                            {
                                TestModule.PassCount++;
                            }
                            else if (tagVARIATION_STATUS.eVariationStatusFailed == ret)
                            {
                                System.Console.WriteLine(indent + var.Desc);
                                System.Console.WriteLine(indent + " FAILED");
                                TestModule.FailCount++;
                            }
                            else
                            {
                                System.Console.WriteLine(indent + var.Desc);
                                System.Console.WriteLine(indent + " SKIPPED");
                                TestModule.SkipCount++;
                            }
                        }
                        catch (CTestSkippedException tse)
                        {
                            System.Console.WriteLine(indent + var.Desc);
                            System.Console.WriteLine(indent + " SKIPPED" + ", Msg:" + tse.Message);
                            TestModule.SkipCount++;
                        }
                        catch (Exception e)
                        {
                            System.Console.WriteLine(indent + var.Desc);
                            System.Console.WriteLine("unexpected exception happend:{0}", e.Message);
                            System.Console.WriteLine(e.StackTrace);
                            System.Console.WriteLine(indent + " FAILED");
                            TestModule.FailCount++;
                        }
                    }
                }
            }
            return(tagVARIATION_STATUS.eVariationStatusPassed);
        }
Esempio n. 2
0
        public virtual tagVARIATION_STATUS ExecuteVariation(int index)
        {
            //Track the test case we're in
            CTestModule testmodule = this.TestModule;

            if (testmodule != null)
            {
                testmodule.CurTestCase = this;
            }

            //Track which variation were executing
            _curvariation = (CVariation)Children[index];

            int result = TEST_FAIL;

            if (_curvariation.Skipped || !_curvariation.Implemented)
            {
                //Skipped
                result = TEST_SKIPPED;
            }
            else
            {
                //Execute
                result = ExecuteVariation(index, _curvariation.Param);
            }

            //Before exiting make sure we reset our CurVariation to null, to prevent
            //incorrect uses of CurVariation within the TestCase, but not actually a running
            //variation.  This will only be valid within a function with a //[Variation] attribute...
            _curvariation = null;
            return((tagVARIATION_STATUS)result);
        }
Esempio n. 3
0
        public override IEnumerable <XunitTestCase> TestCases()
        {
            List <object> children = Children;

            if (children != null && children.Count > 0)
            {
                foreach (object child in children)
                {
                    CTestCase childTc = child as CTestCase;
                    if (childTc != null)
                    {
                        childTc.Init();

                        foreach (XunitTestCase testCase in childTc.TestCases())
                        {
                            yield return(testCase);
                        }

                        continue;
                    }

                    CVariation var = child as CVariation;
                    if (var != null && CModInfo.IsVariationSelected(var.Desc))
                    {
                        foreach (var testCase in var.TestCases())
                        {
                            Func <tagVARIATION_STATUS> test = testCase.Test;
                            testCase.Test = () => {
                                CurVariation = var;
                                return(test());
                            };

                            yield return(testCase);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        public string GetVariationDesc(int index)
        {
            CVariation variation = (CVariation)Children[index];

            return(variation.GetDescription());
        }
Esempio n. 5
0
        public int GetVariationID(int index)
        {
            CVariation variation = (CVariation)Children[index];

            return(variation.id);
        }
Esempio n. 6
0
 //Helpers
 public void AddVariation(CVariation variation)
 {
     //Delegate
     this.AddChild(variation);
 }
Esempio n. 7
0
        public virtual tagVARIATION_STATUS ExecuteVariation(int index)
        {
            //Track the testcase were in
            CTestModule testmodule = this.TestModule;
            if (testmodule != null)
                testmodule.CurTestCase = this;

            //Track which variation were executing
            _curvariation = (CVariation)Children[index];

            int result = TEST_FAIL;
            if (_curvariation.Skipped || !_curvariation.Implemented)
            {
                //Skipped
                result = TEST_SKIPPED;
            }
            else
            {
                //Execute
                result = ExecuteVariation(index, _curvariation.Param);
            }

            //Before exiting make sure we reset our CurVariation to null, to prevent 
            //incorrect uses of CurVariation wihtin the TestCase, but not actually a running
            //variation.  This will only be valid within a fucntion with a //[Variation] attribute...
            _curvariation = null;
            return (tagVARIATION_STATUS)result;
        }
Esempio n. 8
0
 //Helpers
 public void AddVariation(CVariation variation)
 {
     //Delegate
     this.AddChild(variation);
 }
Esempio n. 9
0
 // Type is XmlReaderTest.ReaderSettingsTest.TCReaderSettings
 // Test Case
 public override void DOTEST()
 {
     base.DOTEST();
     CurVariation = new CVariation(this);
 }