public TestFailure(string assembly, string className, string testName, TestRunner runner) { Assembly = assembly; ClassName = className; TestName = testName; Runner = runner; }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); try { TestRunner runner = new TestRunner(); Block.DataContext = runner; IFileTester[] testers = { /*new FileExistsTester(), new IsolatedStorageFileFileExistsTester(), new StorageFolderGetFileAsyncTester(), new StorageFileGetFileFromPathAsyncTester(), new StorageFileGetFileFromApplicationUriAsyncTester(), new StorageFolderGetFilesAsyncTester(),*/ new StorageFolderGetFileSyncTester(), new StorageFileGetFileFromPathSyncTester(), new StorageFileGetFileFromApplicationUriSyncTester(), }; await runner.InitFiles(500, 0); await runner.RunTest(testers); await runner.InitFiles(500, 0.5); await runner.RunTest(testers); await runner.InitFiles(500, 1); await runner.RunTest(testers); } catch (Exception exception) { Debug.WriteLine(exception); } }
private string[] getRunItemsFor(TestRunner runner, List<TestToRun> runList) { var query = from t in runList where t.Runner.Equals(runner) || t.Runner.Equals(TestRunner.Any) select t.Test; return query.ToArray(); }
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; }
public TestRunnerThread( TestRunner runner ) { this.runner = runner; this.thread = new Thread( new ThreadStart( TestRunnerThreadProc ) ); thread.IsBackground = true; thread.Name = "TestRunnerThread"; this.settings = (NameValueCollection) ConfigurationSettings.GetConfig( "NUnit/TestRunner" ); if ( settings != null ) { try { string apartment = settings["ApartmentState"]; if ( apartment != null ) thread.ApartmentState = (ApartmentState) System.Enum.Parse( typeof( ApartmentState ), apartment, true ); string priority = settings["ThreadPriority"]; if ( priority != null ) thread.Priority = (ThreadPriority) System.Enum.Parse( typeof( ThreadPriority ), priority, true ); } catch( ArgumentException ex ) { string msg = string.Format( "Invalid configuration setting in {0}", AppDomain.CurrentDomain.SetupInformation.ConfigurationFile ); throw new ArgumentException( msg, ex ); } } }
public TestRunnerThread( TestRunner runner ) { this.runner = runner; this.thread = new Thread( new ThreadStart( TestRunnerThreadProc ) ); this.settings = (NameValueCollection) ConfigurationSettings.GetConfig( "NUnit/TestRunner" ); try { string apartment = (string)settings["ApartmentState"]; if ( apartment == "STA" ) thread.ApartmentState = ApartmentState.STA; else if ( apartment == "MTA" ) thread.ApartmentState = ApartmentState.MTA; string priority = (string)settings["ThreadPriority"]; if ( priority != null ) thread.Priority = (ThreadPriority) System.Enum.Parse( typeof( ThreadPriority ), priority, true ); } catch { // Ignore any problems for now - test will run using default settings } }
public TestResult(TestRunner runner, TestRunStatus status, string name) { _runner = runner; _name = name; _status = status; _stackTrace = new IStackLine[] { }; }
public static int Main(string[] args) { Console.WindowWidth = 120; var noPause = args.Contains("/nopause"); var runner = new TestRunner(errorFile: "_errors.log"); var configs = BuildServerConfigs(); int skipServerCount = 0; var testRuns = runner.RunTests(typeof(Program).Assembly, configs, // init action for server type; must return true to run the tests cfg => { Console.WriteLine(); Console.WriteLine(cfg.ToString()); SetupHelper.Reset(cfg); // Check if server is available string error; if (ToolHelper.TestConnection(SetupHelper.Driver, SetupHelper.ConnectionString, out error)) return true; runner.ConsoleWriteRed(" Connection test failed for connection string: {0}, \r\n Error: {1}", SetupHelper.ConnectionString, error); skipServerCount++; return false; }); //Report results var errCount = testRuns.Sum(tr => tr.Errors.Count) + skipServerCount; Console.WriteLine(); if (errCount > 0) runner.ConsoleWriteRed("Errors: " + errCount); // stop unless there's /nopause switch if (!noPause) { Console.WriteLine("Press any key..."); Console.ReadKey(); } return errCount == 0 ? 0 : -1; }
TestRunState ITdNetTestRunner.RunMember(ITestListener listener, Assembly assembly, MemberInfo member) { try { using (ExecutorWrapper wrapper = new ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false)) { TdNetLogger logger = new TdNetLogger(listener, assembly); TestRunner runner = new TestRunner(wrapper, logger); MethodInfo method = member as MethodInfo; if (method != null) return RunMethod(runner, method); Type type = member as Type; if (type != null) return RunClassWithInnerTypes(runner, type); return TestRunState.NoTests; } } catch (ArgumentException) { return TestRunState.NoTests; } }
protected void Parallelize() { string executable = Environment.GetCommandLineArgs()[0]; RunFromConsole = executable.ToLower().Contains("nunit-console"); foreach (MethodInfo methodInfo in GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance)) { if (methodInfo.GetCustomAttributes(typeof(TestAttribute), false).Length == 1 && methodInfo.GetCustomAttributes(typeof(IgnoreAttribute), false).Length == 0) { string key = GetKey(methodInfo); MethodInfo actionMethod = GetType().GetMethod(key + "Action", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); if (actionMethod != null) { actions.Add(key, () => actionMethod.Invoke(this, new object[] { })); } } } if (RunFromConsole) { foreach (KeyValuePair<string, Action> actionPair in actions) { TestRunner testRunner = new TestRunner(actionPair.Value); ThreadStart ts = testRunner.DoWork; Thread thread = new Thread(ts); testRunner.Thread = thread; thread.Start(); threads.Add(actionPair.Key, testRunner); } } }
private async void RunTestsButton_Click(object sender, RoutedEventArgs e) { this.RunTestsButton.IsEnabled = false; this.TestRunProgress.Visibility = Visibility.Visible; this.TextSummaryText.Visibility = Visibility.Collapsed; try { var testRunner = new TestRunner(Assembly.GetExecutingAssembly()); await TaskEx.Run(() => testRunner.RunTestsAsync()); this.TextSummaryText.Text = string.Format( CultureInfo.CurrentCulture, "{0}/{1} tests passed ({2}%)", testRunner.PassCount, testRunner.TestCount, 100 * testRunner.PassCount / testRunner.TestCount); this.TextSummaryText.Visibility = Visibility.Visible; this.ResultsTextBox.Text = testRunner.Log; } catch (Exception ex) { this.ResultsTextBox.Text = ex.ToString(); } finally { this.RunTestsButton.IsEnabled = true; this.TestRunProgress.Visibility = Visibility.Collapsed; } }
public string[] GetTestsFor(TestRunner runner) { var query = from t in _testsToRun where t.Runner.Equals(runner) || t.Runner.Equals(TestRunner.Any) select t.Test; return query.ToArray(); }
public static void HasTestSuitesProperty(TestRunner r) { harness.FindTests(); string foundName = harness.TestSuites[sampleSuiteName].Name; r.Expect(foundName).ToBe(sampleSuiteName); }
public static void GetTestsReturnsAllTestsInSampleSuite(TestRunner r) { harness.FindTests(); List<TestRunner> testsFound = harness.GetTestsInSuite(sampleSuiteName); r.Expect(testsFound.Count).ToBe(2); }
public static void FindsAllMethodsInSampleSuite(TestRunner r) { harness.FindTests(); Type sampleType = typeof(SampleTestsSpec); List<MethodInfo> methods = TestHarness.FindTestMethodsInType(sampleType); r.Expect(methods.Count).ToBe(3); }
public void It_executes_the_command() { var testRunner = new TestRunner(_runner, _commandFactoryMock.Object, _argumentsBuilderMock.Object); testRunner.RunTestCommand(); _commandMock.Verify(c => c.Execute(), Times.Once); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Xamarin.Forms.Forms.Init(this, bundle); var runner = new TestRunner(Assembly.GetExecutingAssembly()); this.SetPage(new NavigationPage(new TestRunnerPage(runner))); }
public void RunTest(DataUpdateDelegate graphUpdate, float stopVoltage, int readingDelay, int stepSize, string outFile) { TestRunner runner = new TestRunner(graphUpdate, stopVoltage, readingDelay, stepSize, outFile); Thread tThread = new Thread(new ThreadStart(runner.RunTest)); KeepRunningTest = true; tThread.Start(); }
public TestRunResults(string project, string assembly, bool isPartialTestRun, TestRunner runner, TestResult[] testResults) { _project = project; _assembly = assembly; _isPartialTestRun = isPartialTestRun; _runner = runner; _testResults = testResults; }
public TestResult(TestRunner runner, TestRunStatus status, string name, string message, IStackLine[] stackTrace) { _runner = runner; _status = status; _name = name; _message = message; _stackTrace = stackTrace; }
public static void MethodHasAttributeReturnsFalseWhenMethodDoesNotHaveAttribute(TestRunner r) { MethodInfo method = _GetMethod("HasName"); bool testAttrCheck = TestSuite.MethodHasAttribute<HasTestsAttribute>(method); r.Expect(testAttrCheck).ToBe(false); }
public static void MethodHasAttributeReturnsTrueWhenMethodHasAttribute(TestRunner r) { MethodInfo method = _GetMethod("HasName"); bool testAttrCheck = TestSuite.MethodHasAttribute<TestAttribute>(method); r.Expect(testAttrCheck).ToBe(true); }
public void Arrange() { _consoleMock = new Mock<IOutputProvider>(); _testrunner = new TestRunner(_consoleMock.Object); _assembly = Assembly.GetAssembly(typeof(TypeAvailableInTestAssembly)); Act(); }
public void It_creates_a_command_using_the_right_parameters() { var testRunner = new TestRunner(_runner, _commandFactoryMock.Object, _argumentsBuilderMock.Object); testRunner.RunTestCommand(); _commandFactoryMock.Verify(); }
public TestResult(TestRunner runner, TestRunStatus status, string name, string message, IStackLine[] stackTrace, double milliseconds) { _runner = runner; _status = status; _name = name; _message = message; _stackTrace = stackTrace; TimeSpent = TimeSpan.FromMilliseconds(milliseconds); }
private void CreateRunners( int count ) { runners = new TestRunner[count]; for( int index = 0; index < count; index++ ) { TestDomain runner = new TestDomain( this.runnerID * 100 + index + 1 ); runners[index] = runner; } }
/// <summary> /// Create a new NUnit2FrameworkDriver /// </summary> /// <param name="testDomain">The AppDomain to use for the runner</param> /// <remarks> /// The framework assembly name is needed because this driver is used for both the /// nunit.framework 2.x and nunitlite 1.0. /// </remarks> public NUnit2FrameworkDriver(AppDomain testDomain) { _testDomain = testDomain; var initializer = DomainInitializer.CreateInstance(_testDomain); initializer.InitializeDomain((int)InternalTrace.Level); _runner = RemoteTestRunner.CreateInstance(_testDomain, 1); }
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); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); this.runner = new TestRunner<Game1>(this.Services); this.reporter = new XnaTestReporter(); this.runner.Reporter(this.reporter); this.font = this.Content.Load<SpriteFont>("font"); }
static Host() { _configuration = Configure(); applicationContainer = _configuration.CreateApplicationContainer(); _logger.Log("Type of ApplicationContainer is {0}", applicationContainer.GetType().Name); _testRunner = new TestRunner(_configuration, applicationContainer,new BddfyTestEngine()); AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload; _configuration.PerAppDomainActions.ForEach(action => action.Before(applicationContainer)); }
public void TestVirtualMachineRedeploy() { TestRunner.RunTestScript("Test-VirtualMachineRedeploy"); }
public void TestVirtualMachine_Managed() { TestRunner.RunTestScript("Test-VirtualMachine $null $true"); }
public void TestVirtualMachineReapply() { TestRunner.RunTestScript("Test-VirtualMachineReapply"); }
public void TestVirtualMachineWithPremiumStorageAccount() { TestRunner.RunTestScript("Test-VirtualMachineWithPremiumStorageAccount"); }
public void TestVirtualMachineWithDifferentStorageResource() { TestRunner.RunTestScript("Test-VirtualMachineWithDifferentStorageResource"); }
public void TestLowPriorityVirtualMachine() { TestRunner.RunTestScript("Test-LowPriorityVirtualMachine"); }
public void TestVirtualMachinePiping() { TestRunner.RunTestScript("Test-VirtualMachinePiping"); }
public void TestHostGroupPropertySetOnVirtualMachine() { TestRunner.RunTestScript("Test-HostGroupPropertySetOnVirtualMachine"); }
public void TestVirtualMachineWriteAcceleratorUpdate() { TestRunner.RunTestScript("Test-VirtualMachineWriteAcceleratorUpdate"); }
public void TestVirtualMachineImageList() { TestRunner.RunTestScript("Test-VirtualMachineImageList"); }
public void TestVirtualMachineManagedDiskConversion() { TestRunner.RunTestScript("Test-VirtualMachineManagedDiskConversion"); }
public void TestVirtualMachineWithVMAgentAutoUpdate() { TestRunner.RunTestScript("Test-VirtualMachineWithVMAgentAutoUpdate"); }
public void TestLinuxVirtualMachine() { TestRunner.RunTestScript("Test-LinuxVirtualMachine"); }
public void TestVirtualMachineUpdateWithoutNic() { TestRunner.RunTestScript("Test-VirtualMachineUpdateWithoutNic"); }
public void TestEncryptionAtHostVMDefaultParameterSet() { TestRunner.RunTestScript("Test-EncryptionAtHostVMDefaultParamSet"); }
public void TestVirtualMachine() { TestRunner.RunTestScript("Test-VirtualMachine $null"); }
public void TestEncryptionAtHostVM() { TestRunner.RunTestScript("Test-EncryptionAtHostVM"); }
public void TestVirtualMachineWithBYOL() { TestRunner.RunTestScript("Test-VirtualMachineWithBYOL"); }
public void TestVirtualMachineRemoteDesktop() { TestRunner.RunTestScript("Test-VirtualMachineRemoteDesktop"); }
public void TestVirtualMachinePerformanceMaintenance() { TestRunner.RunTestScript("Test-VirtualMachinePerformanceMaintenance"); }
public void TestVirtualMachineReimage() { TestRunner.RunTestScript("Test-VirtualMachineReimage"); }
public void TestSetAzVMOperatingSystemError() { TestRunner.RunTestScript("Test-SetAzVMOperatingSystemError"); }
public void TestVirtualMachineWithEmptyAuc() { TestRunner.RunTestScript("Test-VirtualMachineWithEmptyAuc"); }
public void VirtualMachineGetStatusWithHealhtExtension() { TestRunner.RunTestScript("Test-VirtualMachineGetStatusWithHealhtExtension"); }
public void TestVirtualMachineManagedDisk() { TestRunner.RunTestScript("Test-VirtualMachineManagedDisk"); }
public void TestVirtualMachineGetStatus() { TestRunner.RunTestScript("Test-VirtualMachineGetStatus"); }
public void TestVirtualMachineGetStatusWithAssignedHost() { TestRunner.RunTestScript("Test-VirtualMachineGetStatusWithAssignedHost"); }
public void TestVirtualMachineImageListTopOrderExpand() { TestRunner.RunTestScript("Test-VirtualMachineImageListTopOrderExpand"); }
public void TestVirtualMachineBootDiagnostics() { TestRunner.RunTestScript("Test-VirtualMachineBootDiagnostics"); }
public void TestVirtualMachineIdentityUpdate() { TestRunner.RunTestScript("Test-VirtualMachineIdentityUpdate"); }