RowTests?

Posted in General by Mel Grubb Thu Apr 04 2019 12:54:34 GMT+0000 (Coordinated Universal Time)·4·Viewed 396 times

Are there any examples of using SpecsFor with NUnit's RowTests? (Now called TestCase, I believe) I'd like to replace some SpecFlow (ewww) tests with SpecsFor, but they're making heavy use of the table inputs. The modern NUnit equivalent seems to be the TestCase attribute, but where would it go? It's normally used in place of the [Test] attribute, but the parameters really should be going to the When method. I could just ditch the When, use TestCase and be done with it, but I guess I'm looking for the "yup, that's how you do it" here.
Apr 5, 2019

I don't have an example of that. I remember doing that at one time, but that was an older version of SpecsFor... SpecsFor really does need to be updated for the latest changes in NUnit, I just haven't had time. :(

Apr 5, 2019

Since it's NUnit running the show under the covers (at least for me), I'm assuming this would work. I just don't know what it should look like. I can rowtest the individual tests, but it just seems like the attribute really behind on the When. Maybe I can help. What kind of changes are you expecting?

Apr 5, 2019

"Belongs" not "behind"... stupid autocorrect

Apr 8, 2019

Agreed, that sort of thing would ideally go on the Given/When, not on the individual test case. At one point in time, SpecsFor had something similar to that with attribute-based context classes, but it was almost never used, and it was eventually removed.

As far as updates, I'm a bit behind the times, but aren't there some new attributes and patterns that NUnit 3.x+ supports now? SpecsFor is built against NUnit 3.x now, but it still really just supports the same patterns as it did back in the 2.x days....

  
Markdown is allowed