本文整理汇总了C#中TestRunner.Load方法的典型用法代码示例。如果您正苦于以下问题:C# TestRunner.Load方法的具体用法?C# TestRunner.Load怎么用?C# TestRunner.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestRunner
的用法示例。
在下文中一共展示了TestRunner.Load方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load1000TestsInTestDomain
public void Load1000TestsInTestDomain()
{
runner = new TestDomain();
int start = Environment.TickCount;
Assert.IsTrue(runner.Load(new TestPackage("loadtest-assembly.dll")));
ITest test = runner.Test;
Assert.AreEqual(1000, test.TestCount);
int ms = Environment.TickCount - start;
Assert.LessOrEqual(ms, 4000);
}
示例2: Load1000TestsInSameDomain
public void Load1000TestsInSameDomain()
{
runner = new SimpleTestRunner();
int start = Environment.TickCount;
Assert.IsTrue(runner.Load(new TestPackage("loadtest-assembly.dll")));
ITest test = runner.Test;
Assert.AreEqual(2050, test.TestCount);
int ms = Environment.TickCount - start;
Console.WriteLine("Loaded in {0}ms", ms);
Assert.LessOrEqual(ms, 4000);
}
示例3: runTests
private IEnumerable<Shared.Results.TestResult> runTests(Options options, TestPackage package, TestRunner testRunner)
{
testRunner.Load(package);
if (testRunner.Test == null)
{
testRunner.Unload();
return new[] { ErrorHandler.GetError("NUnit", "Unable to locate fixture") };
}
var harvester = new TestHarvester(_channel);
var testFilter = getTestFilter(options);
string savedDirectory = Environment.CurrentDirectory;
var result = run(testRunner, harvester, testFilter, savedDirectory);
if (result != null)
return harvester.Results;
return harvester.Results;
}
示例4: LoadAndRunTestAssembly
protected void LoadAndRunTestAssembly( fit.Parse cell, string testAssembly )
{
testRunner = new TestDomain();
if ( !testRunner.Load( new TestPackage(testAssembly) ) )
{
this.wrong(cell);
cell.addToBody( string.Format(
"<font size=-1 color=\"#c08080\"> <i>Failed to load {0}</i></font>", testAssembly ) );
return;
}
testResult = testRunner.Run(NullListener.NULL);
testSummary = new ResultSummarizer( testResult );
this.right( cell );
}
示例5: OnEnable
public void OnEnable()
{
passedTexture = (Texture)AssetDatabase.LoadAssetAtPath("Assets/Plugins/Editor/UniTest/Textures/RunState-Passed.psd", typeof(Texture));
pendingTexture = (Texture)AssetDatabase.LoadAssetAtPath("Assets/Plugins/Editor/UniTest/Textures/RunState-Pending.psd", typeof(Texture));
failedTexture = (Texture)AssetDatabase.LoadAssetAtPath("Assets/Plugins/Editor/UniTest/Textures/RunState-Failed.psd", typeof(Texture));
notRunTexture = (Texture)AssetDatabase.LoadAssetAtPath("Assets/Plugins/Editor/UniTest/Textures/RunState-NotRun.psd", typeof(Texture));
ServiceManager.Services.ClearServices();
ServiceManager.Services.AddService(new DomainManager());
ServiceManager.Services.AddService(new RecentFilesService());
ServiceManager.Services.AddService(new ProjectService());
ServiceManager.Services.AddService(new TestLoader(new GuiTestEventDispatcher()));
ServiceManager.Services.AddService(new AddinRegistry());
ServiceManager.Services.AddService(new AddinManager());
ServiceManager.Services.AddService(new TestAgency());
ServiceManager.Services.InitializeServices();
Services.UserSettings.SaveSetting("Options.TestLoader.ReloadOnChange", true);
loader = Services.TestLoader;
loader.Events.ProjectLoadFailed += (path, e) => {
Debug.Log(e);
Debug.Log(e.Exception.Message);
Debug.Log(e.Exception.StackTrace);
};
var assembly = System.Reflection.Assembly.GetAssembly(typeof(UniTestEditorRunner));
loader.Events.TestLoadFailed += (file, exception) => {
Debug.Log(file);
Debug.Log(exception);
Debug.Log(exception.Exception.Message);
Debug.Log(exception.Exception.StackTrace);
};
loader.LoadProject(assembly.Location);
var factory = new InProcessTestRunnerFactory();
var package = new TestPackage(assembly.Location);
package.Settings["DomainUsage"] = DomainUsage.None;
testRunner = factory.MakeTestRunner(package);
testRunner.Load(package);
suite = BuildTestSuiteHierarchy(testRunner.Test);
}
示例6: ReloadTest
/// <summary>
/// Reload the current test on command
/// </summary>
public void ReloadTest(RuntimeFramework framework)
{
log.Info("Reloading tests for " + Path.GetFileName(TestFileName));
try
{
events.FireTestReloading( TestFileName );
TestPackage package = MakeTestPackage(loadedTestName);
if (framework != null)
package.Settings["RuntimeFramework"] = framework;
testRunner.Unload();
testRunner = TestRunnerFactory.MakeTestRunner(package);
if (testRunner.Load(package))
this.currentFramework = package.Settings.Contains("RuntimeFramework")
? package.Settings["RuntimeFramework"] as RuntimeFramework
: RuntimeFramework.CurrentFramework;
loadedTest = testRunner.Test;
reloadPending = false;
testProject.HasChangesRequiringReload = false;
events.FireTestReloaded(TestFileName, loadedTest);
log.Info("Reload complete");
}
catch( Exception exception )
{
log.Error("Reload failed", exception);
lastException = exception;
events.FireTestReloadFailed( TestFileName, exception );
}
}
示例7: LoadTest
public void LoadTest( string testName )
{
log.Info("Loading tests for " + Path.GetFileName(TestFileName));
long startTime = DateTime.Now.Ticks;
try
{
events.FireTestLoading( TestFileName );
TestPackage package = MakeTestPackage(testName);
testRunner = TestRunnerFactory.MakeTestRunner(package);
bool loaded = testRunner.Load(package);
loadedTest = testRunner.Test;
loadedTestName = testName;
testResult = null;
reloadPending = false;
if ( Services.UserSettings.GetSetting( "Options.TestLoader.ReloadOnChange", true ) )
InstallWatcher( );
if (loaded)
{
this.currentFramework = package.Settings.Contains("RuntimeFramework")
? package.Settings["RuntimeFramework"] as RuntimeFramework
: RuntimeFramework.CurrentFramework;
testProject.HasChangesRequiringReload = false;
events.FireTestLoaded(TestFileName, loadedTest);
}
else
{
lastException = new ApplicationException(string.Format("Unable to find test {0} in assembly", testName));
events.FireTestLoadFailed(TestFileName, lastException);
}
}
catch( FileNotFoundException exception )
{
log.Error("File not found", exception);
lastException = exception;
foreach( string assembly in TestProject.ActiveConfig.Assemblies )
{
if ( Path.GetFileNameWithoutExtension( assembly ) == exception.FileName &&
!PathUtils.SamePathOrUnder( testProject.ActiveConfig.BasePath, assembly ) )
{
lastException = new ApplicationException( string.Format( "Unable to load {0} because it is not located under the AppBase", exception.FileName ), exception );
break;
}
}
events.FireTestLoadFailed( TestFileName, lastException );
double loadTime = (double)(DateTime.Now.Ticks - startTime) / (double)TimeSpan.TicksPerSecond;
log.Info("Load completed in {0} seconds", loadTime);
}
catch( Exception exception )
{
log.Error("Failed to load test", exception);
lastException = exception;
events.FireTestLoadFailed( TestFileName, exception );
}
}
示例8: RunPartition
private TestResult RunPartition(bool redirectOutput, bool redirectError, TestPackage package, TextWriter outWriter, TextWriter errorWriter, TestFilter testFilter, TestRunner testRunner, EventListener collector)
{
TestResult result;
try
{
testRunner.Load(package);
result = RunPartition(redirectOutput, redirectError, testRunner, outWriter, errorWriter, testFilter, collector);
}
finally
{
var disp = testRunner as IDisposable;
if (disp != null)
disp.Dispose();
}
return result;
}
示例9: LoadTest
public void LoadTest( string testName )
{
long startTime = DateTime.Now.Ticks;
try
{
events.FireTestLoading( TestFileName );
testRunner = CreateRunner();
bool loaded = testRunner.Load( MakeTestPackage( testName ) );
loadedTest = testRunner.Test;
loadedTestName = testName;
testResult = null;
reloadPending = false;
if ( ReloadOnChange )
InstallWatcher( );
if ( loaded )
events.FireTestLoaded( TestFileName, loadedTest );
else
{
lastException = new ApplicationException( string.Format ( "Unable to find test {0} in assembly", testName ) );
events.FireTestLoadFailed( TestFileName, lastException );
}
}
catch( FileNotFoundException exception )
{
lastException = exception;
foreach( string assembly in TestProject.ActiveConfig.Assemblies )
{
if ( Path.GetFileNameWithoutExtension( assembly ) == exception.FileName &&
!PathUtils.SamePathOrUnder( testProject.ActiveConfig.BasePath, assembly ) )
{
lastException = new ApplicationException( string.Format( "Unable to load {0} because it is not located under the AppBase", exception.FileName ), exception );
break;
}
}
events.FireTestLoadFailed( TestFileName, lastException );
}
catch( Exception exception )
{
lastException = exception;
events.FireTestLoadFailed( TestFileName, exception );
}
double loadTime = (double)(DateTime.Now.Ticks - startTime) / (double)TimeSpan.TicksPerSecond;
System.Diagnostics.Trace.WriteLine(string.Format("TestLoader: Loaded in {0} seconds", loadTime));
}
示例10: MakeTest
private bool MakeTest(TestRunner runner, string assemblyName, bool bShadowCopyCache)
{
TestPackage package = new TestPackage(assemblyName);
package.Settings.Add( "ShadowCopyFiles", bShadowCopyCache );
return runner.Load(package);
}
示例11: MakeTest
private bool MakeTest(
TestRunner runner,
string assemblyName,
bool bShadowCopyCache)
{
log.Debug("Entering MakeTest");
TestPackage package = new TestPackage(
Path.GetFullPath(assemblyName));
package.Settings["ShadowCopyFiles"] = bShadowCopyCache;
return runner.Load(package);
}
示例12: LoadTest
public void LoadTest( string testName )
{
try
{
events.FireTestLoading( TestFileName );
testRunner = CreateRunner();
bool loaded = testRunner.Load( MakeTestPackage( testName ) );
loadedTest = testRunner.Test;
loadedTestName = testName;
testResult = null;
reloadPending = false;
if ( ReloadOnChange )
InstallWatcher( );
if ( loaded )
events.FireTestLoaded( TestFileName, loadedTest );
else
{
lastException = new ApplicationException( string.Format ( "Unable to find test {0} in assembly", testName ) );
events.FireTestLoadFailed( TestFileName, lastException );
}
}
catch( FileNotFoundException exception )
{
lastException = exception;
foreach( string assembly in TestProject.ActiveConfig.Assemblies )
{
if ( Path.GetFileNameWithoutExtension( assembly ) == exception.FileName &&
!PathUtils.SamePathOrUnder( testProject.ActiveConfig.BasePath, assembly ) )
{
lastException = new ApplicationException( string.Format( "Unable to load {0} because it is not located under the AppBase", exception.FileName ), exception );
break;
}
}
events.FireTestLoadFailed( TestFileName, lastException );
}
catch( Exception exception )
{
lastException = exception;
events.FireTestLoadFailed( TestFileName, exception );
}
}
示例13: MakeTest
private bool MakeTest(
TestRunner runner,
string assemblyName,
bool bShadowCopyCache)
{
mLog.Debug("Entering MakeTest");
TestPackage package = new TestPackage(assemblyName);
//package.Settings.SShadowCopyCache = bShadowCopyCache;
return runner.Load(package);
}