本文整理汇总了C#中AutoTest.TestRunners.Shared.Options.RunSettings类的典型用法代码示例。如果您正苦于以下问题:C# RunSettings类的具体用法?C# RunSettings怎么用?C# RunSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RunSettings类属于AutoTest.TestRunners.Shared.Options命名空间,在下文中一共展示了RunSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunSettings
public void and_a_namespace_is_specified_it_should_only_run_tests_contained_by_these_namespaces_and_all_sub_namespaces()
{
// Note that the namespaces varies between MbUnit.Tests and MbUnitTests.Tests
var settings = new RunSettings(new AssemblyOptions(getAssembly()), new string[] { }, null);
settings.Assembly.AddNamespace("AutoTest.TestRunners.MbUnit.Tests.TestResource");
Assert.That(_runner.Run(settings).Count(), Is.EqualTo(1));
}
示例2: Should_run_all_tests
public void Should_run_all_tests()
{
var settings = new RunSettings(new AssemblyOptions(Path.GetFullPath(@"AutoTest.TestRunners.MSTest.Tests.TestResource.dll")), new string[] {}, null);
var runner = new Runner();
var result = runner.Run(settings);
Assert.That(result.Count(), Is.EqualTo(10));
}
示例3: Run
public IEnumerable<TestResult> Run(Plugin plugin, string id, RunSettings settings)
{
_directories.Add(Path.GetDirectoryName(settings.Assembly.Assembly));
_directories.Add(Path.GetDirectoryName(plugin.Assembly));
Logger.Write("About to create plugin {0} in {1} for {2}", plugin.Type, plugin.Assembly, id);
var runner = getRunner(plugin);
try
{
if (runner == null)
return _results;
Logger.Write("Matching plugin identifier ({0}) to test identifier ({1})", runner.Identifier, id);
if (!runner.Identifier.ToLower().Equals(id.ToLower()))
return _results;
Logger.Write("Checking whether assembly contains tests for {0}", id);
if (!runner.ContainsTestsFor(settings.Assembly.Assembly))
return _results;
Logger.Write("Starting test run");
return runner.Run(settings);
}
catch
{
throw;
}
finally
{
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
}
}
示例4: and_a_test_is_specified_it_should_only_run_specified_tests
public void and_a_test_is_specified_it_should_only_run_specified_tests()
{
var settings = new RunSettings(new AssemblyOptions(getAssembly()), new string[] { }, null);
settings.Assembly.AddTest("AutoTest.TestRunners.MbUnitTests.Tests.TestResource.ClassContainingTests.A_passing_test");
settings.Assembly.AddTest("AutoTest.TestRunners.MbUnitTests.Tests.TestResource.ClassContainingTests.A_failing_test");
Assert.That(_runner.Run(settings).Count(), Is.EqualTo(2));
}
示例5: When_told_to_run_all_tests_it_reports_all_tests
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));
}
示例6: and_a_namespace_is_specified_it_should_only_run_tests_contained_by_these_namespaces
public void and_a_namespace_is_specified_it_should_only_run_tests_contained_by_these_namespaces()
{
var settings = new RunSettings(new AssemblyOptions(getAssembly()), new string[] { }, null);
settings.Assembly.AddNamespace("AutoTest.TestRunners.MbUnit.Tests.TestResource.AnotherNamespace");
Assert.That(_runner.Run(settings).Count(), Is.EqualTo(1));
Assert.That(_runner.Run(settings).ElementAt(0).TestName,
Is.EqualTo("AutoTest.TestRunners.MbUnit.Tests.TestResource.AnotherNamespace.TestsInAnotherNamespace.Even_another_test"));
}
示例7: when_told_to_run_all_on_type_it_runs_all_on_type
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));
}
示例8: Run
public IEnumerable<TestResult> Run(RunSettings settings)
{
_results = new List<TestResult>();
var thread = new Thread(run);
thread.SetApartmentState(ApartmentState.STA);
thread.Start(settings);
thread.Join();
return _results;
}
示例9: Should_not_run_test_with_ignore_attribute
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));
}
示例10: Run
public IEnumerable<TestResult> Run(RunSettings settings)
{
_results = new List<TestResult>();
var listener = new TestListener(_feedback, settings.Assembly.Assembly);
var assembly = getAssembly(settings.Assembly.Assembly);
var runner = new AppDomainRunner(listener, Machine.Specifications.Runner.RunOptions.Default);
runTests(settings, assembly, runner);
_results.AddRange(listener.Results);
return _results;
}
示例11: Run
public IEnumerable<TestResult> Run(RunSettings settings)
{
var runner = new NUnitRunner();
runner.Initialize();
var parser = new NUnitOptionsParser(settings);
parser.Parse();
var results = new List<TestResult>();
foreach (var option in parser.Options)
results.AddRange(runner.Execute(option));
return results;
}
示例12: shouldRun
private static bool shouldRun(string methodName, RunSettings settings)
{
var assembly = settings.Assembly;
if (assembly.Tests.Contains(methodName))
return true;
if (assembly.Members.Any(x => methodName.StartsWith(x)))
return true;
if (assembly.Namespaces.Any(x => methodName.StartsWith(x)))
return true;
return false;
}
示例13: runTests
private void runTests(RunSettings settings, IGrouping<Type, MethodInfo> fixture)
{
log("Running fixture {0}", fixture.Key);
if (_channel != null)
_channel.TestStarted(fixture.Key.ToString());
new MSTestTestFixture(fixture.Key)
.Run(fixture.ToList()).ToList()
.ForEach(result =>
{
var item = getResult(settings, fixture, result);
_results.Add(item);
_channel.TestFinished(item);
});
}
示例14: and_it_passes_it_should_return_passing_result
public void and_it_passes_it_should_return_passing_result()
{
var settings = new RunSettings(new AssemblyOptions(getAssembly()), new string[] { }, null);
settings.Assembly.AddTest("AutoTest.TestRunners.MbUnitTests.Tests.TestResource.ClassContainingTests.A_passing_test");
var result = _runner.Run(settings);
var test = result.ElementAt(0);
Assert.That(test.Assembly, Is.EqualTo(getAssembly()));
Assert.That(test.DurationInMilliseconds, Is.GreaterThan(0));
Assert.That(test.Runner, Is.EqualTo("MbUnit"));
Assert.That(test.State, Is.EqualTo(Shared.Results.TestState.Passed));
Assert.That(test.TestFixture, Is.EqualTo("AutoTest.TestRunners.MbUnitTests.Tests.TestResource.ClassContainingTests"));
Assert.That(test.TestName, Is.EqualTo("AutoTest.TestRunners.MbUnitTests.Tests.TestResource.ClassContainingTests.A_passing_test"));
}
示例15: runTests
private void runTests(RunSettings settings, Assembly assembly, AppDomainRunner runner)
{
if (runAllTests(settings))
{
runner.RunAssembly(assembly);
return;
}
foreach (var member in settings.Assembly.Tests)
runner.RunMember(assembly, assembly.GetType(member));
foreach (var member in settings.Assembly.Members)
runner.RunMember(assembly, assembly.GetType(member));
foreach (var ns in settings.Assembly.Namespaces)
runner.RunNamespace(assembly, ns);
}