?
Solved

Prohibitive build times when creating unit tests in Visual Studio 2008

Posted on 2009-12-22
12
Medium Priority
?
461 Views
Last Modified: 2013-12-13
We want to move to grown up automated unit testing with our existing application. Our development environment is Visual Studio 2008 (.net 3.5) so I've been investigating using the on board unit testing (we may also look at Nunit but a one-stop-shop currently makes more sense).

Our existing application suite is a 'portal' web app housing 'applications' (i.e. within the web app folder structure, we have a folder for classes, a folder for core code and a folder per set of 'application' web pages - i.e. nothing unusual, as far as I'm aware).

The functionality consists of web pages embedded into nested master pages and referencing the shared class namespaces. The site currently contains 857 code files of varying descriptions. Most file sizes are a few KB, with the biggest single file being 175KB.

I'm able to create unit tests to test the web pages and also unit tests to test classes/methods etc. but the build time every time I make the smallest of changes is SOOOO slow as to be prohibitive. There's no point in writing unit tests if its going to take ten minutes to rebuild every time I hit "run test".

Can anyone point me in the right direction for getting this overhead down? We can't seriously use the testing facility as is.

(NB if I create a clean baby website with one page and a class file and then create unit tests for this, it runs at super-speed, so our issues are clearly to do with the size/configuration of the web project)
0
Comment
Question by:ddl_ex5
  • 5
  • 4
9 Comments
 
LVL 57

Expert Comment

by:giltjr
ID: 26273574
What are the specs on the PC you are running this on?

Which processor, how many processor, speed of processors?

How much RAM?

When your are doing the testing processing how much RAM is in use?  Typically these processes are VERY memory intensive.  If you have, say 1 GB of ram and it is using 2GB's that means you are doing a LOT of paging, which will add a lot of I/O overhead.
0
 

Author Comment

by:ddl_ex5
ID: 26302383
I'm running VS2008 inside a Parallels 3 XP virtualisation on a Mac Pro. I've upped my resources in the VM so that it should be plenty powerful enough. I can try further tuning it.
0
 
LVL 57

Accepted Solution

by:
giltjr earned 1000 total points
ID: 26303005
Well, again, how much RAM?  What is the processor type and speed?

Since you are running this as a virtual host, how busy is the host OS?


The virtual host would need at least 2GB of RAM, if not 3-4GB and the physical host would need at least 2GB more than the virtual host if you are using the host OS.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

Author Comment

by:ddl_ex5
ID: 26305239
Hi giltjr,

I'm was running on 1.5GB RAM on the VM, with 3 of my 4 processors (2 x dual core xeon at 2GHz) allocated. However, I'm going to try with the numbers you suggested this afternoon.

However, the problem is not confined to my machine. Two colleagues in my room are both running on core 2 quad native 32 bit XP machines running at 2.66GHz with 3.48GB available and they suffer exactly the same issues when attempting to unit test the project described in the opening question.

I'll let you know how I get on with improved spec on my machine though.

0
 
LVL 57

Expert Comment

by:giltjr
ID: 26305335
O.K. When running the unit test start task manager and see if CPU or RAM is maxed out.  Make sure that task manager is configured to show each CPU.

 Now it is possible that the unit test software may not be multi-tasking or multi-threaded which means it might be using just 1 core.
0
 

Author Comment

by:ddl_ex5
ID: 26306351
I made a one line change to a unit test.
I hit 'run' and VS goes off to build the test.
It then runs the test.

All 3 allocated processors appear to be being used 'about equally' when I view activity in Task Manager and the highest peak is briefly at around 57%. PF Usage doesn't exceed 600MB at any time.

However, the build and run process took around 5 minutes. Ouch.
0
 
LVL 57

Assisted Solution

by:giltjr
giltjr earned 1000 total points
ID: 26306686
O.K, my guess is that unless it is very, very disk I/O intensive that most of the build process is single threawded.  So the build process can't really take advantage of more that one CPU.  

I am assuming that the 57% was of 57% of 3 processors that it was using the equivalent of 100% of one CPU and 50% of a second CPU, with the 3rd sitting idle.

So although you have "8 Ghz" of CPU (4 core x 2Ghz each core) the process can only use 2 Ghz.
0
 

Author Closing Comment

by:ddl_ex5
ID: 31669084
Comments explain the probable issue although they don't solve the problem, hence the grade awarded.
0
 
LVL 57

Expert Comment

by:giltjr
ID: 26313328
Thanks for the points.  As a solution there are three options:

1) If possible see if there is a "enable multi-threading" option, or an option to increase the number of threads.
2) Get a faster CPU.
3) Live with it.  :)

One of the problem in the computer world that some people don't understand is sometimes more CPU's don't help.  If you have a environment that has a lot of tasks that must do work at the same time (which includes multi-threading) then more slower processors typically are better.  However if you have an enviroment where you have a few very CPU intensive tasks, then fewer faster processors are better.

Of course more faster processors always help, but sometimes are too expensive.  For the typical desktop, including developers desktops, fewer faster processors are better.  For servers, you really have to know your workload.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Steps to fix error: “Couldn’t mount the database that you specified. Specified database: HU-DB; Error code: An Active Manager operation fail”
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Introduction to Processes

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question