Build/Test Issues

Run Tests explicit in "VisualStudio" compatible way

Started by mgrundner on 1,584 views

I am running a rather large testsuite in combination with Verify.

Currently i run into a lot of troubles (and also in the past) when i use it in combo with Verify.


I've read this https://stackoverflow.com/questions/60710020/when-using-ncrunch-how-would-differences-reported-from-verify-nunit-be-approved and it seams to work fine,
but: if i use

Verifier.UseProjectRelativeDirectory("__SNAPSHOTS__");

//Or 

Verifier.DerivePathInfo(
    (sourceFile, projectDirectory, type, method) =>
    {
        return new(
            directory: Path.Combine(projectDirectory, "__SNAPSHOTS__"),
            typeName: type.Name,
            methodName: method.Name
        );
    }
);


It falls appart.

I know this is not in the primary domain of NCrunch, and i try to get a discussion going on with Simon Cropp.
But it's just an idea, would it be possible to add a solution configuration that just let run NCrunch in a mode where it just runs relative to the project root in explicit mode? I think this will solve a lot of tooling related troubles with NCrunch.

Maybe i miss something obvious, or its a bug in Verify. But sometimes it drives me crazy that NCrunch behaves so differently sometime (fyi: I needed to set my ncrunch root to c:\n because of the path 265 limitation)

The main reason for me to change the root dir of Verify is that i am multitargeting a blazor lib that needs to verify it's content in net.6, 7, 8 and up, but it needs to render all its html compatible, so i just want to store 1 golden master if that makes sense.

Hoping for any ideas and kind regards

Manuel
Hi Manuel,

Thanks for posting, and I apologise for the clear frustation that you've experienced here.

I think that what you're asking for is whether NCrunch could be adjusted to run tests in the same manner as VS (or other test runners) by simply using the binaries that are output from the foreground solution that is open inside VS. Unfortunately, there is no way we can really implement this. The entire architecture of NCrunch was built on being able to separate projects from their parent solution so that they could be manipulated, built and executed in isolation. While I understand that avoiding such isolation would make life easier in specific scenarios like yours, much of what we've built in NCrunch would fail to work entirely and would need to be built around a completely different set of constraints. In short: We can't do it.

Usually it's possible to work around NCrunch's workspacing by using the methods available on the NCrunchEnvironment class. Unfortunately I can't provide guidance on how to configure Verify in your situation, but I believe Simon has already done some work to make the tool aware of NCrunch and able to respond to its environment.
Hi Remco!

Yeah I was afraid this is the case, however just wanted to make sure I did not miss any obvious setting or so.

However: I think in combination with NCrunchEnvironment.GetOriginalProjectPath i might get a workaround.

I'll try to figure out a solution with Simon and let you know our progress.

Thanks anyway :)
This post has been deleted.

Post a reply

Log in to reply.