Esempio n. 1
0
 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);
            }
        }
Esempio n. 3
0
 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();
 }
Esempio n. 4
0
    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;
    }
Esempio n. 5
0
		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 );
				}
			}
		}
Esempio n. 6
0
		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
			}
		}
Esempio n. 7
0
 public TestResult(TestRunner runner, TestRunStatus status, string name)
 {
     _runner = runner;
     _name = name;
     _status = status;
     _stackTrace = new IStackLine[] { };
 }
Esempio n. 8
0
        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;
        }
Esempio n. 9
0
        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;
            }
        }
Esempio n. 10
0
        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);
                }
            }
        }
Esempio n. 11
0
        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;
            }
        }
Esempio n. 12
0
 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();
 }
Esempio n. 13
0
    public static void HasTestSuitesProperty(TestRunner r)
    {
        harness.FindTests();

        string foundName = harness.TestSuites[sampleSuiteName].Name;

        r.Expect(foundName).ToBe(sampleSuiteName);
    }
Esempio n. 14
0
    public static void GetTestsReturnsAllTestsInSampleSuite(TestRunner r)
    {
        harness.FindTests();

        List<TestRunner> testsFound = harness.GetTestsInSuite(sampleSuiteName);

        r.Expect(testsFound.Count).ToBe(2);
    }
Esempio n. 15
0
    public static void FindsAllMethodsInSampleSuite(TestRunner r)
    {
        harness.FindTests();
        Type sampleType = typeof(SampleTestsSpec);
        List<MethodInfo> methods = TestHarness.FindTestMethodsInType(sampleType);

        r.Expect(methods.Count).ToBe(3);
    }
Esempio n. 16
0
        public void It_executes_the_command()
        {
            var testRunner = new TestRunner(_runner, _commandFactoryMock.Object, _argumentsBuilderMock.Object);

            testRunner.RunTestCommand();

            _commandMock.Verify(c => c.Execute(), Times.Once);
        }
Esempio n. 17
0
        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;
 }
Esempio n. 20
0
 public TestResult(TestRunner runner, TestRunStatus status, string name, string message, IStackLine[] stackTrace)
 {
     _runner = runner;
     _status = status;
     _name = name;
     _message = message;
     _stackTrace = stackTrace;
 }
Esempio n. 21
0
    public static void MethodHasAttributeReturnsFalseWhenMethodDoesNotHaveAttribute(TestRunner r)
    {
        MethodInfo method = _GetMethod("HasName");

        bool testAttrCheck = TestSuite.MethodHasAttribute<HasTestsAttribute>(method);

        r.Expect(testAttrCheck).ToBe(false);
    }
Esempio n. 22
0
    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();
        }
Esempio n. 24
0
        public void It_creates_a_command_using_the_right_parameters()
        {
            var testRunner = new TestRunner(_runner, _commandFactoryMock.Object, _argumentsBuilderMock.Object);

            testRunner.RunTestCommand();

            _commandFactoryMock.Verify();
        }
Esempio n. 25
0
 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);
 }
Esempio n. 26
0
 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;
     }
 }
Esempio n. 27
0
        /// <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);
        }
Esempio n. 28
0
 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);
 }
Esempio n. 29
0
        /// <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");
        }
Esempio n. 30
0
        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));
        }
Esempio n. 31
0
 public void TestVirtualMachineRedeploy()
 {
     TestRunner.RunTestScript("Test-VirtualMachineRedeploy");
 }
Esempio n. 32
0
 public void TestVirtualMachine_Managed()
 {
     TestRunner.RunTestScript("Test-VirtualMachine $null $true");
 }
Esempio n. 33
0
 public void TestVirtualMachineReapply()
 {
     TestRunner.RunTestScript("Test-VirtualMachineReapply");
 }
Esempio n. 34
0
 public void TestVirtualMachineWithPremiumStorageAccount()
 {
     TestRunner.RunTestScript("Test-VirtualMachineWithPremiumStorageAccount");
 }
Esempio n. 35
0
 public void TestVirtualMachineWithDifferentStorageResource()
 {
     TestRunner.RunTestScript("Test-VirtualMachineWithDifferentStorageResource");
 }
Esempio n. 36
0
 public void TestLowPriorityVirtualMachine()
 {
     TestRunner.RunTestScript("Test-LowPriorityVirtualMachine");
 }
Esempio n. 37
0
 public void TestVirtualMachinePiping()
 {
     TestRunner.RunTestScript("Test-VirtualMachinePiping");
 }
Esempio n. 38
0
 public void TestHostGroupPropertySetOnVirtualMachine()
 {
     TestRunner.RunTestScript("Test-HostGroupPropertySetOnVirtualMachine");
 }
Esempio n. 39
0
 public void TestVirtualMachineWriteAcceleratorUpdate()
 {
     TestRunner.RunTestScript("Test-VirtualMachineWriteAcceleratorUpdate");
 }
Esempio n. 40
0
 public void TestVirtualMachineImageList()
 {
     TestRunner.RunTestScript("Test-VirtualMachineImageList");
 }
Esempio n. 41
0
 public void TestVirtualMachineManagedDiskConversion()
 {
     TestRunner.RunTestScript("Test-VirtualMachineManagedDiskConversion");
 }
Esempio n. 42
0
 public void TestVirtualMachineWithVMAgentAutoUpdate()
 {
     TestRunner.RunTestScript("Test-VirtualMachineWithVMAgentAutoUpdate");
 }
Esempio n. 43
0
 public void TestLinuxVirtualMachine()
 {
     TestRunner.RunTestScript("Test-LinuxVirtualMachine");
 }
Esempio n. 44
0
 public void TestVirtualMachineUpdateWithoutNic()
 {
     TestRunner.RunTestScript("Test-VirtualMachineUpdateWithoutNic");
 }
Esempio n. 45
0
 public void TestEncryptionAtHostVMDefaultParameterSet()
 {
     TestRunner.RunTestScript("Test-EncryptionAtHostVMDefaultParamSet");
 }
Esempio n. 46
0
 public void TestVirtualMachine()
 {
     TestRunner.RunTestScript("Test-VirtualMachine $null");
 }
Esempio n. 47
0
 public void TestEncryptionAtHostVM()
 {
     TestRunner.RunTestScript("Test-EncryptionAtHostVM");
 }
Esempio n. 48
0
 public void TestVirtualMachineWithBYOL()
 {
     TestRunner.RunTestScript("Test-VirtualMachineWithBYOL");
 }
Esempio n. 49
0
 public void TestVirtualMachineRemoteDesktop()
 {
     TestRunner.RunTestScript("Test-VirtualMachineRemoteDesktop");
 }
Esempio n. 50
0
 public void TestVirtualMachinePerformanceMaintenance()
 {
     TestRunner.RunTestScript("Test-VirtualMachinePerformanceMaintenance");
 }
Esempio n. 51
0
 public void TestVirtualMachineReimage()
 {
     TestRunner.RunTestScript("Test-VirtualMachineReimage");
 }
Esempio n. 52
0
 public void TestSetAzVMOperatingSystemError()
 {
     TestRunner.RunTestScript("Test-SetAzVMOperatingSystemError");
 }
Esempio n. 53
0
 public void TestVirtualMachineWithEmptyAuc()
 {
     TestRunner.RunTestScript("Test-VirtualMachineWithEmptyAuc");
 }
Esempio n. 54
0
 public void VirtualMachineGetStatusWithHealhtExtension()
 {
     TestRunner.RunTestScript("Test-VirtualMachineGetStatusWithHealhtExtension");
 }
Esempio n. 55
0
 public void TestVirtualMachineManagedDisk()
 {
     TestRunner.RunTestScript("Test-VirtualMachineManagedDisk");
 }
Esempio n. 56
0
 public void TestVirtualMachineGetStatus()
 {
     TestRunner.RunTestScript("Test-VirtualMachineGetStatus");
 }
Esempio n. 57
0
 public void TestVirtualMachineGetStatusWithAssignedHost()
 {
     TestRunner.RunTestScript("Test-VirtualMachineGetStatusWithAssignedHost");
 }
Esempio n. 58
0
 public void TestVirtualMachineImageListTopOrderExpand()
 {
     TestRunner.RunTestScript("Test-VirtualMachineImageListTopOrderExpand");
 }
Esempio n. 59
0
 public void TestVirtualMachineBootDiagnostics()
 {
     TestRunner.RunTestScript("Test-VirtualMachineBootDiagnostics");
 }
Esempio n. 60
0
 public void TestVirtualMachineIdentityUpdate()
 {
     TestRunner.RunTestScript("Test-VirtualMachineIdentityUpdate");
 }