NUnit load test data from sub class to base class to test data source

I am using C# and NUnit to do some Automation testing of client code. So for each client a lot of the processes that are followed are the same eg. A file is loaded in, this database table is checked againt some data. What I am trying to do is have a base unit test class whereby each client that inherits from the base just populates a file name then the base class uses that file as the data for the unit tests.

So I created my NUnit tests, marked the class as abstract, created abstract properties and my sub class tests run and run the base class tests fine. The issue I am having to use the data from the file I load in the sub class as a data source for the base class. NUnit requires the data source to be a static value, I just can’t seem to get the sub class to pass the data to a static on the base class that can be used as the data source for the tests.

Not at the computer right now to paste a snippet but hopefully the above is enough for someone to point me in a general direction as the tests for each client are very much data driven so I want to be able to setup a configuration of sorts for each client that then calls a subset of tests passing in data from files listed in the config.

So in tests for client A, it uses file ABC for tests 1 For client B, it uses file DEF

The other alternative is to not use NUnit attributes and pass the file in via the constructor then manually loop through the rows and do the asserts myself.

Any help would be appreciated


How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum