コード例 #1
0
 public SpecFlowTestReportBuilder(CommandLineParameterValues values)
 {
     _values = values;
 }
コード例 #2
0
        void ParseParameters(IEnumerable<string> args)
        {
            const string shortHelpText = "Try `runSpecflowTests.exe --help' for more information.";

            var arguments = new CommandLineParameterValues();
            var p = new OptionSet()
                        {
                            {
                                "p=|projectFile=", "The path to the csproj file which contain the SpecFlow tests.",
                                v => { arguments.ProjectFile =  "\"" + v + "\"" ?? string.Empty; }
                            },
                            {
                                "t=|testContainer=", "The path to the assembly file which contain the Specflow tests.",
                                v => { arguments.TestContainer =  "\"" + v + "\"" ?? string.Empty; }
                            },
                            {
                                "o=|outputLocation=", "The path where the output will be stored.",
                                v => { arguments.OutputLocation = "\"" + v ?? string.Empty; }
                            },
                            {
                                "of=|outputFilename=", "The name of the output file which will be stored in the output location.",
                                v => { arguments.OutputFilename = v ?? string.Empty; }
                            },
                            {
                                "h|help", "show this message and exit", v => { arguments.ShowHelp = (v != null); }
                            }
                        };

            try
            {
                p.Parse(args);

                var messages = new List<string>();
              //  var reportBuilder = new SpecFlowTestReportBuilder(arguments);

              //  var result = reportBuilder.Build(out messages);
              //  Console.ReadLine();
            }
            catch (OptionException e)
            {
                ShowShortHelp(shortHelpText);
                return;
            }

            if (arguments.ShowHelp)
            {
                ShowHelp(p);
                return;
            }

            if (! arguments.EnsureCommandLineParameterValuesAreSet())
            {
                ShowShortHelp(shortHelpText);
            }
            else
            {
                var errors = new List<string>();
                if (!arguments.CheckArguments(out errors))
                {
                    if (errors != null && errors.Count > 0)
                    {
                        ShowErrors(errors);
                    }
                }
            }
        }