Skip to main content

This question is about the unit testing framework xUnit.netxUnit.net.

I need to run some code before any test is executed, and also some code after all tests are done. I thought there should be some kind of attribute or marker interface to indicate the global initialization and termination code, but couldn't find them.

Alternatively, if I invoke xUnit programmatically, I can also achieve what I want with the following code:

static void Main() { try { MyGlobalSetup(); RunAllTests(); // What goes into this method? } finally { MyGlobalTeardown(); } } 

Can anyone provide me a hint about how to declaratively or programmatically run some global setup/teardown code?

This question is about the unit testing framework xUnit.net.

I need to run some code before any test is executed, and also some code after all tests are done. I thought there should be some kind of attribute or marker interface to indicate the global initialization and termination code, but couldn't find them.

Alternatively, if I invoke xUnit programmatically, I can also achieve what I want with the following code:

static void Main() { try { MyGlobalSetup(); RunAllTests(); // What goes into this method? } finally { MyGlobalTeardown(); } } 

Can anyone provide me a hint about how to declaratively or programmatically run some global setup/teardown code?

This question is about the unit testing framework xUnit.net.

I need to run some code before any test is executed, and also some code after all tests are done. I thought there should be some kind of attribute or marker interface to indicate the global initialization and termination code, but couldn't find them.

Alternatively, if I invoke xUnit programmatically, I can also achieve what I want with the following code:

static void Main() { try { MyGlobalSetup(); RunAllTests(); // What goes into this method? } finally { MyGlobalTeardown(); } } 

Can anyone provide me a hint about how to declaratively or programmatically run some global setup/teardown code?

Fix spelling, clarify some sentences, better title, added [c#] and [.net] tags
Source Link
Lukas Kabrt
  • 5.5k
  • 4
  • 45
  • 59

This question is about the unit testing framework xUnit.net.

I need to run some code before any test is executed, and also some code after all tests are done. I thought there should be some kind of attribute or marker interface to indicate the global initialization and termination code, but couldn't find them.

Alternatively, if I invoke xUnit programmatically, I can also achieve what I want with the following code:

static void Main() { try { MyGlobalSetup(); RunAllTests(); // What goes into this method? } finally { MyGlobalTeardown(); } } 

Can anyone provide me a hint about how to declaratively or programmatically run some global setup/teardown code?

Thanks.

This question is about the unit testing framework xUnit.net.

I need to run some code before any test is executed, and also some code after all tests are done. I thought there should be some kind of attribute or marker interface to indicate the global initialization and termination code, but couldn't find them.

Alternatively, if I invoke xUnit programmatically, I can also achieve what I want with the following code:

static void Main() { try { MyGlobalSetup(); RunAllTests(); // What goes into this method? } finally { MyGlobalTeardown(); } } 

Can anyone provide me a hint about how to declaratively or programmatically run some global setup/teardown code?

Thanks.

This question is about the unit testing framework xUnit.net.

I need to run some code before any test is executed, and also some code after all tests are done. I thought there should be some kind of attribute or marker interface to indicate the global initialization and termination code, but couldn't find them.

Alternatively, if I invoke xUnit programmatically, I can also achieve what I want with the following code:

static void Main() { try { MyGlobalSetup(); RunAllTests(); // What goes into this method? } finally { MyGlobalTeardown(); } } 

Can anyone provide me a hint about how to declaratively or programmatically run some global setup/teardown code?

Fix spelling, clarify some sentences, better title, added [c#] and [.net] tags
Source Link

xUnit global.net: Global setup /+ teardown?

This question is about testthe unit testing framework xUnit.net / C#.

I need to run some code before any test is executed, and also some code after all tests are done. I thought there mustshould be some attributeskind of attribute or marker interface to indicate the global initialization and termination code, but couldn't find them.

Alternatively, if I can invoke xUnit programmatically, I can also achieve what I want to do bywith the following code:

...static void Main(string[] args)   {   try  {   MyGlobalSetup();   RunAllTests(); // What goes into this method?   }   finally  {   MyGlobalTeardown();   } } 

Can anyone provide me somea hint about how to declaratively or programmallyprogrammatically run some global setup/teardown code?

Thanks.

xUnit global setup / teardown

This question is about test framework xUnit / C#

I need to run some code before any test is executed and also some code after all tests are done. I thought there must be some attributes or marker interface to indicate the global initialization and termination code but couldn't find them.

Alternatively, if I can invoke xUnit programmatically, I can also achieve what I want to do by the following code:

... Main(string[] args) { try { MyGlobalSetup(); RunAllTests(); // What goes into this method? } finally { MyGlobalTeardown(); } } 

Can anyone provide me some hint about how to declaratively or programmally run some global setup/teardown code?

Thanks

xUnit.net: Global setup + teardown?

This question is about the unit testing framework xUnit.net.

I need to run some code before any test is executed, and also some code after all tests are done. I thought there should be some kind of attribute or marker interface to indicate the global initialization and termination code, but couldn't find them.

Alternatively, if I invoke xUnit programmatically, I can also achieve what I want with the following code:

static void Main()  {   try  {   MyGlobalSetup();   RunAllTests(); // What goes into this method?   }   finally  {   MyGlobalTeardown();   } } 

Can anyone provide me a hint about how to declaratively or programmatically run some global setup/teardown code?

Thanks.

Replaced xunit tag with xunit.net tag as it is specific to this framework and not a general framework agnostic xunit question.
Link
Loading
added 96 characters in body
Source Link
Codism
  • 6.3k
  • 6
  • 32
  • 29
Loading
Post Migrated Here from programmers.stackexchange.com (revisions)
Source Link
Codism
  • 6.3k
  • 6
  • 32
  • 29
Loading