本文整理汇总了C#中TestRunner.Run方法的典型用法代码示例。如果您正苦于以下问题:C# TestRunner.Run方法的具体用法?C# TestRunner.Run怎么用?C# TestRunner.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestRunner
的用法示例。
在下文中一共展示了TestRunner.Run方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static int Main(string[] args)
{
// parse the command line
CommandLineArguments cmdLine = CommandLineParser.Parse(new string[] {}, args);
if(cmdLine.GetArguments().Length != 1)
{
Usage();
return FAIL_CODE;
}
string testFile = cmdLine.GetArguments()[0];
// parse the test file
TestGroup[] groups = null;
try
{
XmlDocument doc = new XmlDocument();
doc.Load(testFile);
// Load up the algorithm tables
Hashtable algorithms = ParseAlgorithms((XmlElement)doc.GetElementsByTagName("HashFunctions")[0]);
// Load the test cases
groups = ParseTestCases((XmlElement)doc.GetElementsByTagName("Tests")[0], algorithms);
}
catch(Exception e)
{
Console.Error.WriteLine("Error parsing input file : " + e.Message);
return FAIL_CODE;
}
// setup the tests
TestRunner runner = new TestRunner(groups, new ILogger[] { new ConsoleLogger(), new XmlLogger()});
return runner.Run("HashDriver") ? PASS_CODE : FAIL_CODE;
}
示例2: testCanRunTestAndReportResults
public void testCanRunTestAndReportResults()
{
TestRunner runner = new TestRunner();
runner.AddListener(this);
runner.Run(new DummyTestSuite("SNSFSES"));
Assert.That(tests, Is.EqualTo(7), "tests");
Assert.That(errors, Is.EqualTo(1), "errors");
Assert.That(failures, Is.EqualTo(1), "failures");
Assert.That(notrun, Is.EqualTo(0), "notrun");
}
示例3: Main
private static void Main()
{
var runner = new TestRunner();
runner.TestsAssembly = Assembly.GetExecutingAssembly();
runner.Run();
Application.SetCompatibleTextRenderingDefault(false);
printDemoMemberInfo();
MyConsole aConsole = new MyConsole();
aConsole.run();
}
示例4: Main
public static void Main(string[] args)
{
var options = new Options();
if(!Parser.Default.ParseArguments(args, options))
{
Console.Error.WriteLine("Unsupported options provided.");
return;
}
if(options.Id == null)
{
options.Id = typeof(Serializer).Assembly.GetName().Version.ToString();
}
Console.WriteLine("==========================");
Console.WriteLine("Migrant performance tester");
Console.WriteLine("==========================");
Console.WriteLine("");
foreach(SerializerType serializerType in Enum.GetValues(typeof(SerializerType)))
{
Console.WriteLine("----------------");
Console.WriteLine("Serializer type: {0}", serializerType);
Console.WriteLine("----------------");
Console.WriteLine("");
foreach(TestType testType in Enum.GetValues(typeof(TestType)))
{
Console.WriteLine("++++++++++");
Console.WriteLine("Test type: {0}", testType);
Console.WriteLine("++++++++++");
Console.WriteLine("");
foreach(var test in new ITest<object>[] { new SimpleStructTest(), new SimpleClassTest() })
{
var runner = new TestRunner(testType, serializerType);
var result = runner.Run((dynamic)test);
Console.WriteLine("{0,20}: {1}", test.GetType().Name, result);
if(options.OutputFile != null)
{
File.AppendAllText(options.OutputFile, string.Format("{0}-{1}-{2}-{3};{4};{5}{6}", serializerType, test.GetType().Name, testType, options.Id, result.Average, result.StandardDeviation, Environment.NewLine));
}
}
Console.WriteLine("");
}
}
}
示例5: run
private TestResult run(TestRunner testRunner, TestHarvester harvester, TestFilter testFilter, string savedDirectory)
{
TestResult result = null;
try
{
result = testRunner.Run(harvester, testFilter, false, LoggingThreshold.Off);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
finally
{
Environment.CurrentDirectory = savedDirectory;
}
return result;
}
示例6: 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 );
}
示例7: Main
public static int Main(String[] args)
{
Exception[] cryptoEx = new Exception[] { new CryptographicException() };
TestGroup apiTests = new TestGroup("API tests", new TestCase[]
{
new TestCase("GetBytes with small values", new TestCaseImpl(GetBytesSmall)),
new TestCase("Reset and ensure same", new TestCaseImpl(Reset)),
new TestCase("Set and Check Hash", new TestCaseImpl(SetCheckHash)),
new TestCase("Set and Check Salt", new TestCaseImpl(SetCheckSalt)),
new TestCase("Set and Check IC", new TestCaseImpl(SetCheckIC)),
new TestCase("Create with password bytes", new TestCaseImpl(CreateWithPasswordBytes)),
new TestCase("Create with password bytes and CSP", new TestCaseImpl(CreateWithPasswordBytesCSP))
});
TestGroup exceptionTests = new TestGroup("Exception tests", new TestCase[]
{
new ExceptionTestCase("Derive key, negative key size", new ExceptionTestCaseImpl(DeriveNegKey), cryptoEx),
new ExceptionTestCase("Derive key, bad algorithm", new ExceptionTestCaseImpl(DeriveKeyBadAlg), cryptoEx),
new ExceptionTestCase("Derive key, null IV", new ExceptionTestCaseImpl(DeriveKeyNullIv), cryptoEx),
new ExceptionTestCase("Null HashName", new ExceptionTestCaseImpl(NullHashName), ExceptionTestCase.ArgumentExceptions),
new ExceptionTestCase("Set HashName after Calculating", new ExceptionTestCaseImpl(HashNameAfterCalc), cryptoEx),
new ExceptionTestCase("Set Salt after Calculating", new ExceptionTestCaseImpl(SaltAfterCalc), cryptoEx),
new ExceptionTestCase("Zero iteration count", new ExceptionTestCaseImpl(ZeroIC), ExceptionTestCase.ArgumentExceptions),
new ExceptionTestCase("Negative iteration count", new ExceptionTestCaseImpl(NegativeIC), ExceptionTestCase.ArgumentExceptions),
new ExceptionTestCase("Set iteration count after calcuating", new ExceptionTestCaseImpl(ICAfterCalc), cryptoEx)
});
TestGroup customTests = new TestGroup("Custom Impl tests", new TestCase[]
{
new TestCase("Compare with custom impl", new TestCaseImpl(CompareWithCustom))
});
TestGroup otherTests = new TestGroup("Other tests", new TestCase[]
{
new TestCase("Change hash", new TestCaseImpl(ChangeHash)),
new TestCase("Change salt", new TestCaseImpl(ChangeSalt))
});
TestRunner runner = new TestRunner(new TestGroup[] { apiTests, exceptionTests, customTests, otherTests }, new ILogger[] { new ConsoleLogger(), new XmlFailureLogger() });
return runner.Run() ? PASS_CODE : FAIL_CODE;
}
示例8: RunPartition
private TestResult RunPartition(bool redirectOutput, bool redirectError, TestRunner testRunner, TextWriter outWriter, TextWriter errorWriter, TestFilter testFilter, EventListener collector)
{
TestResult result = null;
var savedDirectory = Environment.CurrentDirectory;
var savedOut = System.Console.Out;
var savedError = System.Console.Error;
try
{
result = testRunner.Run(collector, testFilter);
}
finally
{
outWriter.Flush();
errorWriter.Flush();
if (redirectOutput)
outWriter.Close();
if (redirectError)
errorWriter.Close();
Environment.CurrentDirectory = savedDirectory;
System.Console.SetOut(savedOut);
System.Console.SetError(savedError);
}
System.Console.WriteLine();
return result;
}
示例9: RunTesterBlocking
public TestResult RunTesterBlocking()
{
using (_testRunner = GetTestRunner())
{
//MarkAsRunning();
var results = _testRunner.Run(this, Filter, false, LoggingThreshold.Off);
//MarkAsFinished();
//TESTING:
if (!FinishedRunning) throw new Exception("NEED TO CALL MarkAsFinished!!!");
return results;
}
}
示例10: Run
public static TestResult Run(TestRunner runner, EventCollector listener, ITestFilter filter)
{
return runner.Run(listener, filter);
}
示例11: RunTests
protected virtual TestResult[] RunTests(EventListener listener, TestRunner runner, Test test)
{
return new TestResult[] { runner.Run(listener) };
}
示例12: Main
static void Main(string[] args)
{
var runner = new TestRunner();
runner.Run();
Console.ReadLine();
}