예제 #1
0
 public CVariation(CTestCase testcase, string desc)
     : this(testcase, desc, "Variation_" + (testcase.GetVariationCount() + 1))
 {
     //Delegate
     //By default - if you don't specify the function name to run for this variation
     //it creates Variation_X, where X is the next variation for this testcase...
 }
예제 #2
0
 public CVariation(CTestCase testcase, string desc, string function)
     : base(function, desc)
 {
     //Note: The parent automatically gets setup on AddVariation so we don't 
     //really need to pass in the testcase, left here for backward compatibilty 
     //of inherited drivers.
 }
예제 #3
0
 public CVariation(CTestCase testcase, string desc, string function)
     : base(function, desc)
 {
     //Note: The parent automatically gets setup on AddVariation so we don't
     //really need to pass in the test case, left here for backward compatibility
     //of inherited drivers.
 }
예제 #4
0
 public CVariation(CTestCase testcase, string desc)
     : this(testcase, desc, "Variation_" + (testcase.GetVariationCount() + 1))
 {
     //Delegate
     //By default - if you don't specify the function name to run for this variation
     //it creates Variation_X, where X is the next variation for this test case...
 }
예제 #5
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);
        }
예제 #6
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);
                        }
                    }
                }
            }
        }
예제 #7
0
        public override IEnumerable <XunitTestCase> TestCases()
        {
            List <object> children = Children;

            if (children != null && children.Count > 0)
            {
                foreach (object child in children)
                {
                    CTestCase tc = child as CTestCase;
                    if (tc != null)
                    {
                        if (CModInfo.IsTestCaseSelected(tc.Name))
                        {
                            tc.Init();
                            foreach (XunitTestCase testCase in tc.TestCases())
                            {
                                yield return(testCase);
                            }
                        }
                    }
                }
            }
        }
예제 #8
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 tc = child as CTestCase;
                    if (tc != null)
                    {
                        if (CModInfo.IsTestCaseSelected(tc.Name))
                        {
                            Console.WriteLine("TestCase:{0} - {1}", tc.Attribute.Name, tc.Attribute.Desc);
                            tc.Init();
                            tc.Execute();
                        }
                    }
                }
            }
            Console.WriteLine("Pass:{0}, Fail:{1}, Skip:{2}", PassCount, FailCount, SkipCount);
            return(tagVARIATION_STATUS.eVariationStatusPassed);
        }
예제 #9
0
 //Constructor
 public CVariation(CTestCase testcase)
     : this(testcase, null)
 {
 }
예제 #10
0
 //Helpers
 public void AddTestCase(CTestCase testcase)
 {
     //Delegate
     this.AddChild(testcase);
 }
예제 #11
0
 //Constructor
 public CVariation(CTestCase testcase)
     : this(testcase, null)
 {
 }
예제 #12
0
 //Helpers
 public void AddTestCase(CTestCase testcase)
 {
     //Delegate
     this.AddChild(testcase);
 }