本文整理汇总了C#中AutoTest.Core.Messaging.MessageConsumers.TestRunInfo类的典型用法代码示例。如果您正苦于以下问题:C# TestRunInfo类的具体用法?C# TestRunInfo怎么用?C# TestRunInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestRunInfo类属于AutoTest.Core.Messaging.MessageConsumers命名空间,在下文中一共展示了TestRunInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getTestResults
private TestRunResults getTestResults(TestRunInfo runInfo)
{
string project = "";
if (runInfo.Project != null)
project = runInfo.Project.Key;
return new TestRunResults(project, runInfo.Assembly, _result.ToArray());
}
示例2: RunTests
public TestRunResults[] RunTests(TestRunInfo[] runInfos, Func<bool> abortWhen)
{
var results = new List<TestRunResults>();
// Get a list of the various nunit executables specified pr. framework version
var nUnitExes = getNUnitExes(runInfos);
foreach (var nUnitExe in nUnitExes)
{
// Get the assemblies that should be run under this nunit executable
string tests;
var assemblies = getAssembliesAndTestsForTestRunner(nUnitExe.Exe, runInfos, out tests);
if (assemblies == null)
continue;
var arguments = getExecutableArguments(nUnitExe, assemblies, tests, runInfos);
DebugLog.Debug.WriteInfo("Running tests: {0} {1}", nUnitExe.Exe, arguments);
var proc = new Process();
proc.StartInfo = new ProcessStartInfo(nUnitExe.Exe, arguments);
proc.StartInfo.RedirectStandardOutput = true;
//proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(runInfo.Assembly);
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
var parser = new NUnitTestResponseParser(_bus, TestRunner.NUnit);
var nUnitResult = getNUnitOutput(proc.StandardOutput);
parser.Parse(nUnitResult, runInfos, containsTests(arguments));
foreach (var result in parser.Result)
results.Add(result);
}
return results.ToArray();
}
示例3: Should_locate_removed_test_in_partial_test_run
public void Should_locate_removed_test_in_partial_test_run()
{
int i = 3;
var results = new TestRunResults("project1", "assembly", false, new TestResult[]
{
new TestResult(TestRunner.NUnit, TestRunStatus.Failed, "Test1"),
new TestResult(TestRunner.NUnit, TestRunStatus.Ignored, "Test2"),
new TestResult(TestRunner.NUnit, TestRunStatus.Failed, "Test3"),
new TestResult(TestRunner.NUnit, TestRunStatus.Failed, "Test4")
});
var cache = new RunResultCache();
cache.Merge(results);
var infos = new TestRunInfo[] { new TestRunInfo(new Project("project", new ProjectDocument(ProjectType.CSharp)), "assembly") };
infos[0].AddTestsToRun(new TestToRun[] { new TestToRun(TestRunner.NUnit, "Test1"), new TestToRun(TestRunner.NUnit, "Test2"), new TestToRun(TestRunner.NUnit, "Test3") });
results = new TestRunResults("project1", "assembly", true, new TestResult[]
{
new TestResult(TestRunner.NUnit, TestRunStatus.Ignored, "Test1")
});
var locator = new RemovedTestsLocator(cache);
results = locator.SetRemovedTestsAsPassed(results, infos);
results.Passed.Length.ShouldEqual(2);
results.Passed[0].Name.ShouldEqual("Test3");
results.Passed[1].Name.ShouldEqual("Test2");
}
示例4: getTestsList
private string getTestsList(TestRunInfo runInfo)
{
var tests = "";
foreach (var test in runInfo.TestsToRun)
tests += string.Format("/run:{0} ", test);
return tests;
}
示例5: RemoveUnmatchedRunInfoTests
public List<TestRunResults> RemoveUnmatchedRunInfoTests(TestRunResults[] results, TestRunInfo[] infos)
{
var tests = new List<TestItem>();
tests.AddRange(_cache.Failed);
tests.AddRange(_cache.Ignored);
var removed = new List<TestRunResults>();
infos
.Where(i => results.Count(x => i.Assembly.Equals(x.Assembly)) == 0).ToList()
.ForEach(i =>
{
tests.Where(x => x.Key.Equals(i.Assembly) &&
(!i.OnlyRunSpcifiedTestsFor(x.Value.Runner) || i.GetTestsFor(x.Value.Runner).Count(t => t.Equals(x.Value.Name)) > 0))
.GroupBy(x => x.Value.Runner).ToList()
.ForEach(x =>
{
removed.Add(new TestRunResults(
i.Project.Key,
i.Assembly,
i.OnlyRunSpcifiedTestsFor(TestRunner.Any),
x.Key,
x.Select(t => new TestResult(
t.Value.Runner,
TestRunStatus.Passed,
t.Value.Name,
t.Value.Message,
t.Value.StackTrace,
t.Value.TimeSpent.TotalMilliseconds).SetDisplayName(t.Value.DisplayName)).ToArray()));
});
});
return removed;
}
示例6: getResults
private TestRunResults[] getResults(IEnumerable<AutoTest.TestRunners.Shared.Results.TestResult> tests, TestRunInfo[] runInfos)
{
var results = new List<TestRunResults>();
foreach (var byRunner in tests.GroupBy(x => x.Runner))
{
var runner = TestRunnerConverter.FromString(byRunner.Key);
foreach (var byAssembly in byRunner.GroupBy(x => x.Assembly))
{
var info = runInfos.Where(x => x.Assembly.Equals(byAssembly.Key)).FirstOrDefault();
var project = "";
var partial = false;
if (info != null)
{
if (info.Project != null)
project = info.Project.Key;
partial = info.OnlyRunSpcifiedTestsFor(runner) ||
info.GetTestsFor(runner).Count() > 0 ||
info.GetMembersFor(runner).Count() > 0 ||
info.GetNamespacesFor(runner).Count() > 0;
}
DebugLog.Debug.WriteDetail(string.Format("Partial run is {0} for runner {1}", partial, runner));
var result = new TestRunResults(
project,
byAssembly.Key,
partial,
runner,
byAssembly.Select(x => ConvertResult(x)).ToArray());
result.SetTimeSpent(TimeSpan.FromMilliseconds(byAssembly.Sum(x => x.DurationInMilliseconds)));
results.Add(result);
}
}
return results.ToArray();
}
示例7: Should_build_the_command_line_for_each_run
public void Should_build_the_command_line_for_each_run()
{
_configuration
.Stub(x => x.MSpecTestRunner("framework 1"))
.Return("c:\\runner 1.exe");
_configuration
.Stub(x => x.MSpecTestRunner("framework 2"))
.Return("c:\\runner 2.exe");
_fileSystem
.Stub(x => x.FileExists(null))
.IgnoreArguments()
.Return(true);
var document1 = new ProjectDocument(ProjectType.CSharp);
document1.SetFramework("framework 1");
var info1 = new TestRunInfo(new Project("key 1", document1), "assembly 1");
var document2 = new ProjectDocument(ProjectType.CSharp);
document2.SetFramework("framework 2");
var info2 = new TestRunInfo(new Project("key 2", document2), "assembly 2");
var testRunInfos = new[] { info1, info2 };
_runner.RunTests(testRunInfos, null);
_commandLineBuilder.AssertWasCalled(x => x.Build(null),
o => o.IgnoreArguments().Repeat.Twice());
}
示例8: Should_not_remove_tests_from_different_runners
public void Should_not_remove_tests_from_different_runners()
{
var cache = new RunResultCache();
cache.EnabledDeltas();
var results = new TestRunResults("project", "assembly", false, TestRunner.NUnit, new TestResult[]
{
new TestResult(TestRunner.NUnit, TestRunStatus.Failed, "Test1"),
});
cache.Merge(results);
var mah = cache.PopDeltas();
mah.AddedTests.Length.ShouldEqual(1);
var infos = new TestRunInfo[] { new TestRunInfo(new Project("project", new ProjectDocument(ProjectType.CSharp)), "assembly") };
results = new TestRunResults("project", "assembly", false, TestRunner.XUnit, new TestResult[]
{
new TestResult(TestRunner.XUnit, TestRunStatus.Failed, "Test1"),
});
var locator = new RemovedTestsLocator(cache);
results = locator.SetRemovedTestsAsPassed(results, infos);
cache.Merge(results);
results.Passed.Length.ShouldEqual(0);
var meh = cache.PopDeltas();
meh.RemovedTests.Length.ShouldEqual(0);
}
示例9: RunTests
public TestRunResults[] RunTests(TestRunInfo[] runInfos)
{
var options = generateOptions(runInfos);
if (options == null)
return new TestRunResults[] { };
var runner = new TestRunProcess(new AutoTestRunnerFeedback());
var tests = runner.ProcessTestRuns(options);
return getResults(tests, runInfos).ToArray();
}
示例10: SetUp
public void SetUp()
{
var bus = MockRepository.GenerateMock<IMessageBus>();
_parser = new NUnitTestResponseParser(bus, TestRunner.NUnit);
var sources = new TestRunInfo[]
{
new TestRunInfo(new Project("project1", null), "/SomePath/AutoTest.WinForms.Test/bin/Debug/AutoTest.WinForms.Test.dll")
};
_parser.Parse(File.ReadAllText("TestResources/NUnit/singleAssembly.txt"), sources, true);
}
示例11: SetUp
public void SetUp()
{
var bus = MockRepository.GenerateMock<IMessageBus>();
_parser = new NUnitTestResponseParser(bus);
var sources = new TestRunInfo[]
{
new TestRunInfo(new Project("project1", null), string.Format("/home/ack/backup/WorkWin7/src/DotNET/Temp/SomeProjectUsingXUnit/bin/Debug/SomeProjectUsingXUnit.dll", Path.DirectorySeparatorChar))
};
_parser.Parse(File.ReadAllText("TestResources/NUnit/XUnitOutput.txt"), sources);
}
示例12: SetUp
public void SetUp()
{
var bus = MockRepository.GenerateMock<IMessageBus>();
_parser = new NUnitTestResponseParser(bus, TestRunner.NUnit);
var sources = new TestRunInfo[]
{
new TestRunInfo(new Project("project1", null), "/home/ack/src/AutoTest.Net/src/AutoTest.TestCore/bin/Debug/AutoTest.TestCore.dll"),
new TestRunInfo(new Project("project2", null), "/home/ack/src/AutoTest.Net/src/AutoTest.Test/bin/Debug/AutoTest.Test.dll"),
new TestRunInfo(new Project("project3", null), "/home/ack/src/AutoTest.Net/src/AutoTest.WinForms.Test/bin/Debug/AutoTest.WinForms.Test.dll")
};
_parser.Parse(File.ReadAllText("TestResources/NUnit/NewOutput.txt"), sources, false);
}
示例13: SetRemovedTestsAsPassed
public TestRunResults SetRemovedTestsAsPassed(TestRunResults results, TestRunInfo[] infos)
{
_results = results;
_infos = infos;
var tests = new List<TestResult>();
tests.AddRange(results.All);
tests.AddRange(getTests(_cache.Failed));
tests.AddRange(getTests(_cache.Ignored));
var modified = new TestRunResults(_results.Project, _results.Assembly, _results.IsPartialTestRun, _results.Runner, tests.ToArray());
modified.SetTimeSpent(_results.TimeSpent);
return modified;
}
示例14: Should_report_the_time_info
public void Should_report_the_time_info()
{
var document = new ProjectDocument(ProjectType.CSharp);
document.SetFramework("framework 1");
var info = new TestRunInfo(new Project("key 1", document), "assembly 1");
var infos = new[] { info };
var run = new MSpecTestRunner.Run { RunInfos = infos };
var args = _builder.Build(run);
Assert.That(args, Is.StringContaining("--timeinfo"));
}
示例15: getNUnitExes
private string[] getNUnitExes(TestRunInfo[] runInfos)
{
var testRunnerExes = new List<string>();
foreach (var runInfo in runInfos)
{
var unitTestExe = _configuration.NunitTestRunner(getFramework(runInfo));
if (File.Exists(unitTestExe))
{
if (!testRunnerExes.Exists(x => x.Equals(unitTestExe)))
testRunnerExes.Add(unitTestExe);
}
}
return testRunnerExes.ToArray();
}