Ejemplo n.º 1
0
 //Constructor
 public TestSpec(TestModule testmodule)
 {
     ptestmodule = testmodule;
     puniqueids = new Dictionary<object, TestItem>();
 }
Ejemplo n.º 2
0
 //Constructor
 public TestSpec(TestModule testmodule)
 {
     _testmodule = testmodule;
 }
Ejemplo n.º 3
0
		//Constructor
		public TestSpec(TestModule testmodule)
		{
			_testmodule = testmodule;
		}
Ejemplo n.º 4
0
        public override TestResult Execute()
        {
            base.Execute();
            TestModule module = GetModule();

            if (module == null)
            {
                throw new Exception("No parent module");
            }
            TestItems 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)
                {
                    if (child is TestCase)
                    {
                        TestCase t = child as TestCase;
                        t.Init();
                        t.Execute();
                        continue;
                    }
                    TestVariation var = child as TestVariation;
                    if (var != null)
                    {
                        const string indent = "\t";
                        try
                        {
                            CurVariation = var;
                            TestResult ret = var.Execute();
                            if (TestResult.Passed == ret)
                            {
                                module.PassCount++;
                            }
                            else if (TestResult.Failed == ret)
                            {
                                System.Console.WriteLine(indent + var.Desc);
                                System.Console.WriteLine(indent + " FAILED");
                                module.AddFailure(var.Desc);
                            }
                            else
                            {
                                System.Console.WriteLine(indent + var.Desc);
                                System.Console.WriteLine(indent + " SKIPPED");
                                module.SkipCount++;
                            }
                        }
                        catch (TestSkippedException tse)
                        {
                            if (!string.IsNullOrWhiteSpace(var.Desc))
                            {
                                System.Console.WriteLine(indent + var.Desc);
                            }
                            if (!string.IsNullOrWhiteSpace(tse.Message))
                            {
                                System.Console.WriteLine(indent + " SKIPPED" + ", Msg:" + tse.Message);
                            }
                            module.SkipCount++;
                        }
                        catch (Exception e)
                        {
                            System.Console.WriteLine(indent + var.Desc);
                            System.Console.WriteLine(e);
                            System.Console.WriteLine(indent + " FAILED");
                            module.AddFailure(var.Desc + Environment.NewLine + e.ToString());
                        }
                    }
                }
            }
            return(TestResult.Passed);
        }