예제 #1
0
        protected string PrepareNunitArgs(string inputFile, string outputFile)
        {
            var listpath = new FilePathAbsolute(inputFile)
                           .GetBrotherFileWithName(
                Path.GetFileNameWithoutExtension(inputFile) + "-Runlist.txt").Path;

            string testToRun = "";

            if (!_testsSelector.AllowAll)
            {
                using (var file = File.CreateText(listpath))
                {
                    foreach (var str in _testsSelector.MinimalSelectionList)
                    {
                        file.WriteLine(str.Trim());
                    }
                }
                testToRun = " --testlist=" + listpath.InQuotes() + " ";
            }

            string arg = inputFile.InQuotes()
                         + testToRun
                         + " --result=\"" + outputFile + "\";format=nunit2 --noheader --nocolor --dispose-runners --skipnontestassemblies";

            if (_options?.ParsedParams.NUnitNetVersion.Length != 0)
            {
                arg += (" --framework=" + _options.OtherParams);
            }

            return(arg);
        }
예제 #2
0
        public Task <ProcessResults> RunNUnitConsole(string nunitConsolePath,
                                                     string inputFile, string outputFile)
        {
            var listpath = new FilePathAbsolute(inputFile)
                           .GetBrotherFileWithName(
                Path.GetFileNameWithoutExtension(inputFile) + "-Runlist.txt").Path;

            string testToRun = "";

            if (!_testsSelector.AllowAll)
            {
                using (var file = File.CreateText(listpath))
                {
                    foreach (var str in _testsSelector.MinimalSelectionList)
                    {
                        file.WriteLine(str.Trim());
                    }
                }
                testToRun = " /runlist:" + listpath.InQuotes() + " ";
            }

            string arg = inputFile.InQuotes()
                         + testToRun
                         + " /xml \"" + outputFile + "\" /nologo -trace=Verbose /noshadow /nothread";

            if (_options.ParsedParams.NUnitNetVersion.Length != 0)
            {
                arg += (" /framework:" + _options.OtherParams);
            }

            _log.Info("Running \"" + nunitConsolePath + "\" " + arg);
            var startInfo = new ProcessStartInfo
            {
                Arguments              = arg,
                CreateNoWindow         = true,
                ErrorDialog            = true,
                RedirectStandardOutput = false,
                FileName        = nunitConsolePath,
                UseShellExecute = false,
            };

            return(_processes.RunAsync(startInfo, _cancellationTokenSource));
        }
        public Task<ProcessResults> RunNUnitConsole(string nunitConsolePath,
            string inputFile, string outputFile)
        {
            var listpath = new FilePathAbsolute(inputFile)
                .GetBrotherFileWithName(
                Path.GetFileNameWithoutExtension(inputFile) + "-Runlist.txt").Path;

            string testToRun = "";
            if(!_testsSelector.AllowAll)
            {
                using (var file = File.CreateText(listpath))
                {
                    foreach (var str in _testsSelector.MinimalSelectionList)
                    {
                        file.WriteLine(str.Trim());
                    }
                }
                testToRun = " /runlist:" + listpath.InQuotes() + " ";
            }

            string arg = inputFile.InQuotes()
                         + testToRun
                         + " /xml \"" + outputFile + "\" /nologo -trace=Verbose /noshadow /nothread";

            if (_options.ParsedParams.NUnitNetVersion.Length != 0)
            {
                arg += (" /framework:" + _options.OtherParams);
            }

            _log.Info("Running \"" + nunitConsolePath+"\" " + arg);
            var startInfo = new ProcessStartInfo
            {
                Arguments = arg,
                CreateNoWindow = true,
                ErrorDialog = true,
                RedirectStandardOutput = false,
                FileName = nunitConsolePath,
                UseShellExecute = false,
            };
            return _processes.RunAsync(startInfo, _cancellationTokenSource);
        }