Closed raghur closed 8 years ago
Could you provide the surrounding code too? Is there any before
are act
still being executed?
/cc @BrainCrumbz
here's a complete class
[Tag("dummy")]
class Dummy_Specs : nspecbase
{
public void describe_scenario()
{
it["should run"] = () =>
{
5.should_be(5);
};
it["takes longer"] = () =>
{
Thread.Sleep(1000);
5.should_be(5);
};
xitAsync["a pending spec"] = async () =>
{
await Task.Delay(10);
"Should not be printed".Info();
};
}
}
Will have a look at it in these next days. Thanks for the full class example, that will be the first thing to try!
.. but from a quick look it seems the problem lies in Context.HandleSkipped(...)
here, which considers only a sync example, not an async one.
Will have to also double-check NSpec tests as well, whether this test case is missing or what.
Hi there. Trying with following spec class and everything seems fine ... which maybe strange after all, but anyway:
[Tag("dummy")]
class Dummy_Specs : nspec
{
public void describe_scenario()
{
it["should run"] = () =>
{
5.Should().Be(5);
};
it["takes longer"] = () =>
{
Thread.Sleep(1000);
5.Should().Be(5);
};
xitAsync["a pending spec"] = async () =>
{
await Task.Delay(10);
Console.WriteLine("Should not be printed");
};
}
}
The differences are:
nspec
. Not sure what that nspecbase
does in your caseConsole.WriteLine
, instead of that Info
extension methodHow are you running your spec? I'm going through our VS adapter. Here are the results:
Anyway will have a look at test cases and the aforementioned line code.
I'm running the test from the command line runner. Pasted your class in and ran it with similar results Have you tried running with the NspecRunner?
D:\code\iotnext\IotNext.ApiClient\src>packages\nspec.1.0.7\tools\NSpecRunner.exe IotNext.ApiTests\bin\Debug\IotNext.ApiTests.dll --tag dummy2
Dummy2 Specs
describe scenario
should run (31ms)
takes longer (1s)
a pending spec - PENDING
**** FAILURES ****
nspec. Dummy2 Specs. describe scenario. a pending spec.
'xit' cannot be set to an async delegate, please use 'xitAsync' instead
Thanks for feedback. The error is actually visible also in VS test runner when debugging, but otherwise it gets swalloved somehow. Currently looking at it.
Please have a look at commits until this one, they should fix this.
I'll merge and deploy as soon as I get a thumbs up. The commit looks good.
@braincrumbz the link is broken
Never mind... Found the commit... Do you want me to pull this commit and build and test? Don't know enough of the code though to content on it
Sorry about that, somehow the link had only the commit ID, not the whole URL. Now's fixed.
If you could, it'd be enough to try testing with NSpec dll built out of that commit, in place of the one you already have within NSpec package folder in your project. I think this is the kind of thumbs up @amirrajan was expecting.
Ok - I built it with that commit (actually latest master - and still see the issue)
**** FAILURES ****
nspec. Dummy Specs. describe scenario. a pending spec.
'xit' cannot be set to an async delegate, please use 'xitAsync' instead
Uhm. Trying from console with aforementioned Dummy_Specs
class:
Dummy Specs
describe scenario
should run (357ms)
takes longer (1s)
a pending spec - PENDING
3 Examples, 0 Failed, 1 Pending
Ah - my fault - so I compiled against Nspec.dll from the commit you listed but used old nspecrunner
..Duh..
Well, yeah, the change actually is in NSpec, not NSpecRunner, but then if the old NSpecRunner was still using the original NSpec.dll, I guess you were missing the change.
Closing the ticket
I have a few async
itAsync
specs that I need to temporarily disable. Intellisense prompts forxitAsync
the examples are not run - but at the end of the test failures are printed like so