Open alteredego opened 2 years ago
I am not familiar with NCrunch. Is it copying the files in another location and does not copy everything?
Yes, it does make a copy of the working directory project structure, and I suppose it could well be missing something. It usually copies over everything related to the project and works with dynamic code generation etc, but perhaps it is not executing a stage of the build pipeline. I remember reading somewhere about BeforeBuild/AfterBuild targets not being executed, if that's a hint to why it might not be working?
Is there any way I can force the load/location of the plugin, or otherwise log or debug the part of the process that would load and initialise plugins? I'm assuming that the main Specflow part of this is running properly as it is generating the feature.cs generated code partial class and other parts of NCrunch are working as expected - it's giving me per-line traffic lights in the feature file etc (when I've added manual DI setup)
The DI registrations are missing, because the runtime plugin isn't loaded. SpecFlow searches in some folders for the plugins. If NCrunch didn't copied the plugin to the new location, SpecFlow can't find it.
So I checked it and yes, the assembly isn't copied into the NCrunch workspace folder.
The strange is, that in the case of SpecFlow.Actions.Playwright.IntegrationTests
the missing assembly is a simple project reference.
So there are no special MSBuild things to get the file into the output folder.
All other plugins that are coming from NuGet packages are copied correctly.
Perhaps can the NCrunch team help us here. I am happy to adjust stuff in the project/nuget packages if needed, but I have no idea what to change.
@SabotageAndi - thank you for taking a look at this, much appreciated.
I'm not entirely sure how NCrunch works its magic here. Taking a look into each of the workspace/build folders it generates, I think it might be that the build output dll's are in different folders per project, so perhaps at runtime the mechanism for triggering the plugin initialisation is unable to find the plugin dll's. Although at runtime, .net is definitely loading them as I can setup DI manually.
There appears to be a config item in NCrunch called "CopyReferencedAssembliesToWorkspace" which I thought might help - there are a lot more dll's in the build/workspace folder after enabling that - but I still get the same DI issues, so I'm assuming the plugin initialisation is still not being triggered correctly.
Hi
I'm pretty new to trying this stuff out, so I apologise if I'm missing something obvious.
I'm attempting to use Playwright + SpecFlow.Actions.Playwright alongside NCrunch, but it seems the plugin isn't being initialised correctly and I'm getting a DI error. I'm not sure how this is usually triggered or why it isn't when using NCrunch? It is working correctly by running "dotnet test" on a command line, or within Visual Studio (2022) Test Runner.
Example exception -
This can be reproduced when trying to run the tests within SpecFlow.Actions.Playwright.IntegrationTests project.
This may well be something to do with NCrunch, but if I don't use SpecFlow.Actions.Playwright, I have managed to run tests successfully and I see NCrunch statuses alongside each line of the feature file etc.
I can also get things running by manually configuring DI in a [BeforeTestRun] method, but this just feels wrong. How can I trigger the plugin initialisation lifecycle correctly?
Any help/guidance in helping debug this much appreciated.