当前位置: 首页>>代码示例>>C#>>正文


C# TestRunner类代码示例

本文整理汇总了C#中TestRunner的典型用法代码示例。如果您正苦于以下问题:C# TestRunner类的具体用法?C# TestRunner怎么用?C# TestRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TestRunner类属于命名空间,在下文中一共展示了TestRunner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getRunItemsFor

 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();
 }
开发者ID:JamesTryand,项目名称:AutoTest.Net,代码行数:7,代码来源:TestRunInfo.cs

示例2: TestResult

 public TestResult(TestRunner runner, TestRunStatus status, string name)
 {
     _runner = runner;
     _name = name;
     _status = status;
     _stackTrace = new IStackLine[] { };
 }
开发者ID:rmterra,项目名称:AutoTest.Net,代码行数:7,代码来源:TestResult.cs

示例3: GetTestsFor

 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();
 }
开发者ID:zinark,项目名称:AutoTest.Net,代码行数:7,代码来源:TestRunInfo.cs

示例4: TestRunnerThread

		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 );
				}
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:32,代码来源:TestRunnerThread.cs

示例5: 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;
    }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:35,代码来源:HashDriver.cs

示例6: using

        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;
            }
        }
开发者ID:paulecoyote,项目名称:xunit,代码行数:25,代码来源:TdNetRunner.cs

示例7: OnNavigatedTo

        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);
            }
        }
开发者ID:martinsuchan,项目名称:wpdev.samples,代码行数:34,代码来源:MainPage.xaml.cs

示例8: Main

        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;
        }
开发者ID:yuanfei05,项目名称:vita,代码行数:34,代码来源:_Program.cs

示例9: RunTestsButton_Click

        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;
            }
        }
开发者ID:gitter-badger,项目名称:PCLCrypto,代码行数:29,代码来源:MainPage.xaml.cs

示例10: TestRunnerThread

		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
			}
		}
开发者ID:alesliehughes,项目名称:olive,代码行数:26,代码来源:TestRunnerThread.cs

示例11: TestFailure

 public TestFailure(string assembly, string className, string testName, TestRunner runner)
 {
     Assembly = assembly;
     ClassName = className;
     TestName = testName;
     Runner = runner;
 }
开发者ID:jeroldhaas,项目名称:ContinuousTests,代码行数:7,代码来源:TestFailure.cs

示例12: Parallelize

        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);
                }
            }
        }
开发者ID:pitchalt,项目名称:IntecoAG.IBS,代码行数:27,代码来源:PNUnit.cs

示例13: RunTest

        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();
        }
开发者ID:kevinschapansky,项目名称:MicroforceDisplacementMachine,代码行数:8,代码来源:TestingUtility.cs

示例14: HasTestSuitesProperty

    public static void HasTestSuitesProperty(TestRunner r)
    {
        harness.FindTests();

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

        r.Expect(foundName).ToBe(sampleSuiteName);
    }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例15: GetTestsReturnsAllTestsInSampleSuite

    public static void GetTestsReturnsAllTestsInSampleSuite(TestRunner r)
    {
        harness.FindTests();

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

        r.Expect(testsFound.Count).ToBe(2);
    }
开发者ID:,项目名称:,代码行数:8,代码来源:


注:本文中的TestRunner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。