Exemplo n.º 1
0
        public void Should_produce_xml()
        {
            var plugins = new List<Plugin>();
            var options = new RunOptions();
            plugins.Add(new Plugin(@"C:\Some\Path\Assembly.dll", "This.Is.Full.Type.Name.For.Class.Implementing.IAutoTestNetTestRunner"));
            plugins.Add(new Plugin(@"C:\Some\Path\Assembly.dll", "Some.Class.Name"));

            var runner1 = new RunnerOptions("nunit");
            runner1.AddCategories(new string[] { "SomeTestCategory", "SomeOtherTestCategory" });
            var assembly1 = new AssemblyOptions(@"C:\my\testassembly.dll");
            assembly1.HasBeenVerified(true);
            assembly1.AddTests(new string[] { "testassembly.class.test1", "testassembly.class.test2" });
            assembly1.AddMembers(new string[] { "testassembly.class2", "testassembly.class3" });
            assembly1.AddNamespaces(new string[] { "testassembly.somenamespace1", "testassembly.somenamespace2" });
            runner1.AddAssemblies(new AssemblyOptions[] { assembly1, new AssemblyOptions(@"C:\my\anothernunitassembly.dll") });
            options.AddTestRun(runner1);

            var runner2 = new RunnerOptions("another");
            runner2.AddAssembly(new AssemblyOptions(@"C:\my\other\testassembly.dll"));
            options.AddTestRun(runner2);
            
            var writer = new OptionsXmlWriter(plugins, options);
            var file = Path.GetTempFileName();
            writer.Write(file);

            var path = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
            var original = File.ReadAllText(file).Replace("\r\n", "\n");
            var generated = File.ReadAllText(Path.Combine(path, "TestOptionsCorrected.xml")).Replace("\r\n", "\n");
            Assert.That(original, Is.EqualTo(generated));
        }
 public void When_told_to_run_all_tests_it_reports_all_tests()
 {
     var runner = new Runner();
     var options = new AssemblyOptions(getAssembly());
     var settings = new RunSettings(options, new string[] { }, null);
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(5));
 }
Exemplo n.º 3
0
 public void AddRunner(string runnerID, IEnumerable<string> categories, AssemblyOptions assemblyOptions)
 {
     var option = _runOptions.Where(x => x.ID.Equals(runnerID)).FirstOrDefault();
     if (option == null)
         option = addOption(runnerID);
     option.AddAssembly(assemblyOptions);
     mergeCategories(option, categories);
 }
Exemplo n.º 4
0
 public SubDomainRunner(Plugin plugin, string id, IEnumerable<string> categories, AssemblyOptions assembly, bool shouldLog)
 {
     _plugin = plugin;
     _id = id;
     _categories = categories;
     _assembly = assembly;
     _shouldLog = shouldLog;
 }
 public void when_told_to_run_all_on_type_it_runs_all_on_type()
 {
     var runner = new Runner();
     var options = new AssemblyOptions(getAssembly());
     options.AddMember("AutoTest.TestRunners.SimpleTesting.Tests.Resources.SimpleTestingTests");
     var settings = new RunSettings(options, new string[] { }, null);
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(3));
 }
 private void getAssembly(XmlTextReader reader)
 {
     if (reader.IsEmptyElement)
         _currentRunner.AddAssembly(new AssemblyOptions(reader.GetAttribute("name")).HasBeenVerified(reader.GetAttribute("verified") == "true"));
     else if (reader.NodeType == XmlNodeType.EndElement)
         _currentRunner.AddAssembly(_currentAssembly);
     else
         _currentAssembly = new AssemblyOptions(reader.GetAttribute("name")).HasBeenVerified(reader.GetAttribute("verified") == "true");
 }
Exemplo n.º 7
0
 private static RunOptions getRunOptions()
 {
     var assembly = new AssemblyOptions(@"P:\projects\mooseprofiler.git\MMProfiler\main\x86\Debug\Test.Target.dll");
     var run = new RunnerOptions("NUnit");
     run.AddAssembly(assembly);     
     var optoins = new RunOptions();
     optoins.AddTestRun(run);
     return optoins;
 }
 private void addAssembly(string runnerID, IEnumerable<string> categories, AssemblyOptions assemblyOptions)
 {
     var platform = getPlatform(assemblyOptions.Assembly);
     var targetFramework = getTargetFramework(assemblyOptions.Assembly);
     var targeted = _runs.Where(x => x.TargetFramework.Equals(targetFramework) && x.Platform.Equals(platform)).FirstOrDefault();
     if (targeted == null || _runAssembliesInParallel)
         targeted = addTarget(platform, targetFramework);
     targeted.AddRunner(runnerID, categories, assemblyOptions);
 }
Exemplo n.º 9
0
 public SubDomainRunner(Plugin plugin, string id, IEnumerable<string> categories, AssemblyOptions assembly, bool shouldLog, string pipeName, bool compatibilityMode)
 {
     _plugin = plugin;
     _id = id;
     _categories = categories;
     _assembly = assembly;
     _shouldLog = shouldLog;
     _pipeName = pipeName;
     _compatibilityMode = compatibilityMode;
 }
Exemplo n.º 10
0
 public void Should_not_run_test_with_ignore_attribute()
 {
     var assemblyPath = Path.GetFullPath(@"AutoTest.TestRunners.MSTest.Tests.TestResource.dll");
     var assembly = new AssemblyOptions(assemblyPath);
     assembly.AddTest("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture1.Ignore_Attrib_test");
     var settings = new RunSettings(assembly, new string[] { }, null);
     var runner = new Runner();
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(0));
 }
 public void when_running_named_test_that_passes()
 {
     var runner = new Runner();
     var options = new AssemblyOptions(getAssembly());
     options.AddTest("AutoTest.TestRunners.SimpleTesting.Tests.Resources.SimpleTestingTests.a_passing_test");
     var settings = new RunSettings(options, new string[] { }, null);
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(1));
     Assert.That(result.First().State == TestState.Passed);
     Assert.That(!result.First().StackLines.Any());
     Assert.That(result.First().TestDisplayName == "a_passing_test");
     Assert.That(result.First().Runner == "SimpleTesting");
     Assert.AreEqual("AutoTest.TestRunners.SimpleTesting.Tests.Resources.SimpleTestingTests.a_passing_test", result.First().TestName);
     Assert.AreEqual("SimpleTestingTests", result.First().TestFixture);
 }
Exemplo n.º 12
0
        public void Should_run_full_fixture()
        {
            var assemblyPath = Path.GetFullPath(@"AutoTest.TestRunners.MSTest.Tests.TestResource.dll");
            var assembly = new AssemblyOptions(assemblyPath);
            assembly.AddMember("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture2");
            var settings = new RunSettings(assembly, new string[] { });
            var runner = new Runner();
            var result = runner.Run(settings);
            Assert.That(result.Count(), Is.EqualTo(2));
            var test = result.ElementAt(0);
            Assert.That(test.TestFixture, Is.EqualTo("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture2"));
            Assert.That(test.TestName, Is.EqualTo("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture2.Another_passing_test"));

            Assert.That(result.ElementAt(1).TestFixture, Is.EqualTo("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture2"));
        }
Exemplo n.º 13
0
 private void getAssembly(XmlTextReader reader)
 {
     if (reader.IsEmptyElement)
     {
         _currentRunner.AddAssembly(new AssemblyOptions(reader.GetAttribute("name")));
     }
     else if (reader.NodeType == XmlNodeType.EndElement)
     {
         _currentRunner.AddAssembly(_currentAssembly);
     }
     else
     {
         _currentAssembly = new AssemblyOptions(reader.GetAttribute("name"));
     }
 }
Exemplo n.º 14
0
 public void When_told_to_run_a_test_that_is_ignored_it_reports_a_ignored_result()
 {
     var runner = new Runner();
     var options = new AssemblyOptions(getAssembly());
     options.AddTest("AutoTest.TestRunners.MSpec.Tests.TestResource.Ignored_test");
     var settings = new RunSettings(options, new string[] { }, null);
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(1));
     var test = result.ElementAt(0);
     Assert.That(test.State, Is.EqualTo(Shared.Results.TestState.Ignored));
     Assert.That(test.Assembly, Is.EqualTo(getAssembly()));
     Assert.That(test.Runner, Is.EqualTo("MSpec"));
     Assert.That(test.TestFixture, Is.EqualTo("AutoTest.TestRunners.MSpec.Tests.TestResource.Ignored_test"));
     Assert.That(test.TestName, Is.EqualTo("AutoTest.TestRunners.MSpec.Tests.TestResource.Ignored_test"));
 }
Exemplo n.º 15
0
 public void Should_run_single_failing_test()
 {
     var assemblyPath = Path.GetFullPath(@"AutoTest.TestRunners.MSTest.Tests.TestResource.dll");
     var assembly = new AssemblyOptions(assemblyPath);
     assembly.AddTest("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture1.Failing_test");
     var settings = new RunSettings(assembly, new string[] { }, null);
     var runner = new Runner();
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(1));
     var test = result.ElementAt(0);
     Assert.That(test.Runner, Is.EqualTo("MSTest"));
     Assert.That(test.Assembly, Is.EqualTo(assemblyPath));
     Assert.That(test.State, Is.EqualTo(Shared.Results.TestState.Failed));
     Assert.That(test.TestFixture, Is.EqualTo("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture1"));
     Assert.That(test.TestName, Is.EqualTo("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture1.Failing_test"));
 }
Exemplo n.º 16
0
 public void Should_run_single_inconclusive_test()
 {
     var assemblyPath = Path.GetFullPath(@"AutoTest.TestRunners.MSTest.Tests.TestResource.dll");
     var assembly = new AssemblyOptions(assemblyPath);
     assembly.AddTest("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture1.Inconclusive_test");
     var settings = new RunSettings(assembly, new string[] { });
     var runner = new Runner();
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(1));
     var test = result.ElementAt(0);
     Assert.That(test.Runner, Is.EqualTo("MSTest"));
     Assert.That(test.Assembly, Is.EqualTo(assemblyPath));
     Assert.That(test.State, Is.EqualTo(Shared.Results.TestState.Ignored));
     Assert.That(test.TestFixture, Is.EqualTo("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture1"));
     Assert.That(test.TestName, Is.EqualTo("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture1.Inconclusive_test"));
     Assert.That(test.DurationInMilliseconds, Is.GreaterThan(0));
 }
Exemplo n.º 17
0
        private AssemblyOptions[] getAssemblies(XmlNode parent)
        {
            var assemblies = new List <AssemblyOptions>();
            var nodes      = parent.SelectNodes("test_assembly");

            foreach (XmlNode node in nodes)
            {
                XmlNode nameNode = node.Attributes.GetNamedItem("name");
                string  name     = null;
                if (nameNode != null)
                {
                    name = nameNode.InnerXml;
                }
                var assembly = new AssemblyOptions(name);
                assembly.AddTests(getTests(node));
                assembly.AddMembers(getMembers(node));
                assembly.AddNamespaces(getNamespaces(node));
                assemblies.Add(assembly);
            }
            return(assemblies.ToArray());
        }
Exemplo n.º 18
0
 public void AddAssembly(AssemblyOptions options)
 {
     _assemblies.Add(options);
 }
Exemplo n.º 19
0
        public void Debug(CacheTestMessage test)
        {
            try
            {
                AutoTest.Core.DebugLog.Debug.WriteDebug("Starting debug session");
                var found = false;
                var targetFramework = "";
                found = setBreakpointFromMethod(test, ref targetFramework);
                if (!found)
                    found = setBreakpointFromStacktrace(test, ref targetFramework);

                if (!found)
                    return;

                var process = new AutoTestRunnerDebugProcess();
                var assembly = test.Assembly;

                AutoTest.Core.DebugLog.Debug.WriteDebug("Starting process suspended");
                var command = "";
                var options = new RunOptions();
                var runner = new RunnerOptions(getTestRunner(TestRunnerConverter.ToString(test.Test.Runner), test.Assembly, test.Test.Name));
                var asm = new AssemblyOptions(test.Assembly);
                asm.AddTest(test.Test.Name);
                runner.AddAssembly(asm);
                options.AddTestRun(runner);
                AutoTest.Core.DebugLog.Debug.WriteDebug(string.Format("Starting {0}", command));
                var processID = process.StartPaused(options, test.Test.Runner);
                try
                {
                    AutoTest.Core.DebugLog.Debug.WriteDebug("Locating debugger for Visual Studio " + _application.Version);
                    var dbg2 = (EnvDTE80.Debugger2)_application.Debugger;
                    var trans = (EnvDTE80.Transport)dbg2.Transports.Item("Default");
                    EnvDTE80.Engine[] dbgeng;
                    if (_application.Version == "9.0")
                    {
                        dbgeng = new EnvDTE80.Engine[] { trans.Engines.Item("Managed") };
                    }
                    else
                    {
                        if (process.Framework == new Version(4, 0))
                            dbgeng = new EnvDTE80.Engine[] { trans.Engines.Item("Managed (v4.0)") };
                        else
                            dbgeng = new EnvDTE80.Engine[] { trans.Engines.Item("Managed (v2.0, v1.1, v1.0)") };
                    }
                    
                    EnvDTE80.Process2 proc2 = null;
                    foreach (EnvDTE80.Process2 proc in dbg2.GetProcesses(trans, null))
                    {
                        if (proc.ProcessID == processID)
                        {
                            proc2 = proc;
                            break;
                        }
                    }
                    if (proc2 != null)
                        proc2.Attach2(dbgeng);
                }
                catch (Exception ex)
                {
                    AutoTest.Core.DebugLog.Debug.WriteException(ex);
                    throw;
                }
                finally
                {
                    AutoTest.Core.DebugLog.Debug.WriteDebug("Resuming process");
                    process.Resume();
                }
            }
            catch (Exception ex)
            {
                AutoTest.Core.DebugLog.Debug.WriteException(ex);
            }
        }
Exemplo n.º 20
0
 public void AddAssemblies(AssemblyOptions[] options)
 {
     _assemblies.AddRange(options);
 }
Exemplo n.º 21
0
 public void When_told_to_run_a_namespace_it_reports_all_tests_in_namespace()
 {
     var runner = new Runner();
     var options = new AssemblyOptions(getAssembly());
     options.AddNamespace("AutoTest.TestRunners.MSpec.Tests.TestResource");
     var settings = new RunSettings(options, new string[] { }, null);
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(4));
 }
Exemplo n.º 22
0
 public void When_told_to_run_a_member_it_reports_all_tests_in_member_which_for_mspec_is_a_single_test()
 {
     var runner = new Runner();
     var options = new AssemblyOptions(getAssembly());
     options.AddMember("AutoTest.TestRunners.MSpec.Tests.TestResource.Can_add_numbers");
     var settings = new RunSettings(options, new string[] { }, null);
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(1));
     var test = result.ElementAt(0);
     Assert.That(test.State, Is.EqualTo(Shared.Results.TestState.Passed));
     Assert.That(test.Assembly, Is.EqualTo(getAssembly()));
     Assert.That(test.Runner, Is.EqualTo("MSpec"));
     Assert.That(test.TestFixture, Is.EqualTo("AutoTest.TestRunners.MSpec.Tests.TestResource.Can_add_numbers"));
     Assert.That(test.TestName, Is.EqualTo("AutoTest.TestRunners.MSpec.Tests.TestResource.Can_add_numbers"));
 }
Exemplo n.º 23
0
 public void When_told_to_run_a_test_that_fails_it_reports_a_failed_result()
 {
     var runner = new Runner();
     var options = new AssemblyOptions(getAssembly());
     options.AddTest("AutoTest.TestRunners.MSpec.Tests.TestResource.Can_not_add_numbers");
     var settings = new RunSettings(options, new string[] { }, null);
     var result = runner.Run(settings);          
     Assert.That(result.Count(), Is.EqualTo(1));
     var test = result.ElementAt(0);
     Assert.That(test.State, Is.EqualTo(Shared.Results.TestState.Failed));
     Assert.That(test.Assembly, Is.EqualTo(getAssembly()));
     Assert.That(test.Runner, Is.EqualTo("MSpec"));
     Assert.That(test.TestFixture, Is.EqualTo("AutoTest.TestRunners.MSpec.Tests.TestResource.Can_not_add_numbers"));
     Assert.That(test.TestName, Is.EqualTo("AutoTest.TestRunners.MSpec.Tests.TestResource.Can_not_add_numbers"));
     Assert.That(test.Message, Is.EqualTo("I'm failing here"));
     Assert.That(test.StackLines.Count(), Is.EqualTo(2));
 }
Exemplo n.º 24
0
 public RunSettings(AssemblyOptions assembly, string[] ignoreCategories, string pipeName)
 {
     Assembly = assembly;
     IgnoreCategories = ignoreCategories;
     PipeName = pipeName;
 }
Exemplo n.º 25
0
 public void AddAssembly(AssemblyOptions options)
 {
     _assemblies.Add(options);
 }
Exemplo n.º 26
0
 public RunSettings(AssemblyOptions assembly, string[] ignoreCategories)
 {
     Assembly = assembly;
     IgnoreCategories = ignoreCategories;
 }
Exemplo n.º 27
0
        private static RunnerOptions getTestRunsFor(IAutoTestNetTestRunner instance, RunnerOptions run)
        {
            if (run.ID.ToLower() != "any")
                return run;

            var newRun = new RunnerOptions(run.ID);
            newRun.AddCategories(run.Categories.ToArray());
            foreach (var asm in run.Assemblies)
            {
                if (!asm.IsVerified && !instance.ContainsTestsFor(asm.Assembly))
                    continue;
                var assembly = new AssemblyOptions(asm.Assembly);
                assembly.AddNamespaces(asm.Namespaces.Where(x => asm.IsVerified || instance.ContainsTestsFor(asm.Assembly, x)).ToArray());
                assembly.AddMembers(asm.Members.Where(x => asm.IsVerified || instance.ContainsTestsFor(asm.Assembly, x)).ToArray());
                assembly.AddTests(asm.Tests.Where(x => asm.IsVerified || instance.IsTest(asm.Assembly, x)).ToArray());
                if (hasNoTests(asm) || hasTests(assembly))
                    newRun.AddAssembly(assembly);
            }
            if (newRun.Assemblies.Count() == 0)
                return null;
            return newRun;
        }
Exemplo n.º 28
0
 public void Should_run_test_for_namespace()
 {
     var assemblyPath = Path.GetFullPath(@"AutoTest.TestRunners.MSTest.Tests.TestResource.dll");
     var assembly = new AssemblyOptions(assemblyPath);
     assembly.AddNamespace("AutoTest.TestRunners.MSTest.Tests.TestResource.SomeNamespace");
     var settings = new RunSettings(assembly, new string[] { }, null);
     var runner = new Runner();
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(4));
 }
Exemplo n.º 29
0
 private static bool hasNoTests(AssemblyOptions asm)
 {
     return asm.Namespaces.Count() == 0 && asm.Members.Count() == 0 && asm.Tests.Count() == 0;
 }
Exemplo n.º 30
0
 public void Should_run_single_test_and_type()
 {
     var assembly = new AssemblyOptions(
         Path.GetFullPath(@"AutoTest.TestRunners.NUnit.Tests.TestResource.dll")
     );
     assembly.AddTest("AutoTest.TestRunners.NUnit.Tests.TestResource.Fixture1.Should_ignore");
     assembly.AddMember("AutoTest.TestRunners.NUnit.Tests.TestResource.Fixture2");
     var options = new RunSettings(assembly, new string[] {}, "feedback_pipe");
     var results = _runner.Run(options);
     Assert.That(results.Count(), Is.EqualTo(3));
 }
Exemplo n.º 31
0
        private RunnerOptions getRunnerOptions(IEnumerable<TestRunInfo> unitInfos, IAutoTestNetTestRunner instance)
        {
            DebugLog.Debug.WriteDetail("Getting runner options for {0}", instance.Identifier);
            var runner = new RunnerOptions(instance.Identifier);
            runner.AddCategories(_configuration.TestCategoriesToIgnore);
            var testRunner = TestRunnerConverter.FromString(instance.Identifier);
            foreach (var info in unitInfos)
            {
				DebugLog.Debug.WriteDetail("Handling {0}", info.Assembly);
				DebugLog.Debug.WriteDetail("About to add assembly");
                var assembly = new AssemblyOptions(info.Assembly);
                assembly.HasBeenVerified(true);
                assembly.AddTests(info.GetTestsFor(testRunner));
                DebugLog.Debug.WriteDetail("Found {0} tests for assembly", assembly.Tests.Count());
                assembly.AddMembers(info.GetMembersFor(testRunner));
                DebugLog.Debug.WriteDetail("Found {0} members for assembly", assembly.Members.Count());
                assembly.AddNamespaces(info.GetNamespacesFor(testRunner));
                DebugLog.Debug.WriteDetail("Found {0} namespaces for assembly", assembly.Namespaces.Count());
                DebugLog.Debug.WriteDetail("Run only specified tests for runner {0} is {1}", testRunner, info.OnlyRunSpcifiedTestsFor(testRunner));
                if (info.OnlyRunSpcifiedTestsFor(testRunner) && assembly.Tests.Count() == 0 && assembly.Members.Count() == 0 && assembly.Namespaces.Count() == 0)
                    continue;
				DebugLog.Debug.WriteDetail("Adding assembly");
                runner.AddAssembly(assembly);
            }
            return runner;
        }
Exemplo n.º 32
0
        public void Should_run_test()
        {
            var assembly = new AssemblyOptions(
                Path.GetFullPath(@"AutoTest.TestRunners.NUnit.Tests.TestResource.dll")
            );
            var options = new RunSettings(assembly, new string[] {}, "feedback_pipe");
            var results = _runner.Run(options);
            Assert.That(results.Count(), Is.EqualTo(9));

            Assert.That(results.ElementAt(0).Assembly, Is.EqualTo(Path.GetFullPath(@"AutoTest.TestRunners.NUnit.Tests.TestResource.dll")));
            Assert.That(results.ElementAt(0).TestFixture, Is.EqualTo("AutoTest.TestRunners.NUnit.Tests.TestResource.Fixture1"));
            Assert.That(results.ElementAt(0).State, Is.EqualTo(Shared.Results.TestState.Failed));
            Assert.That(results.ElementAt(0).TestName, Is.EqualTo("AutoTest.TestRunners.NUnit.Tests.TestResource.Fixture1.Should_fail()"));
            Assert.That(results.ElementAt(0).StackLines.Count(), Is.EqualTo(1));
            Assert.That(results.ElementAt(0).StackLines.ElementAt(0).Method.Replace(" ()", "()"), Is.EqualTo("AutoTest.TestRunners.NUnit.Tests.TestResource.Fixture1.Should_fail()"));

            Assert.That(results.ElementAt(1).Assembly, Is.EqualTo(Path.GetFullPath(@"AutoTest.TestRunners.NUnit.Tests.TestResource.dll")));
            Assert.That(results.ElementAt(1).TestFixture, Is.EqualTo("AutoTest.TestRunners.NUnit.Tests.TestResource.Fixture1"));
            Assert.That(results.ElementAt(1).State, Is.EqualTo(Shared.Results.TestState.Ignored));
            Assert.That(results.ElementAt(1).TestName, Is.EqualTo("AutoTest.TestRunners.NUnit.Tests.TestResource.Fixture1.Should_ignore"));
            Assert.That(results.ElementAt(1).StackLines.Count(), Is.EqualTo(1));
            Assert.That(results.ElementAt(1).StackLines.ElementAt(0).Method.Replace(" ()", "()"), Is.EqualTo("AutoTest.TestRunners.NUnit.Tests.TestResource.Fixture1.Should_ignore()"));

            Assert.That(results.ElementAt(2).Assembly, Is.EqualTo(Path.GetFullPath(@"AutoTest.TestRunners.NUnit.Tests.TestResource.dll")));
            Assert.That(results.ElementAt(2).TestFixture, Is.EqualTo("AutoTest.TestRunners.NUnit.Tests.TestResource.Fixture1"));
            Assert.That(results.ElementAt(2).State, Is.EqualTo(Shared.Results.TestState.Passed));
            Assert.That(results.ElementAt(2).TestName, Is.EqualTo("AutoTest.TestRunners.NUnit.Tests.TestResource.Fixture1.Should_pass"));
            Assert.That(results.ElementAt(2).StackLines.Count(), Is.EqualTo(0));

            // For some reason NUnit can't seems to locate filename and line number on windows when stacktrace only shows method name
            if (OS.IsPosix)
            {
                Assert.IsTrue(File.Exists(results.ElementAt(0).StackLines.ElementAt(0).File), "Did not find " + results.ElementAt(0).StackLines.ElementAt(0).File);
                Assert.That(results.ElementAt(0).StackLines.ElementAt(0).Line, Is.EqualTo(22));

                Assert.IsTrue(File.Exists(results.ElementAt(0).StackLines.ElementAt(0).File), "Did not find " + results.ElementAt(0).StackLines.ElementAt(0).File);
                Assert.That(results.ElementAt(1).StackLines.ElementAt(0).Line, Is.EqualTo(29));
            }
        }
Exemplo n.º 33
0
 public void Should_run_tests_from_namespace()
 {
     var assembly = new AssemblyOptions(
         Path.GetFullPath(@"AutoTest.TestRunners.NUnit.Tests.TestResource.dll")
     );
     assembly.AddNamespace("AutoTest.TestRunners.NUnit.Tests.TestResource");
     var options = new RunSettings(assembly, new string[] {}, "feedback_pipe");
     var results = _runner.Run(options);
     Assert.That(results.Count(), Is.EqualTo(9));
 }
Exemplo n.º 34
0
 public RunSettings(AssemblyOptions assembly, string[] ignoreCategories, string pipeName)
 {
     Assembly         = assembly;
     IgnoreCategories = ignoreCategories;
     PipeName         = pipeName;
 }