Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could we use only one ClassInitialize for all the Unit Testing classes?

I started an internship where my job consists of seting up unit tests on some projects.

I have already implemented dozens of tests and now I want to create a mechanism which restores the original database after or before each run.

I have the necessary scripts to create, populate and drop my database, but I don't want to call this mechanism each test classes, but instead call it just once.

Is it possible to create a ClassIniatialize() who is called only once when I start one or all the tests?

EDIT

All I/you need is to use AssemblyInitialize() and AssemblyCleanUp() and all is resolved, ;)

like image 683
Leop Avatar asked May 27 '26 12:05

Leop


1 Answers

All I/you need is to use AssemblyInitialize() and AssemblyCleanUp() and all is resolved, ;)

like image 86
Leop Avatar answered May 30 '26 06:05

Leop



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!