-
Notifications
You must be signed in to change notification settings - Fork 723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested TestFixtureSource type #2585
Comments
As you discovered, Fixtures don't work with multiple sources. NUnit only gets to construct the fixture once, with one set of parameters, so only one source can be allowed. Currently, the only NUnit-powered option is to use TestCaseSource on the methods. To implement this with one fixture source, you would have to include the Driver along with the other arguments. Your internal logic in the source could be implemented with nested loops and yield the appropriate values in the inner one. For longer term, this sort of use case might be a motivator for allowing parameterized OneTimeSetUp on a fixture. |
Okay that makes sense. I think creating a type that holds the driver and url and throwing that into IEnumerable would work. Having a parametrized OneTimeSetUp was actually something I went looking for. That would be a really nice feature. Thanks for the reply. I will give this a go tomorrow. |
@CharliePoole What do you think of allowing |
@jnm2 My first reaction was "We have an issue for that!" but I can't find one. 😞 We had lots of discussion of this in the past. We were going to implement parameterized fixtures in three stages: (1) like TestCase, (2) like TestCaseSource and (3) like Values, Random, etc. together with the various combining strategies. As far as I can see, the issues were all closed after we did (1) and (2) and we just stopped tracking (3). I'm not sure how or if that would solve the current issue but I think it's a feature we should have and is worth its own issue. |
Opened #2673 to track my suggestion. @mitchellmaler, do you think the ability to put |
I am closing old uncategorized issues that have not had comments or made progress in several years. If anyone comes back with a compelling argument for these issues, we can reopen. |
Hello,
I have a use case to run selenium CMS tests based off of configuration files. The idea is they enable which browser to run as and then provide an array of URLs that the CMS provides for. I then would have a IEnumerable for the browses and one for the URLs. I would like the TestFixture to generate a Driver for each enabled browser and then for each url run each of the test methods in the class.
The setup would generate the webdriver/browser session and then navigate to the current url.
I have been successful on adding a single IEnumerable in a base class that does all the setup. I then tried to add a second TestFixtureSource to the actual fixture but that doesn't seem to work.
If was hoping to see if this is even possible and if not are then any other ideas. I would rather not add a TestCaseSource on each method since it would be a lot of duplicate code.
The text was updated successfully, but these errors were encountered: