Skip to content

Commit

Permalink
Adding a switch to disable TeamCity autodetection (refers to discussi…
Browse files Browse the repository at this point in the history
…on in machine#62)
  • Loading branch information
agross committed Jun 15, 2012
1 parent 07538ae commit 0772bae
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 24 deletions.
27 changes: 14 additions & 13 deletions README.markdown
Expand Up @@ -71,20 +71,21 @@ MSpec, like other testing frameworks, provides a robust command-line runner that

Usage of the command-line runner is as follows (from `mspec.exe --help`):

<pre>
Usage: mspec.exe [options] &lt;assemblies&gt;
```
Usage: mspec.exe [options] <assemblies>
Options:
-i, --include Executes all specifications in contexts with these comma delimited tags. Ex. -i "foo,bar,foo_bar"
-x, --exclude Exclude specifications in contexts with these comma delimited tags. Ex. -x "foo,bar,foo_bar"
-t, --timeinfo Shows time-related information in HTML output
-s, --silent Suppress console output
-w, --wait Wait 15 seconds for debugger to be attached
--teamcity Reporting for TeamCity CI integration (auto-detected)
--html &lt;PATH&gt; Outputs the HTML report to path, one-per-assembly w/ index.html (if directory, otherwise all are in one file)
--xml &lt;PATH&gt; Outputs the XML report to the file referenced by the path
-h, --help Shows this help message
Usage: mspec.exe [options] &lt;assemblies&gt;
</pre>
-i, --include Executes all specifications in contexts with these comma delimited tags. Ex. -i "foo,bar,foo_bar"
-x, --exclude Exclude specifications in contexts with these comma delimited tags. Ex. -x "foo,bar,foo_bar"
-t, --timeinfo Shows time-related information in HTML output
-s, --silent Suppress console output
-w, --wait Wait 15 seconds for debugger to be attached
--teamcity Reporting for TeamCity CI integration (also auto-detected)
--no-teamcity-autodetect Disables TeamCity autodetection
--html <PATH> Outputs the HTML report to path, one-per-assembly w/ index.html (if directory, otherwise all are in one file)
--xml <PATH> Outputs the XML report to the file referenced by the path
-h, --help Shows this help message
Usage: mspec.exe [options] <assemblies>
```

#### Selenium Support in the command-line runner

Expand Down
26 changes: 16 additions & 10 deletions Source/Machine.Specifications.ConsoleRunner/Options.cs
Expand Up @@ -37,9 +37,14 @@ public class Options

[Option(null,
"teamcity",
HelpText = "Reporting for TeamCity CI integration (auto-detected)")]
HelpText = "Reporting for TeamCity CI integration (also auto-detected)")]
public bool TeamCityIntegration = false;

[Option(null,
"no-teamcity-autodetect",
HelpText = "Disables TeamCity autodetection")]
public bool DisableTeamCityAutodetection = false;

[OptionList("i",
"include",
HelpText = "Execute all specifications in contexts with these comma delimited tags. Ex. -i \"foo,bar,foo_bar\"",
Expand Down Expand Up @@ -69,15 +74,16 @@ public string GetUsage()
sb.AppendLine("");
sb.AppendLine(Usage());
sb.AppendLine("Options:");
sb.AppendLine(" -i, --include Execute all specifications in contexts with these comma delimited tags. Ex. -i \"foo,bar,foo_bar\"");
sb.AppendLine(" -x, --exclude Exclude specifications in contexts with these comma delimited tags. Ex. -x \"foo,bar,foo_bar\"");
sb.AppendLine(" -t, --timeinfo Shows time-related information in HTML output");
sb.AppendLine(" -s, --silent Suppress console output");
sb.AppendLine(" -w, --wait Wait 15 seconds for debugger to be attached");
sb.AppendLine(" --teamcity Reporting for TeamCity CI integration");
sb.AppendLine(" --html <PATH> Outputs the HTML report to path, one-per-assembly w/ index.html (if directory, otherwise all are in one file)");
sb.AppendLine(" --xml <PATH> Outputs the XML report to the file referenced by the path");
sb.AppendLine(" -h, --help Shows this help message");
sb.AppendLine(" -i, --include Execute all specifications in contexts with these comma delimited tags. Ex. -i \"foo,bar,foo_bar\"");
sb.AppendLine(" -x, --exclude Exclude specifications in contexts with these comma delimited tags. Ex. -x \"foo,bar,foo_bar\"");
sb.AppendLine(" -t, --timeinfo Shows time-related information in HTML output");
sb.AppendLine(" -s, --silent Suppress console output");
sb.AppendLine(" -w, --wait Wait 15 seconds for debugger to be attached");
sb.AppendLine(" --teamcity Reporting for TeamCity CI integration (also auto-detected)");
sb.AppendLine(" --no-teamcity-autodetect Disables TeamCity autodetection");
sb.AppendLine(" --html <PATH> Outputs the HTML report to path, one-per-assembly w/ index.html (if directory, otherwise all are in one file)");
sb.AppendLine(" --xml <PATH> Outputs the XML report to the file referenced by the path");
sb.AppendLine(" -h, --help Shows this help message");

return sb.ToString();
}
Expand Down
4 changes: 3 additions & 1 deletion Source/Machine.Specifications.ConsoleRunner/Program.cs
Expand Up @@ -50,7 +50,9 @@ public ExitCode Run(string[] arguments)
listeners.Add(new AssemblyLocationAwareListener());

ISpecificationRunListener mainListener;
if (options.TeamCityIntegration || Environment.GetEnvironmentVariable("TEAMCITY_PROJECT_NAME") != null)
if (options.TeamCityIntegration ||
(!options.DisableTeamCityAutodetection &&
Environment.GetEnvironmentVariable("TEAMCITY_PROJECT_NAME") != null))
{
mainListener = new TeamCityReporter(_console.WriteLine, timingListener);
}
Expand Down

0 comments on commit 0772bae

Please sign in to comment.