Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Faster Spec debugging #47

Merged
merged 1 commit into from

2 participants

M Alix Amir Rajan
M Alix

The assembly is already loaded, we can just use it...

M Alix malixsys Faster Spec debugging
The assembly is already loaded, we can just use it...
fefc43c
Amir Rajan amirrajan merged commit fefc43c into from
Amir Rajan
Collaborator

Thanks for the update. It's more lines of code, but will give developers a good amount of insight on how specs are run and constructed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 27, 2012
  1. M Alix

    Faster Spec debugging

    malixsys authored
    The assembly is already loaded, we can just use it...
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 5 deletions.
  1. +9 −5 NSpecSpecs/DebuggerShim.cs
14 NSpecSpecs/DebuggerShim.cs
View
@@ -7,7 +7,7 @@
* Howdy,
*
* This is NSpec's DebuggerShim. It will allow you to use TestDriven.Net or Resharper's test runner to run
- * NSpec tests.
+ * NSpec tests that are in the same Assembly as this class.
*
* It's DEFINITELY worth trying specwatchr (http://nspec.org/continuoustesting). Specwatchr automatically
* runs tests for you.
@@ -27,11 +27,15 @@ public void debug()
{
var tagOrClassName = "class_or_tag_you_want_to_debug";
- var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, tagOrClassName);
-
- var contexts = invocation.Run();
+ var types = GetType().Assembly.GetTypes();
+ // OR
+ // var types = new Type[]{typeof(Some_Type_Containg_some_Specs)};
+ var finder = new SpecFinder(types, "");
+ var builder = new ContextBuilder(finder, new Tags().Parse(tagOrClassName), new DefaultConventions());
+ var runner = new ContextRunner(builder, new ConsoleFormatter(), false);
+ var results = runner.Run(builder.Contexts().Build());
//assert that there aren't any failures
- contexts.Failures().Count().should_be(0);
+ Assert.AreEqual(0, results.Failures().Count());
}
}
Something went wrong with that request. Please try again.