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

Notification

Icon
Error

NCrunch rebuild all projects and runs all the tests when code changes
NhimHoBao
#1 Posted : Tuesday, January 31, 2012 10:20:17 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/31/2012(UTC)
Posts: 2

Thanks: 2 times
Hi, I'm new here, there's something about ncrunch that I wanna know
When I change my code, it will automatically rebuild all the projects (not only the project with code changes). And run all the existing unit tests (not the unit tests associate with the changed code).
Is that your true intention or there's something wrong with my configuration?
Remco
#2 Posted : Tuesday, January 31, 2012 11:27:58 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for posting!

When you change your code, NCrunch will analyse the nature of the change and will rebuild the project that you changed. If the change was to any of the public interfaces of the project, then NCrunch will also build any projects that depend upon it. An exception to this is if you have turned on the 'Copy referenced assemblies to workspace' turned on for any of the projects in your solution - in which case these projects will almost always need to be rebuilt.

The running of your tests will depend upon the 'Engine mode' you've selected NCrunch to run in. There's more information about this in the wiki, but when set to run tests automatically, NCrunch will run ALL tests that make use of a changed project regardless of whether the impact detection picked them up or not. The impact detection is used more as a way to prioritise the sequence in which the tests are run as opposed to selecting them for execution.

The reasoning behind this is quite simple - no impact detection is perfect. The tests held within your solution could have external dependencies well outside the knowledge of NCrunch and as such you can't be sure whether all your tests are truely passing until every one of them is executed.

Of course there is another way to approach this. If you were prepared to accept that there was still a slight chance that a test could fail without the continuous test runner identifying the need for it to be run, then it is possible to run only the impacted tests and reduce the amount of work that needs to be done. NCrunch doesn't do this yet, but it is a high priority feature that will be added very soon.


Cheers,

Remco
1 user thanked Remco for this useful post.
NhimHoBao on 2/1/2012(UTC)
NhimHoBao
#3 Posted : Wednesday, February 1, 2012 4:09:03 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/31/2012(UTC)
Posts: 2

Thanks: 2 times
I'm very satisfied with your answer. Thanks.The reason I'm asking this is that I'm evaluating Red Gate's .NET Demon, NCrunch, Mighty-Moose both in order to apply Continuous Testing for my team. I'd rather say that I'm very impressed w/ your product.

I have another question regards to configuration settings. Where do you save the configuration for each project? I can see that you don't either modify the Project file, or add new config folder into the project folder. Can I put the NCrunch settings in source control and share it between my team members. Is that feasible?
Remco
#4 Posted : Wednesday, February 1, 2012 5:46:33 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Absolutely. NCrunch stores 5 different types of files on your disk:

globalconfig.crunch.xml - Stored in your AppData\Roaming\NCrunch directory. This contains user-specific global settings for NCrunch that are applied across all solutions (such as performance related config etc).
[solution name].ncrunchsolution.cache - Stored next to your .sln file. This contains cached data from your executed tests, including persistent code coverage information.
[solution name].ncrunchsolution.user - Stored next to your .sln file. This contains user-specific settings, such as the layout of the Tests Window, currently selected engine mode, etc.
[solution name].ncrunchsolution - Stored next to your .sln file. This contains solution-specific settings, such as test framework settings and the parallel execution toggle.
[project name].ncrunchproject - Stored next to each of your project files. This contains project-specific settings, such as build and test related options, additional files to include, etc.

I generally recommend to place the last two files under source control, and leave the rest as local files on each developer's machine. In this way, it's possible for all of your critical configuration to be shared and versioned alongside the codebase, while anything that would be computer or user specific can be locally customised.
1 user thanked Remco for this useful post.
NhimHoBao on 2/1/2012(UTC)
jomtois
#9 Posted : Tuesday, October 2, 2012 8:16:38 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/24/2012(UTC)
Posts: 10
Location: Newport, VT

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Sorry for horning in on an older post but I have a relevant question to this thread -- how come if I change even one character in the XML documentation comments (or actually any comment) it rebuilds and re-runs all my tests (depending on engine mode)? Unless I'm commenting or un - commenting actual code, that should not make an "impact", so why rebuild? Is it too hard to detect whether or not the actual code has changed rather than comments or something else inconsequential?

Just curious because I see everything rebuild and re-run constantly as I update my documentation even though I'm not changing the code whatsoever.
Remco
#10 Posted : Tuesday, October 2, 2012 9:31:27 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Determining whether or not a change made to a file could impact the results of tests is actually (almost?) impossible to do reliably. It's for this reason that NCrunch works as more of a prioritisation engine than a test-excluding one. Although to us developers it may seem very obvious (hell, it's an XML comment!), the implications really are not that simple at all.

For example, you may have a build step in your project that reads the XML documentation in order to generate a resource file that is fed into one of your automated tests. By changing the XML documentation, you change the contents of the resource file and thus the test would need to run. I've never seen anyone do this before, but it's theoretically possible and NCrunch needs to consider it.

If you look under your NCrunch menu, you'll see an option that allows you to 'Set engine mode'. By default, NCrunch has a pre-built engine mode that will run impacted tests only. If you're operating in a codebase where you want to be exclusive with which tests are run, I suggest giving it a try. NCrunch's impact detection is far from perfect so you'll need to be careful about still performing a full test run before checking in your code .. although from your description it seems as though this may be what you are looking for.


Cheers,

Remco
1 user thanked Remco for this useful post.
jomtois on 10/3/2012(UTC)
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.051 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download