Closed priveLupus closed 5 months ago
Yes, this seems to be a problem. (SpecFlow has the "TechTalk." prefix in the namespace, and that's why it was better working there.)
@priveLupus Could you please try to simulate the problem in a standard C# class library (without any feature file or Reqnroll package ref), that contains a file with an arbitrary class and a file that contains a class similar to the one Reqnroll generates?
Maybe that would help to figure out what we need to change in the generator to fix this issue. Maybe we just need to include a couple of more global::
prefix somewhere...
I did. And it seems that adding the global::
prefix to all of them would fix my issues. Works with both solutions. Want me to try it out in the source code and open an PR if it works?
@priveLupus would be really appreciated. feel free to ask for help if you get stuck. The generator part of Reqnroll is pretty tricky sometimes.
With the new Reqnroll.SystemTests the fix could be well guided. I think this will need a test in the GeneratorTestBase, so that it will be checked with all 3 test runners.
This would be a good feedback for the new system test concept.
@reqnroll/core-team anyone up for this?
I will attempt it.
Anything special or particular to be aware of with this issue?
@clrudolphi As mentioned above, hopefully the fix will be to just add some "global" prefixes to the type declarations. I think the trickier will be to make the test. The test can be very similar to the one in the smoke test class, but we probably need to have a step with data table as well. I haven't checked, but surely there must be a way to configure the project name to be generated, so you can set it to something ends with ".Reqnroll".
I can help if you get stuck.
OK. I think we have two options and would like your direction. Option 1: modify all references to ReqnRoll types in the generated source such as global::Reqnroll.ITestRunner
Option 2: Set up a using alias at the top of the generated file such as: using Reqnroll = Reqnroll; and then modify all references to Reqnroll types as Reqnroll::ITestRunner
The first works because the Reqnroll namespace is opened at the global level in the ImplicitUsings.cs file. The second works only if an alias is established within each generated file.
In either case, the referencing syntax has to change to include the namespace alias qualifier ::
Which would you prefer?
@clrudolphi I would go for option 1.
Fixed by #85, thx @clrudolphi!
Reqnroll Version
1.0.1
Which test runner are you using?
xUnit
Test Runner Version Number
2.5.6
.NET Implementation
.NET 6.0
Test Execution Method
Visual Studio Test Explorer
Content of reqnroll.json configuration file
No response
Issue Description
We use several frameworks in our solution, so using the names as part of the project name, assembly name and root namespace seemed logical. Putting Reqnroll in the root namespace however creates the following errors:
Steps to Reproduce
create new Reqnroll Project in Visual Studio and add
<RootNamespace>Whatever.Reqnroll</RootNamespace>
to the project fileLink to Repro Project
No response