public override tagVARIATION_STATUS Execute()
        {
            tagVARIATION_STATUS res = (tagVARIATION_STATUS)TEST_FAIL;

            try
            {
                if (!CheckSkipped())
                {
                    return((tagVARIATION_STATUS)TEST_SKIPPED);
                }

                CXmlDriverScenario scenario = (CXmlDriverScenario)Parent;

                res = (tagVARIATION_STATUS)scenario.ExecuteVariation(XmlDriverParam);
            }
            catch (CTestSkippedException e)
            {
                res = (tagVARIATION_STATUS)HandleException(e);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                res = (tagVARIATION_STATUS)HandleException(e);
            }

            return(res);
        }
 internal CXmlDriverErrorTestCase(string name, string desc, Exception e, tagVARIATION_STATUS returnCode, CTestModule testModule) :
     base(testModule, (desc.Length > 1000 ? desc.Substring(0, 1000) + "..." : desc))
 {
     this.Name   = name;
     _exception  = e;
     _returnCode = returnCode;
 }
Beispiel #3
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);
        }
Beispiel #4
0
 internal CXmlDriverErrorTestCase(string name, string desc, Exception e, tagVARIATION_STATUS returnCode, CTestModule testModule) :
     base(testModule, (desc.Length > 1000 ? desc.Substring(0, 1000) + "..." : desc))
 {
     this.Name = name;
     _exception = e;
     _returnCode = returnCode;
 }
 public void Run()
 {
     try
     {
         tagVARIATION_STATUS result = (tagVARIATION_STATUS)Test();
         Assert.NotEqual(tagVARIATION_STATUS.eVariationStatusFailed, result);
     }
     catch (CTestSkippedException) { }
 }