machine.specifications icon indicating copy to clipboard operation
machine.specifications copied to clipboard

Report nested contexts

Open agross opened this issue 12 years ago • 7 comments

Just like rspec, print nested contexts on the console, in ReSharper and the HTML/XML reports.

agross avatar Feb 01 '13 16:02 agross

I'd like to look at this one. Should it print the full context in one line for all of these reporters?

theimowski avatar Jul 18 '14 15:07 theimowski

@agross what's your take on this? I really have no opinion at all ;)

danielmarbach avatar Jul 18 '14 18:07 danielmarbach

What's required for this to work is quite a lot IMHO:

  • a revamped reporting model with parent/child relationships
  • updated HTML and XML reports as well as the obvious ones (console/TD.net)
  • a defined process which Establish and Cleanup delegates are run in which order
  • probably rewritten runners, i.e. ReSharper would need to create UnitTestElements for all the parents

That said, I think it's a major effort that's not done over the weekend.

agross avatar Jul 18 '14 21:07 agross

So currently not worth the risk and effort. Especially not now because I want to have a stable interface between the core and the resharper runner

danielmarbach avatar Jul 18 '14 21:07 danielmarbach

class When_given_X
{
    class and_Y
    {
        Because of = () => { };

        It should_happen_something = () => { };
    }

    class and_Z
    {
        Because of = () => { };

        It should_happen_something_else = () => { };
    }
}

... at the moment, this results in the following visualization:

R# runner

Instead of the full-blown solution, which seems to be hard to implement, what about a simpler solution in the meantime: just concatenate the context strings (and stay with the flat model)?

<MSpecSample> (2 tests)
  When X and Y
    should happen something
  When X and Z (1 test)
    should happen something else

This would be a big help for people, which use nested contexts (which is one of the big advanages over all xUnit frameworks).

ulrichb avatar Oct 15 '14 14:10 ulrichb

I would like this as well

shaynevanasperen avatar Dec 15 '14 12:12 shaynevanasperen

I definitely think this is how it should work.

I got all excited when experimenting with mspec and finding how it handled nested contexts. Then I saw the output and my smile turned upside down. When only the inner-most of the nested contexts is reported the test report becomes completely incomprehensible instead of the human readable specification that it could/should be.

mlidbom avatar Jan 26 '17 14:01 mlidbom