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

Notification

Icon
Error

Integration testing configuration question
CourtJesterBob
#1 Posted : Monday, July 15, 2013 5:08:24 PM(UTC)
Rank: Member

Groups: Registered
Joined: 7/2/2012(UTC)
Posts: 13
Location: Beachwood, OH

So, I have been using NCrunch for a while now, and I liked it so much I had to buy it and I am now trying to get my company to get it for every developer.

My only issue is that I am not sure exactly the best way to configure NCrunch to do what I want.

NCrunch is working flawlessly for unit tests. So, we turned it on for our integration tests, which go against a database, require a logged on user, and use a security class that is linked between the logged in user and the database.

The problem is that NCrunch likes to run each test in parallel, and that is bad for our set of unit tests due to the static security class and the fact that we attach a new copy of our test database for run through of the integration tests. MSTest handles this just fine because we set up some deployment items and it deploys the assembly and runs all tests in the assembly.

I was able to get NCrunch to work by adding an ExclusivelyUses property to all my integration tests so they do not interfere with each other. But, now I have to attach a new database and set up our security context for each individual test It would be much nicer if I could get to NCrunch to run all those tests in the assembly using the same database and security context. Is that possible?

Bob
Remco
#2 Posted : Tuesday, July 16, 2013 12:11:42 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi Bob,

Is my understanding correct in that you wish to try and make sure NCrunch uses the same test runner process to execute all integration tests, avoiding spinning up or using different processes in order to avoid creating a different security context?

If so, I think I may be able to suggest a way that this is possible.. it's a little indirect, but should work.

NCrunch will tend to call in and out of test runner processes to execute the tests queued up inside the tasks you'll find in the processing queue. The pattern of re-use of these processes has a number of rules around it - one of which involves the project used to host them. If you have all of your integration tests situated within the same project/assembly and all of these tests have been marked with ExclusivelyUsesAttribute (which can now be specified at assembly level if you find this convenient), then NCrunch will use and re-use the same physical process to execute these tests.

There may still be some recycling of the process depending upon the resource needs of NCrunch and which tests it needs to run, but you can influence this by setting the 'Process pool size' to a high value, thus preserving the life of your integration test process.
CourtJesterBob
#3 Posted : Tuesday, July 16, 2013 2:36:05 PM(UTC)
Rank: Member

Groups: Registered
Joined: 7/2/2012(UTC)
Posts: 13
Location: Beachwood, OH

That is exactly what I am trying to do.

All of my integration tests are in the same project/assembly, or at least I only want one security context spun up for each project/assembly. Currently, I have each unity test marked with the ExclusivelyUsesAttribute, but I will move that up to the assembly level to save typing and insure that no developer forgets to add it.

It sounds like, though, that since I have this configured like this already, NCrunch should already be behaving this way? I haven't checked in a while, let me analyse the situation.

Thanks for the response!
Remco
#4 Posted : Tuesday, July 16, 2013 10:35:35 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
It should, in theory :)

In practice, the success of the arrangement may depend on how you initialise the database and the security context. If this is done via a load-on-demand static member of some kind, then I think it should be OK.

Setting the process pool size to something a bit higher is quite important, as NCrunch will need to keep this process alive long enough to continue to re-use it. Of course, it will still need to spin it up and reinitialise it every time you change any code involved.. but I guess that's the same as any other test run. If it performs badly or doesn't work right, just post back here and I'll see if we can work it out.
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.037 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download