Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the TestCaseSource is executed before TestFixtureSetUp in Nunit

I have to create database on the setup event and drop into teardown event,the flow is working when i have not used TestCaseSource.But the moment come i have to used TestCaseSource then the execution order of NUnit test case is changed.

My database is not created (you can say setup event not called),But I have to used TestCaseSource for pulling data from table which is created by the setup event and dropped into teardown .

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

Thanks in advance

like image 577
Neeraj Dubey Avatar asked Sep 30 '14 11:09

Neeraj Dubey


1 Answers

I think what you are saying is that using TestCaseSource results in attempting to pull data from a database that has not been created yet (in a SetUp method).

This is just the way NUnit works, see https://github.com/nunit/nunit/issues/141

Maybe you could have TestCaseSource return the query/queries you want to test (instead of the data), and execute the query in the test (after your SetUp has run)?

like image 101
Nick Baker Avatar answered Dec 18 '22 20:12

Nick Baker