Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NCrunch ignoring preprocessor, but only for certain projects
Canin
#1 Posted : Tuesday, July 24, 2012 8:27:26 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/12/2012(UTC)
Posts: 3
Location: The (Companion) Cube

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I'm working on an application extremely heavily dependent on, effectively, data access which while the devs have done a great job abstracting the data access, ever so often something is difficult to test as is due to data access. I've been getting around some of this using preprocessor directives.

Long story short I've encapsulated each of my unit test classes with preprocessor commands of #if UnitTest (which is defined in the properties of each and every project under the solution configuration of "UNITTEST"), alongside anything I need to add into methods to make them testable. However while NCrunch runs the unit tests without issue (again, which are all under #if UnitTest/#endif), it seems to flat out ignore any #if UnitTest found in one project, even if Visual Studio acts on them.

I've verified numerous times that NCrunch Configuration for the project in question (as well as every other project in the solution) are using the build configuration of "UNITTEST," but to no avail.

Long story even shorter: It works for Visual Studio 2010, but not NCrunch, and the only NCrunch setting I can think of seems to be set correctly.

Any pointers as to what I might be doing incorrectly?
Remco
#2 Posted : Tuesday, July 24, 2012 10:16:59 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,143

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
In theory, setting the 'Use build configuration' to 'UNITTEST' for each of your projects should solve your problem - though as you've described it sounds as though something more complicated is going on.

Would you be able to show me an extract of the XML from one of your project files showing the main PropertyGroup declarations for the different build configurations you have available? Of particular interest is the manner in which the "DefineConstants" property is being declared between these configurations.

It may also be worth trying to make a build-breaking change to one of the property group items for your 'UNITTEST' configuration, just to confirm whether or not NCrunch is actually using this configuration at all.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.039 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download