Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit testing on a build server : Release or Debug code?

In .NET(C#) is there any advantage/disadvantage to go with debug/release build for unit testing?

Which target configuration do you usually use for unit testing on a build server? Does it matter?

What about code coverage (for this one I'm guessing debug versions are needed).

like image 468
Benoittr Avatar asked Aug 05 '10 15:08

Benoittr


People also ask

Should unit tests be run in debug or Release?

I'd recommend running the release code. For a couple of reasons. 1) It is the code that the customers will be using. 2) Some code has special debug conditionals that will produce differences between the debug and release builds.

What is the difference between Release and debug build?

By default, Debug includes debug information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled. As far as conditional compilation goes, they each define different symbols that can be checked in your program, but they are language-specific macros.

Can you debug a unit test code?

Debug and analyze unit tests with Test ExplorerYou can use Test Explorer to start a debugging session for your tests. Stepping through your code with the Visual Studio debugger seamlessly takes you back and forth between the unit tests and the project under test.

Can you debug a Release build?

You can now debug your release build application. To find a problem, step through the code (or use Just-In-Time debugging) until you find where the failure occurs, and then determine the incorrect parameters or code.


1 Answers

I'd recommend running the release code. For a couple of reasons.

1) It is the code that the customers will be using.

2) Some code has special debug conditionals that will produce differences between the debug and release builds.

like image 125
Jerod Houghtelling Avatar answered Nov 15 '22 23:11

Jerod Houghtelling