Exemplo n.º 1
0
        public void SimpleVerdictStepTest()
        {
            var      setVerdict = new OpenTap.Engine.UnitTests.TestTestSteps.VerdictStep();
            TestPlan plan       = new TestPlan();

            plan.Steps.Add(setVerdict);
            plan.Save("verdictPlan.TapPlan");
            var proc = TapProcessContainer.StartFromArgs("run verdictPlan.TapPlan");

            proc.WaitForEnd();
            Assert.AreEqual(0, proc.TapProcess.ExitCode);
        }
Exemplo n.º 2
0
        public void RunParseTest()
        {
            var      setVerdict = new OpenTap.Engine.UnitTests.TestTestSteps.VerdictStep();
            TestPlan plan       = new TestPlan();

            plan.Steps.Add(setVerdict);
            plan.ExternalParameters.Add(setVerdict, TypeData.GetTypeData(setVerdict).GetMember("VerdictOutput"), "verdict");
            plan.ExternalParameters.Get("verdict").Value = "Not Set";
            plan.Save("verdictPlan.TapPlan");
            var fileName = CreateCsvTestFile(new string[] { "verdict" }, new object[] { "pass" });
            {
                string[] passingThings = new[] { "verdict=\"pass\"", "verdict=\"Not Set\"", "verdict=\"not set\"", fileName };
                passingThings.AsParallel().ForAll(v =>
                {
                    var args = string.Format("run verdictPlan.TapPlan -e {0}", v);
                    Log.CreateSource("RunParseTest").Debug("Running tap {0}", args);
                    var proc = TapProcessContainer.StartFromArgs(string.Format("run verdictPlan.TapPlan -e {0}", v), TimeSpan.FromMinutes(5));
                    proc.WaitForEnd();
                    Assert.AreEqual(0, proc.TapProcess.ExitCode);
                });
            }
            {
                string[] passingThings = new[] { "fail", "Error" };
                passingThings.AsParallel().ForAll(v =>
                {
                    var args = string.Format("run verdictPlan.TapPlan -e verdict=\"{0}\"", v);
                    Log.CreateSource("RunParseTest").Debug("Running tap {0}", args);
                    var proc = TapProcessContainer.StartFromArgs(args, TimeSpan.FromSeconds(120));
                    proc.WaitForEnd();
                    if (v == "Error")
                    {
                        Assert.AreEqual((int)ExitStatus.RuntimeError, proc.TapProcess.ExitCode);
                    }
                    else
                    {
                        Assert.AreEqual((int)ExitStatus.TestPlanFail, proc.TapProcess.ExitCode);
                    }
                });
            }
        }