예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestPage"/> class.
        /// </summary>
        public TestPage()
        {
            InitializeComponent();

            _textUI = new TextUI(new TextBlockWriter(this.ScratchArea));
            _callingAssembly = Assembly.GetCallingAssembly();
            _textRunner = new TextRunner(_callingAssembly);
        }
		protected void Run(Stream scenario)
		{
			var runner = new TextRunner(_eventListener) { StoryRunnerFilter = _storyRunnerFilter };

			_actionStepAssemblies.ToList().ForEach(runner.LoadAssembly);
			runner.Load(scenario);
			runner.Run();
		}
예제 #3
0
        public void ReportSequenceTest()
        {
            var textRunner = new TextRunner();

            textRunner.ReportResults(_result);

            int last = -1;

            foreach (string title in REPORT_SEQUENCE)
            {
                var index = Report.IndexOf(title);
                Assert.That(index >= 0, "Report not found: " + title);
                Assert.That(index > last, "Report out of sequence: " + title);
            }
        }
예제 #4
0
        public override void ExecuteRecursive(TaskExecutionNode node)
        {
            var asm = node.RemoteTask as NBehaveAssemblyTask;

            if (asm == null)
            {
                return;
            }
            Initialize(node);

            var featureTasks = GetFeatureTasks(node);

            NotifyTasksStarting(featureTasks.ToList());
            var runner = new TextRunner(config);

            runner.Run();
        }
예제 #5
0
        static int Main(string[] args)
        {
            AllUpTest.DirectoryOffset = Path.Combine("..", "..", "..", "..", "..", "doc", "handbook");

            // if we enter Main, it seems we are executing the tutorial tests locally...
            // so delete any local tex files since we want to run the scripts from dolc/handbook
            var localTexFiles = (new DirectoryInfo(Directory.GetCurrentDirectory())).GetFiles("*.tex");

            foreach (var f in localTexFiles)
            {
                f.Delete();
            }


            BoSSS.Solution.Application.InitMPI(new string[0]);


            //var losScriptos = GetListOfScripts();
            //int r = 0;
            //AllUpTest.RunWorksheet(losScriptos[int.Parse(args[0])]);
            //foreach(var s in losScriptos) {
            //    AllUpTest.RunWorksheet(s);
            //    break;
            //}



            var tr = new TextRunner(typeof(TutorialTestsMain).Assembly);

            int r = tr.Execute(new[] { "--result=result-TutorialTests.xml"
                                       //, "--test=BoSSS.Application.TutorialTests.AllUpTest.Run__CsharpAndBoSSSpad"
                               });


            csMPI.Raw.mpiFinalize();


            return(r);
        }
예제 #6
0
 private TestFilter GetFilter(params string[] args)
 {
     return(TextRunner.CreateTestFilter(new NUnitLiteOptions(args)));
 }
예제 #7
0
파일: TextUITests.cs 프로젝트: nunit/nunit
        public void ReportSequenceTest()
        {
            var textRunner = new TextRunner();
            textRunner.ReportResults(_result);

            int last = -1;

            foreach (string title in REPORT_SEQUENCE)
            {
                var index = Report.IndexOf(title);
                Assert.That(index >= 0, "Report not found: " + title);
                Assert.That(index > last, "Report out of sequence: " + title);
            }
        }
예제 #8
0
        static int Main(string[] args)
        {
            int result = new TextRunner(typeof(Program).GetTypeInfo().Assembly).Execute(args);

            return(result);
        }
예제 #9
0
        // // Entry point called by AutoRun and by the .NET Standard nunitlite.runner
        // public int Execute(ExtendedTextWriter writer, TextReader reader, string[] args)
        // {
        //     _options = new NUnitLiteOptions(_testAssembly == null, args);
        //
        //     _textUI = new TextUI(writer, reader, _options);
        //
        //     return Execute();
        // }

        // Internal Execute depends on _textUI and _options having been set already.
        private int Execute()
        {
            _runner = new NUnitTestAssemblyRunner(new DefaultTestAssemblyBuilder());

            try
            {
                if (_options.ErrorMessages.Count > 0)
                {
                    _textUI.DisplayErrors(_options.ErrorMessages);
                    _textUI.Writer.WriteLine();
                    _textUI.DisplayHelp();

                    return(TextRunner.INVALID_ARG);
                }

                if (_testAssembly == null && _options.InputFile == null)
                {
                    _textUI.DisplayError("No test assembly was specified.");
                    _textUI.Writer.WriteLine();
                    _textUI.DisplayHelp();

                    return(TextRunner.OK);
                }

                var testFile = _testAssembly != null
                    ? AssemblyHelper.GetAssemblyPath(_testAssembly)
                    : _options.InputFile;

                if (_testAssembly == null)
                {
                    _testAssembly = AssemblyHelper.Load(testFile);
                }

                if (_options.WaitBeforeExit && _options.OutFile != null)
                {
                    _textUI.DisplayWarning("Ignoring /wait option - only valid for Console");
                }

                var runSettings = NUnitLite.TextRunner.MakeRunSettings(_options);
                LoadTests(runSettings);

                // We display the filters at this point so that any exception message
                // thrown by CreateTestFilter will be understandable.
                _textUI.DisplayTestFilters();

                TestFilter filter = TextRunner.CreateTestFilter(_options);

                return(RunTests(filter, runSettings));
            }
            catch (FileNotFoundException ex)
            {
                _textUI.DisplayError(ex.Message);
                return(FILE_NOT_FOUND);
            }
            catch (Exception ex)
            {
                _textUI.DisplayError(ex.ToString());
                return(UNEXPECTED_ERROR);
            }
            finally
            {
                if (_options.WaitBeforeExit)
                {
                    _textUI.WaitForUser("Press Enter key to continue . . .");
                }
            }
        }
예제 #10
0
 /// <summary>
 ///     Starts execution of test collection from calling assembly.
 /// </summary>
 /// <param name="args">
 ///     See argument options from https://github.com/nunit/docs/wiki/NUnitLite-Options
 /// </param>
 public void Start(string[] args)
 {
     var textRunner = new TextRunner(callingAssembly);
     int resultInt  = textRunner.Execute(args);
 }