Ejemplo n.º 1
0
        public void RunTwoSelectedCategories()
        {
            var setupData = new RunnerSetupData
            {
                WorkingDirectory = workingDir,
                DryRun           = true,
                Results          = Path.GetTempFileName(),
                Continuous       = false,
                IsTesting        = true,
            };
            var runner  = new TestRunner(setupData);
            var assData = runner.Assemblies.First();

            assData.ShouldRun = false;

            var catData1 = runner.Assemblies.SelectMany(a => a.Categories).First(c => c.Name == "Smoke");

            ((IExcludable)catData1).ShouldRun = true;

            var catData2 = runner.Assemblies.SelectMany(a => a.Categories).First(c => c.Name == "Integration");

            ((IExcludable)catData2).ShouldRun = true;

            runner.SetupTests();
            Assert.AreEqual(runner.GetRunnableTests().Count(), 3);
        }
Ejemplo n.º 2
0
        private IRunnerSetupData TestSetupData()
        {
            var setupData = new RunnerSetupData
            {
                WorkingDirectory = workingDir,
                DryRun           = true,
                Results          = Path.GetTempFileName(),
                Continuous       = false,
                IsTesting        = true
            };

            return(setupData);
        }
Ejemplo n.º 3
0
        public void RunsFixtureIfSpecifiedInParameters()
        {
            var setupData = new RunnerSetupData
            {
                WorkingDirectory = workingDir,
                DryRun           = true,
                Results          = Path.GetTempFileName(),
                Continuous       = false,
                IsTesting        = true,
                Fixture          = "FixtureA"
            };
            var runner = new TestRunner(setupData);

            runner.SetupTests();
            Assert.AreEqual(runner.GetRunnableTests().Count(), 3);
        }
Ejemplo n.º 4
0
        public void DoesNotRunCategoryThatIsExcluded()
        {
            var setupData = new RunnerSetupData
            {
                WorkingDirectory = workingDir,
                DryRun           = true,
                Results          = Path.GetTempFileName(),
                Continuous       = false,
                IsTesting        = true,
                ExcludedCategory = "Failure"
            };
            var runner = new TestRunner(setupData);

            runner.SetupTests();
            Assert.AreEqual(runner.GetRunnableTests().Count(), 3);
        }
Ejemplo n.º 5
0
        public void TestInTwoCategories()
        {
            var setupData = new RunnerSetupData
            {
                WorkingDirectory = workingDir,
                DryRun           = true,
                Results          = Path.GetTempFileName(),
                Continuous       = false,
                IsTesting        = true,
            };
            var runner = new TestRunner(setupData);

            var test =
                runner.Assemblies.
                SelectMany(a => a.Categories).
                SelectMany(c => c.Tests).
                Where(t => t.Name == "TestA");

            Assert.AreEqual(test.Count(), 2);
        }
Ejemplo n.º 6
0
        public void CanSerializeAndDeserialize()
        {
            var tmpResultsPath = Path.GetTempFileName();

            var setupData = new RunnerSetupData
            {
                WorkingDirectory = workingDir,
                DryRun           = true,
                Results          = tmpResultsPath,
                Continuous       = false,
                IsTesting        = true,
                Fixture          = "FixtureA",
                Timeout          = 5,
            };

            var runner = new Runner(setupData);

            var testPath = Path.GetTempFileName();

            Runner.Save(testPath, runner);

            var newRunner = Runner.Load(testPath);

            Assert.AreEqual(newRunner.WorkingDirectory, workingDir);
            Assert.AreEqual(newRunner.DryRun, true);
            Assert.AreEqual(newRunner.Results, tmpResultsPath);
            Assert.AreEqual(newRunner.Continuous, false);
            Assert.AreEqual(newRunner.IsTesting, true);
            Assert.AreEqual(newRunner.Fixture, "FixtureA");
            Assert.AreEqual(newRunner.Timeout, 5);

            newRunner.Timeout = 10;

            var testPath2 = Path.GetTempFileName();

            Runner.Save(testPath2, newRunner);

            var newRunner2 = Runner.Load(testPath2);

            Assert.AreEqual(newRunner2.Timeout, 10);
        }
Ejemplo n.º 7
0
        public void CanConstructDefaultRunner()
        {
            var setupData = new RunnerSetupData();

            Assert.DoesNotThrow(() => new TestRunner(setupData));
        }