Why is TestCaseSource executed before TestFixtureSetUp in Nunit

I need to create a database in the setup event and go to the teardown event, the thread works when I did not use TestCaseSource . But at this point I need to use TestCaseSource , then the execution order from NUnit changed.

My database is not created (you can say that the setup event is not raised), but I have to use TestCaseSource to pull the data from the table that is created by the setup event and placed in teardown .

Please suggest how to work with this type of scenario. I am using VS 2013

Thanks in advance

+5
source share
2 answers

I think that you say that using TestCaseSource leads to an attempt to retrieve data from a database that has not yet been created (in the SetUp method).

This is how NUnit works, see https://github.com/nunit/nunit/issues/141

Perhaps you could return the TestCaseSource request / requests you want to test (instead of data) and execute the request in the test (after running SetUp)?

+1
source

Can't you just call the install and break code in the TestCaseSource provider?

0
source

Source: https://habr.com/ru/post/1203709/


All Articles