Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tagging feedback #206

Open
ben-foster-cko opened this issue Feb 23, 2019 · 2 comments
Open

Tagging feedback #206

ben-foster-cko opened this issue Feb 23, 2019 · 2 comments

Comments

@ben-foster-cko
Copy link

Hey guys,

We're looking at ways in which we can improve debugging in nspec especially for an individual example. One solution I've come up with is to extend the nspec base class with the following:

        public nspec()
        {
            _it = new ActionRegister((name, tags, action) => it[name, "debug"] = action);
        }
        
        public ActionRegister _it;

Then in the VS Code launch configuration providing the debug tag when calling dotnet run.

This is a bit of a precursor for a workshop I'm having with my team in Berlin next week as they have started putting some time into the VS Test Adaptor. One challenge with the adaptor is how to run a single example, without having to change the code like I'm doing above. Had you ever explored this? It would require each example to have some kind of identity within the context tree so that it can be identified at runtime.

@GiuseppePiscopo
Copy link
Collaborator

GiuseppePiscopo commented Feb 27, 2019

Just pasting here my (amended) twitter reply, to the benefit of public discussion:

Regarding what is already available, I remember two ways:

  • in VS, with NSpec.VsAdapter, you can right-click on the test view to run a single context. If you pick a single it, all its siblings will be run anyway
  • in NSpec runner from command line, you can temporarily change the test code to add a "focus" attribute on context / it, to just run that

I don't know how/if things work in VS Code w.r.t. full VS.

Regarding new features, I'm ok to see a new one if that helps. Not sure what would you use, from the outside, as an identifier for a test case, apart from its "breadcrumb", so to say: context / subcontext / subcontext / it

@amirrajan
Copy link
Collaborator

amirrajan commented Mar 17, 2019

System.Diagnostics.Debugger.Launch or roll your own Program.cs console app which is really simple:

https://gist.github.com/amirrajan/236cbaafef2c7c2195b47c41cbf9c918#file-program-cs

With building your own console app, you'd put the breakpoint in there and run that instead of using the nspec runner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants