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

Notification

Icon
Error

Very Impressed
Max
#1 Posted : Thursday, January 12, 2012 5:07:15 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/12/2012(UTC)
Posts: 2
Location: Edinburgh

Hi Remco, found NCrunch just this week and very impressed. We have a very large solution (60 projects of various sizes) and while it has definitey decreased stability in visual studio, it is very useful when it works. I'm definitely hoping to get more of our 20-odd developers to use it once it crashes less often.

At the moment I find the best idea for me is to do a 'reset' when I leave the office in the evening and manually update unit tests for code that I change through the next day (by clicking on the icon and running all unit tests for that area). I've done all the balancing that I think will help (cpu core-wise) but I still can't run it alongside my normal processes.

If you have an easy way to get stats (number of tests, lines of code, project count, pc info, etc) that might be of interest to you then let me know and I can provide stats on what we work with.

Unfortunately since 80%+ of our tests rely on a database in a specific state each time, we are unable to use the parallelisation to get better performance. I don't really know how much better things would be with this enabled, but I am considering a method of having multiple unit test database instances, and a 'smart' selector which will pick one that is not currently in use. There still could be problems, but it's novel and if it allows us to do some test in parallel, that would be pretty handy.

Another thing we have that is moderately interesting is one of our tests that interrogates all the assemblies in the solution for conformity (ie the Company Name/details, versions etc) which doesn't seem to work unless I set the 'Copy References to Workspace' flag on the unit tests configuration. I am wary of this though because it seems to be a bit extreme to need to build so often, but I'm not sure.

In order to set up the solution to work well with NCrunch, I ended up adding a setting to the configuration of one of my projects for detecting whether it was running in NCrunch mode as thus:
Code:

  <PropertyGroup Condition="$(NCrunch) == '1'">
    <DefineConstants>TRACE;DEBUG;NCRUNCH</DefineConstants>
  </PropertyGroup>


I was wondering though whether there was anything we could save when checking our code changes into SVN to do with the coverage results. Obviously it would save us a lot by having the results up to date whenever we pulled the latest changs from source control, rather than needing to regenerate the entire set. Is this something available? I have seen all the xml configuration files for each project, but they didn't seem to contain any acutal source coverage information. I could always search a bit deeper (process monitor, disassembly, etc) but would rather not need to. I didn't notice anything on the wiki about this either.

That's about all right now. Looking forward to any enhancements/updates. Happy to put some time in if I can help push your code along too, esp stability and performance.

Fellow kiwi here too by the way, been here in Scotland for a couple of years. Was pleased when a workmate felt it was interesting enough to point out you were one, heh.

Cheers,
Max
Remco
#2 Posted : Thursday, January 12, 2012 10:24:45 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Hi Max,

Always good to hear from kiwis in other parts of the world, we seem to be doing quite well in the TDD space over in the UK :)

Getting NCrunch to work well on a large established solution can sometimes be tricky, as the solution will usually have a development history suited mostly to on-demand synchronous testing. The results you have from NCrunch will always vary depending upon the nature of your solution and the specification of the system you are using. Some solutions just fall right in and work great, and others need to be gradually adjusted over time to get the best result.

With that said, it's an important goal for me to try and make the adjustment process as simple and streamlined as possible. A critical element of this is finding people that have complex and/or demanding solutions to tackle that have the time/commitment to report issues that they're experiencing so I can make the tool smarter - so definitely thanks for getting in touch.

Based on what you've described, I have a feeling that much of the performance drag on your system will be caused by the database. My assumption is that you're running a database server on the same machine as NCrunch, which would mean that the database and Visual Studio are likely to be competing for system resources.

The primary way that NCrunch keeps the load away from the VS UI is by splitting the available work on a different set of CPU cores. It can do this across all the processes it controls (such as Visual studio and the numerous task runner processes), though it isn't able to do this with other external processes that it isn't aware of (such as a local database on the same machine). Something that may be worth trying is to find your main database worker process inside task manager, right clicking it and setting the processor affinity to be the same as the CPU core configuration you've specified in NCrunch.

If your solution is small enough and your available memory is high enough, you could also consider setting up a RAM disk and configuring NCrunch to store its workspaces there. This often makes quite a difference on the HDD load as NCrunch normally builds your projects on disk whenever a change is detected.

A setup that I've found works quite well for large database centric projects is to apply the 'ExclusivelyUses' attribute against all of your database integration tests, giving them the same resource (you could call it 'Database'). This means you can still make use of the parallel execution features for your unit tests (which likely don't drag the system so much), but your database tests will be run synchronously. NCrunch also generally tends to function better on test suites that have a smaller number of slower integration tests and a larger number of fast unit tests.

The test that you are running to interrogate other assemblies can be fixed by referencing the assemblies within the current application domain, rather than trying to load them off disk. NCrunch will automatically pre-load all dependences of an assembly under test into the same application domain before the test starts executing. This means that in an NCrunch test environment, you can rely on them being accessible from AppDomain.CurrentDomain.GetAssemblies() provided your test assembly is referencing them. On a solution of your size, you should do everything you can to avoid the 'Copy Referenced Assemblies To Workspace' setting as it will drag VERY heavily on your build times.

I'm particularly interested in the issues you're experiencing with crashing. Crashes are a very high priority for me and I'd like to learn a bit more about the symptoms you're experiencing. Can give you me any more information?


Thanks!

Remco
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.041 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download