本文整理汇总了C#中IFrameworkHandle类的典型用法代码示例。如果您正苦于以下问题:C# IFrameworkHandle类的具体用法?C# IFrameworkHandle怎么用?C# IFrameworkHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFrameworkHandle类属于命名空间,在下文中一共展示了IFrameworkHandle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RunTests
// NOTE: an earlier version of this code had a FilterBuilder
// property. This seemed to make sense, because we instantiate
// it in two different places. However, the existence of an
// NUnitTestFilterBuilder, containing a reference to an engine
// service caused our second-level tests of the test executor
// to throw an exception. So if you consider doing this, beware!
#endregion
#region ITestExecutor Implementation
/// <summary>
/// Called by the Visual Studio IDE to run all tests. Also called by TFS Build
/// to run either all or selected tests. In the latter case, a filter is provided
/// as part of the run context.
/// </summary>
/// <param name="sources">Sources to be run.</param>
/// <param name="runContext">Context to use when executing the tests.</param>
/// <param name="frameworkHandle">Test log to send results and messages through</param>
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
#if LAUNCHDEBUGGER
if (!Debugger.IsAttached)
Debugger.Launch();
#endif
Initialize(runContext, frameworkHandle);
try
{
foreach (var source in sources)
{
var assemblyName = source;
if (!Path.IsPathRooted(assemblyName))
assemblyName = Path.Combine(Environment.CurrentDirectory, assemblyName);
TestLog.Info("Running all tests in " + assemblyName);
RunAssembly(assemblyName, TestFilter.Empty);
}
}
catch (Exception ex)
{
if (ex is TargetInvocationException)
ex = ex.InnerException;
TestLog.Error("Exception thrown executing tests", ex);
}
finally
{
TestLog.Info(string.Format("NUnit Adapter {0}: Test execution complete", AdapterVersion));
Unload();
}
}
开发者ID:MSK61,项目名称:nunit3-vs-adapter,代码行数:53,代码来源:NUnit3TestExecutor.cs
示例2: RunTests
/// <summary>
/// Runs the tests.
/// </summary>
/// <param name="tests">Which tests should be run.</param>
/// <param name="context">Context in which to run tests.</param>
/// <param param name="framework">Where results should be stored.</param>
public void RunTests(IEnumerable<TestCase> tests, IRunContext context, IFrameworkHandle framework)
{
_state = ExecutorState.Running;
foreach (var test in tests)
{
if (_state == ExecutorState.Cancelling)
{
_state = ExecutorState.Cancelled;
return;
}
try
{
var reportDocument = RunOrDebugCatchTest(test.Source, test.FullyQualifiedName, context, framework);
var result = GetTestResultFromReport(test, reportDocument, framework);
framework.RecordResult(result);
}
catch (Exception ex)
{
// Log it and move on. It will show up to the user as a test that hasn't been run.
framework.SendMessage(TestMessageLevel.Error, "Exception occured when processing test case: " + test.FullyQualifiedName);
framework.SendMessage(TestMessageLevel.Informational, "Message: " + ex.Message + "\nStacktrace:" + ex.StackTrace);
}
}
}
开发者ID:mrpi,项目名称:CatchVsTestAdapter,代码行数:32,代码来源:CatchTestExecutor.cs
示例3: RunTests
public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
this.frameworkHandle = frameworkHandle;
var testLogger = new TestLogger(frameworkHandle);
testLogger.SendMainMessage("Execution started");
foreach (var group in tests.GroupBy(t => t.Source))
{
testLogger.SendInformationalMessage(String.Format("Running selected: '{0}'", group.Key));
try
{
using (var sandbox = new Sandbox<Executor>(group.Key))
{
var assemblyDirectory = new DirectoryInfo(Path.GetDirectoryName(group.Key));
Directory.SetCurrentDirectory(assemblyDirectory.FullName);
sandbox.Content.Execute(this, group.Select(t => t.FullyQualifiedName).ToArray());
}
}
catch (Exception ex)
{
testLogger.SendErrorMessage(ex, String.Format("Exception found while executing tests in group '{0}'", group.Key));
// just go on with the next
}
}
testLogger.SendMainMessage("Execution finished");
}
开发者ID:laynor,项目名称:NSpecTestAdapter,代码行数:31,代码来源:NSpecExecutor.cs
示例4: RunTests
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
//Debugger.Launch();
frameworkHandle.SendMessage(TestMessageLevel.Informational, Strings.EXECUTOR_STARTING);
Settings settings = GetSettings(runContext);
foreach (string currentAsssembly in sources.Distinct())
{
try
{
if (!File.Exists(Path.Combine(Path.GetDirectoryName(Path.GetFullPath(currentAsssembly)),"Machine.Specifications.dll")))
{
frameworkHandle.SendMessage(TestMessageLevel.Informational, String.Format("Machine.Specifications.dll not found for {0}", currentAsssembly));
continue;
}
frameworkHandle.SendMessage(TestMessageLevel.Informational, String.Format(Strings.EXECUTOR_EXECUTINGIN, currentAsssembly));
this.executor.RunAssembly(currentAsssembly, settings, uri, frameworkHandle);
}
catch (Exception ex)
{
frameworkHandle.SendMessage(TestMessageLevel.Error, String.Format(Strings.EXECUTOR_ERROR, currentAsssembly, ex.Message));
}
}
frameworkHandle.SendMessage(TestMessageLevel.Informational, String.Format("Complete on {0} assemblies ", sources.Count()));
}
开发者ID:machine-visualstudio,项目名称:machine.vstestadapter,代码行数:31,代码来源:MspecTestAdapterExecutor.cs
示例5: RunTests
public void RunTests(IEnumerable<string> sources, IRunContext runContext,
IFrameworkHandle frameworkHandle)
{
SetupExecutionPolicy();
IEnumerable<TestCase> tests = PowerShellTestDiscoverer.GetTests(sources, null);
RunTests(tests, runContext, frameworkHandle);
}
开发者ID:vairam-svs,项目名称:poshtools,代码行数:7,代码来源:PowerShellTestExecutor.cs
示例6: RunTests
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
Guard.ArgumentNotNull("sources", sources);
Guard.ArgumentNotNull("runContext", runContext);
Guard.ArgumentNotNull("frameworkHandle", frameworkHandle);
var cleanupList = new List<ExecutorWrapper>();
try
{
RemotingUtility.CleanUpRegisteredChannels();
cancelled = false;
foreach (string source in sources)
if (VsTestRunner.IsXunitTestAssembly(source))
RunTestsInAssembly(cleanupList, source, frameworkHandle);
}
finally
{
Thread.Sleep(1000);
foreach (var executorWrapper in cleanupList)
executorWrapper.Dispose();
}
}
开发者ID:johnkg,项目名称:xunit,代码行数:26,代码来源:VsTestRunner.cs
示例7: RunTests
/// <summary>
/// Called by the Visual Studio IDE to run all tests. Also called by TFS Build
/// to run either all or selected tests. In the latter case, a filter is provided
/// as part of the run context.
/// </summary>
/// <param name="sources">Sources to be run.</param>
/// <param name="runContext">Context to use when executing the tests.</param>
/// <param name="frameworkHandle">Test log to send results and messages through</param>
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
testLog.Initialize(frameworkHandle);
Info("executing tests", "started");
try
{
// Ensure any channels registered by other adapters are unregistered
CleanUpRegisteredChannels();
var tfsfilter = new TFSTestFilter(runContext);
testLog.SendDebugMessage("Keepalive:" + runContext.KeepAlive);
if (!tfsfilter.HasTfsFilterValue && runContext.KeepAlive)
frameworkHandle.EnableShutdownAfterTestRun = true;
foreach (var source in sources)
{
using (currentRunner = new AssemblyRunner(testLog, source, tfsfilter))
{
currentRunner.RunAssembly(frameworkHandle);
}
currentRunner = null;
}
}
catch (Exception ex)
{
testLog.SendErrorMessage("Exception " + ex);
}
finally
{
Info("executing tests", "finished");
}
}
开发者ID:rprouse,项目名称:nunit-vs-adapter,代码行数:42,代码来源:NUnitTestExecutor.cs
示例8: RunTests
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
IMessageLogger log = frameworkHandle;
log.Version();
HandlePoorVisualStudioImplementationDetails(runContext, frameworkHandle);
foreach (var assemblyPath in sources)
{
try
{
if (AssemblyDirectoryContainsFixie(assemblyPath))
{
log.Info("Processing " + assemblyPath);
var listener = new VisualStudioListener(frameworkHandle, assemblyPath);
using (var environment = new ExecutionEnvironment(assemblyPath))
{
environment.RunAssembly(new Options(), listener);
}
}
else
{
log.Info("Skipping " + assemblyPath + " because it is not a test assembly.");
}
}
catch (Exception exception)
{
log.Error(exception);
}
}
}
开发者ID:scichelli,项目名称:fixie,代码行数:34,代码来源:VsTestExecutor.cs
示例9: RunTests
public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
frameworkHandle.SendMessage(TestMessageLevel.Informational, Strings.EXECUTOR_STARTING);
int executedSpecCount = 0;
string currentAsssembly = string.Empty;
try
{
ISpecificationExecutor specificationExecutor = this.adapterFactory.CreateExecutor();
IEnumerable<IGrouping<string, TestCase>> groupBySource = tests.GroupBy(x => x.Source);
foreach (IGrouping<string, TestCase> grouping in groupBySource)
{
currentAsssembly = grouping.Key;
frameworkHandle.SendMessage(TestMessageLevel.Informational, string.Format(Strings.EXECUTOR_EXECUTINGIN, currentAsssembly));
specificationExecutor.RunAssemblySpecifications(currentAsssembly, MSpecTestAdapter.uri, runContext, frameworkHandle, grouping);
executedSpecCount += grouping.Count();
}
frameworkHandle.SendMessage(TestMessageLevel.Informational, String.Format(Strings.EXECUTOR_COMPLETE, executedSpecCount, groupBySource.Count()));
}
catch (Exception ex)
{
frameworkHandle.SendMessage(TestMessageLevel.Error, string.Format(Strings.EXECUTOR_ERROR, currentAsssembly, ex.Message));
}
finally
{
}
}
开发者ID:ivanz,项目名称:machine.vstestadapter,代码行数:27,代码来源:MspecTestAdapterExecutor.cs
示例10: RunTests
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
ChutzpahTracer.TraceInformation("Begin Test Adapter Run Tests");
var settingsProvider = runContext.RunSettings.GetSettings(AdapterConstants.SettingsName) as ChutzpahAdapterSettingsProvider;
var settings = settingsProvider != null ? settingsProvider.Settings : new ChutzpahAdapterSettings();
ChutzpahTracingHelper.Toggle(settings.EnabledTracing);
var testOptions = new TestOptions
{
TestLaunchMode =
runContext.IsBeingDebugged ? TestLaunchMode.Custom:
settings.OpenInBrowser ? TestLaunchMode.FullBrowser:
TestLaunchMode.HeadlessBrowser,
CustomTestLauncher = runContext.IsBeingDebugged ? new VsDebuggerTestLauncher() : null,
MaxDegreeOfParallelism = runContext.IsBeingDebugged ? 1 : settings.MaxDegreeOfParallelism,
ChutzpahSettingsFileEnvironments = new ChutzpahSettingsFileEnvironments(settings.ChutzpahSettingsFileEnvironments)
};
testOptions.CoverageOptions.Enabled = runContext.IsDataCollectionEnabled;
var callback = new ParallelRunnerCallbackAdapter(new ExecutionCallback(frameworkHandle, runContext));
testRunner.RunTests(sources, testOptions, callback);
ChutzpahTracer.TraceInformation("End Test Adapter Run Tests");
}
开发者ID:squadwuschel,项目名称:chutzpah,代码行数:28,代码来源:ChutzpahTestExecutor.cs
示例11: RunTests
/// <summary>
/// Runs the tests.
/// </summary>
/// <param name="tests">Tests to be run.</param>
/// <param name="runContext">Context to use when executing the tests.</param>
/// <param param name="frameworkHandle">Handle to the framework to record results and to do framework operations.</param>
public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
m_cancelled = false;
try
{
foreach (TestCase test in tests)
{
if (m_cancelled)
{
break;
}
frameworkHandle.RecordStart(test);
frameworkHandle.SendMessage(TestMessageLevel.Informational, "Starting external test for " + test.DisplayName);
var testOutcome = RunExternalTest(test, runContext, frameworkHandle, test);
frameworkHandle.RecordResult(testOutcome);
frameworkHandle.SendMessage(TestMessageLevel.Informational, "Test result:" + testOutcome.Outcome.ToString());
}
}
catch(Exception e)
{
frameworkHandle.SendMessage(TestMessageLevel.Error, "Exception during test execution: " +e.Message);
}
}
开发者ID:XpiritBV,项目名称:ProtractorAdapter,代码行数:31,代码来源:ProtractorTestExecutor.cs
示例12: RunTests
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
List<TestCase> tests = new List<TestCase>();
TestDiscoverer.VisitTests(sources, t => tests.Add(t));
InternalRunTests(tests, runContext, frameworkHandle, null);
}
开发者ID:edwardt,项目名称:DreamNJasmine,代码行数:8,代码来源:TestExecutor.cs
示例13: RunTests
private void RunTests(string source, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
foreach (var result in ExternalTestExecutor.GetTestResults(source, null).Select(c => CreateTestResult(source, c)))
{
frameworkHandle.RecordStart(result.TestCase);
frameworkHandle.RecordResult(result);
frameworkHandle.RecordEnd(result.TestCase, result.Outcome);
}
}
开发者ID:fazueu,项目名称:TestAdapters,代码行数:9,代码来源:TestExecutor.cs
示例14: Debug
public virtual void Debug(BoostTestRunnerCommandLineArgs args, BoostTestRunnerSettings settings, IFrameworkHandle framework)
{
Utility.Code.Require(settings, "settings");
using (Process process = Debug(framework, GetStartInfo(args, settings)))
{
MonitorProcess(process, settings.Timeout);
}
}
开发者ID:stimm81,项目名称:vs-boost-unit-test-adapter,代码行数:9,代码来源:BoostTestRunnerBase.cs
示例15: RunTests
public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle) {
ValidateArg.NotNull(tests, "tests");
ValidateArg.NotNull(runContext, "runContext");
ValidateArg.NotNull(frameworkHandle, "frameworkHandle");
_cancelRequested.Reset();
RunTestCases(tests, runContext, frameworkHandle);
}
开发者ID:omnimark,项目名称:PTVS,代码行数:9,代码来源:TestExecutor.cs
示例16: RunTests
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
RunTests(sources.Select(x => new TestCase(x, ExecutorDetails.Uri, x)
{
CodeFilePath = x,
LineNumber = 2,
DisplayName = "Abra cadabra"
}), runContext, frameworkHandle);
}
开发者ID:yanivru,项目名称:Dharma,代码行数:9,代码来源:TaskExecutor.cs
示例17: RunTests
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
var validSources = from source in sources
where source.EndsWith(StringHelper.GetSearchExpression(), StringComparison.CurrentCultureIgnoreCase)
select source;
foreach (var source in validSources) {
RunTest(frameworkHandle, source);
}
}
开发者ID:alexfalkowski,项目名称:System.Spec,代码行数:10,代码来源:DefaultTestExecutor.cs
示例18: RunTests
private void RunTests(IRunContext runContext, IFrameworkHandle testExecutionRecorder)
{
if (runContext.InIsolation)
launcher.TestProject.TestRunnerFactoryName = StandardTestRunnerFactoryNames.IsolatedAppDomain;
var extension = new VSTestWindowExtension(testExecutionRecorder, testCaseFactory, testResultFactory);
launcher.TestProject.AddTestRunnerExtension(extension);
launcher.Run();
}
开发者ID:Gallio,项目名称:Gallio-VS2011-Integration,代码行数:10,代码来源:TestRunner.cs
示例19: TestGeneratorAdapterTests
public TestGeneratorAdapterTests()
{
testGeneratorDiscoverer = Substitute.For<ITestGeneratorDiscoverer>();
discoveryContext = Substitute.For<IDiscoveryContext>();
discoverySink = Substitute.For<ITestCaseDiscoverySink>();
logger = Substitute.For<IMessageLogger>();
frameworkHandle = Substitute.For<IFrameworkHandle>();
runContext = Substitute.For<IRunContext>();
testGenerator = Substitute.For<ITestGenerator>();
}
开发者ID:allansson,项目名称:brute,代码行数:10,代码来源:TestGeneratorAdapterTests.cs
示例20: RunAssembly
public void RunAssembly(string source, Settings settings, Uri executorUri, IFrameworkHandle frameworkHandle)
{
source = Path.GetFullPath(source);
using (var scope = new IsolatedAppDomainExecutionScope<AppDomainExecutor>(source)) {
VSProxyAssemblySpecificationRunListener listener = new VSProxyAssemblySpecificationRunListener(source, frameworkHandle, executorUri, settings);
AppDomainExecutor executor = scope.CreateInstance();
executor.RunAllTestsInAssembly(source, listener);
}
}
开发者ID:machine-visualstudio,项目名称:machine.vstestadapter,代码行数:11,代码来源:SpecificationExecutor.cs
注:本文中的IFrameworkHandle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论