本文整理汇总了C#中ITest.Test方法的典型用法代码示例。如果您正苦于以下问题:C# ITest.Test方法的具体用法?C# ITest.Test怎么用?C# ITest.Test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITest
的用法示例。
在下文中一共展示了ITest.Test方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunTest
public static void RunTest(TestType type, int ThreadCount, CallbackFunction callBack, ITest target)
{
for (int i = 0; i < ThreadCount; i++)
{
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += (object sender, DoWorkEventArgs e) =>
{
bool result = target.Test();
e.Result = result;
};
worker.RunWorkerCompleted += (object sender, RunWorkerCompletedEventArgs e) =>
{
if (callBack != null)
{
if (e.Error != null)
{
callBack(type, (bool)e.Result);
}
else
{
callBack(type, false);
}
}
};
worker.RunWorkerAsync();
}
}
示例2: RunTest
private static void RunTest(Options o, string subTest, Action<string> logger, ITest test, int i)
{
TestResultBase result = null;
try
{
result = test.Test(o);
result.StepNr = i;
result.SubTest = subTest;
}
catch (Exception ex)
{
if (result == null)
{
result = new GenericTestResult();
}
result.StepNr = i;
result.SubTest = subTest;
result.Status = TestResult.FAIL;
result.CauseOfFailure = ex.Message;
result.ExtraInformation = ex.StackTrace;
}
if (logger != null)
logger(result.ToString());
}
示例3: RunTest
private static void RunTest(ITest Test)
{
try
{
Test.Progress -= OnTestProgress;
Test.Progress += new EventHandler<TestEventArgs>(OnTestProgress);
Console.WriteLine(Test.Description);
Console.WriteLine(Test.Test());
Console.WriteLine();
}
catch (Exception Ex)
{
Console.WriteLine("An error has occured!");
Console.WriteLine(Ex.Message);
Console.WriteLine("");
Console.WriteLine("Continue Testing? Press 'Y' to continue, all other keys abort..");
ConsoleKeyInfo keyInfo = Console.ReadKey();
if (!keyInfo.Key.Equals(ConsoleKey.Y))
Environment.Exit(0);
else
Console.WriteLine();
}
}
示例4: PerformTest
private static void PerformTest(ITest test)
{
Log("Performing test: " + test.Name);
long startTime = new NativeDate().GetTime();
test.Test();
long deltaTime = new NativeDate().GetTime() - startTime;
if (test.Passed)
{
_passCount++;
Log("Test: " + test.Name + " [PASSED]: " + deltaTime + " ms");
}
else
{
Log("Test: " + test.Name + " [FAILED]: " + deltaTime + " ms => " + test.Exception + " - " + test.Exception.StackTrace);
_failures.Add(test);
}
// TODO: ConditionalExpression "test.Passsed?'PASSED':'FAILED'" was producing either "undefined" or "'FAILED'" need regression test for it
}