Brian Button - One Agile Coder

Blogging on all things .Net, C#, and Agile

My Links

Blog Stats

News

Archives

Post Categories

Agile Solutions Group

Blogs I read

Enterprise Library V1 Team

Running the Enterprise Library Unit Tests

One of the biggest secrets of Enterprise Library is that we shipped it with 1800 NUnit unit tests. These tests reflect our best efforts to write this code in an agile, Test-Driven style. Sometimes we were more successful than others, but the fact remains, we did a damn good job of writing tests for our code.

What do the unit tests do for me?

As a developer, these unit tests are a great resource. First and foremost, they tell you whether or not Enterprise Library is working. These tests should run all the time at 100% success (give or take a few that are timing dependent — our fault…). They also serve as excellent examples of how Enterprise Library works. Have a question about how to pass parameters to a stored procedure using Oracle? Well, my friend, there is a unit test that we wrote that does that exact thing, and you can look at it and see exactly how it works!

The tricky part is that these tests are undocumented, and the process of getting them to run is undocumented. So, here is my best shot at telling you how to get our tests to run. If I’ve missed anything, or something is unclear, please let me know, and I’ll update this page.

The instructions:

  1. Install Visual Studio .Net 2003
  2. Install either MSDE or SqlServer (Oracle and DB2 are optional)
  3. Install MSMQ
  4. Install .Net framework 1.1
  5. Install NUnit 2.1.4
  6. Download and install Enterprise Library. You don’t need to compile it at this point, as we’ll do it manually shortly.
  7. Start Visual Studio and open EnterpriseLibrary.sln
  8. Change build target from Debug to DebugUnitTests
  9. Rebuild solution
  10. Open a visual studio command prompt and navigate to c:\Program Files\Microsoft Enterprise Library\src\Common\Instrumentation\Scripts. Run this command without the quotes: “InstallInstrumentation.cmd DebugTests”
  11. Run the following scripts from the given directories:
    • src\Caching\Scripts – CreateCachingDb.cmd
    • src\Logging\Sinks\Database\Scripts – CreateLoggingDatabase.cmd
    • src\Security\Database\Scripts — CreateSecurityDatabase.cmd
  12. Open “C:\program files\nunit-2.1\bin\nunit-gui.exe”
  13. File->Open and navigate to the assembly you want to test. Quick word of warning — Many of our unit tests use custom configuration files to provide the test setup that they need. You can only run the tests for an assembly in that assembly’s “home” directory. For example, you can only open and test Microsoft.Practices.EnterpriseLibrary.Caching.Database.dll in the src\Caching\Database\bin\DebugTests directory, because that is where its configuration lives.

NOTES:

  •  Data — 56 tests will fail if you do not have Oracle installed. If you do happen to have oracle installed, you’ll need to manually open the Data\Tests\TestConfigurationContext.cs file and change your oracle connection settings.
  • Logging — EmailSinkFixture.LogMessageToEmail will fail, since you do not have access to our internal mail server. You can fix this by changing Logging\Tests\EnterpriseLibrary.LoggingDistributor.config on line 22 to reference different smtpServers and to and from addresses.
  • Security.ActiveDirectory — Tests will fail because you cannot access our Active Directory server. There are instructions about how to set up ADAM in Security.ActiveDirectory.Configuration.ADAM Setup. You’ll also need to change line 53 in Security.ActiveDirectory.Tests.TestConfigurationContext to reflect your ADAM setup.
  • EnterpriseLibrary — It is normal for several of the tests to occasionally fail. There are a few unit tests that are timing-dependent, especially in Caching and Configuration. These tests are testing whether or not something happens during a particular time interval, and sometimes the system delays the actions too long and those tests fail. If you rerun the test, it should work the next time. Additionally, our tests write to the event log, which occasionally fills up. If you begin to see a number of tests failing, check that your application event log is not full.

posted on Thursday, April 07, 2005 10:09 AM

Feedback

# How to Run Unit Tests for EntLib v1 4/7/2005 11:17 AM Geek Noise

# How to setup and run our Unit Tests 4/8/2005 6:58 AM Being Scott Densmore


Brian Button has the definitive directions on how to run the unit tests in Enterprise Library here...

# Enterprise library and test usability and 4/11/2005 7:23 AM ISerializable

# Enterprise library -- Test usability and 4/11/2005 7:23 AM ISerializable

# Testes em aplica 4/17/2005 4:27 PM Rui Quintino

# re: Running the Enterprise Library Unit Tests 4/22/2005 4:34 PM Scott Reynolds

It is normal for several of the tests to occasionally fail. There are a few unit tests that are timing-dependent, especially in Caching and Configuration.

That's funny. Doesn't that break the fundemental rules of TDD. Repeatable and Independant?

# re: Running the Enterprise Library Unit Tests 5/16/2005 3:38 PM Chris Bacon

Please disregard my previous message. I didn't understand how the various tests were structured.

Chris

# re: Running the Enterprise Library Unit Tests 10/5/2005 3:14 PM El Bruno

Do you know how to implement the Security.ActiveDirectory provider instead the DataBase provider for the security component ???

thanks a lot

Bye from Spain
El Bruno

# re: Running the Enterprise Library Unit Tests 10/5/2005 3:17 PM El Bruno

I forgot, please answer me at bcapuano AT gmail DOT com

:D

# re: Running the Enterprise Library Unit Tests 8/24/2006 8:55 PM dsf

http://www.greatestjournal.com/users/aochuang1/504.html ????
http://www.greatestjournal.com/users/aochuang1/693.html ????
http://www.greatestjournal.com/users/aochuang1/832.html ????
http://www.greatestjournal.com/users/aochuang1/1211.html ????
http://www.greatestjournal.com/users/aochuang1/1393.html ????
http://www.greatestjournal.com/users/aochuang1/1727.html ????
http://www.greatestjournal.com/users/aochuang1/1892.html ????
http://www.greatestjournal.com/users/aochuang1/2178.html ????
http://www.greatestjournal.com/users/aochuang1/2401.html ????
http://www.greatestjournal.com/users/aochuang1/2672.html ????
http://www.greatestjournal.com/users/aochuang1/2867.html ????
http://www.greatestjournal.com/users/aochuang1/3114.html ????
http://www.greatestjournal.com/users/aochuang1/3450.html ????
http://www.greatestjournal.com/users/aochuang1/3638.html ???
http://www.greatestjournal.com/users/aochuang1/3981.html ????
http://www.greatestjournal.com/users/aochuang1/4142.html ????
http://www.greatestjournal.com/users/aochuang1/4533.html ????
http://www.greatestjournal.com/users/aochuang1/4669.html ????
http://www.greatestjournal.com/users/aochuang1/5076.html ????
http://www.greatestjournal.com/users/aochuang1/5219.html ??????
http://www.blogstudio.com/aochuang1/ac25.htm ??????
http://www.blogstudio.com/aochuang1/ac01.htm ????
http://www.blogstudio.com/aochuang1/ac02.htm ???
http://www.blogstudio.com/aochuang1/ac03.htm ????
http://www.blogstudio.com/aochuang1/ac04.htm ????
http://www.blogstudio.com/aochuang1/ac05.htm ????
http://www.blogstudio.com/aochuang1/ac06.htm ????
http://www.blogstudio.com/aochuang1/ac07.htm ????
http://www.blogstudio.com/aochuang1/ac08.htm ????
http://www.blogstudio.com/aochuang1/ac09.htm ????
http://www.blogstudio.com/aochuang1/ac10.htm ????
http://www.blogstudio.com/aochuang1/ac11.htm ????
http://www.blogstudio.com/aochuang1/ac12.htm ????
http://www.blogstudio.com/aochuang1/ac13.htm ????
http://www.blogstudio.com/aochuang1/ac14.htm ????
http://www.blogstudio.com/aochuang1/ac15.htm ????
http://www.blogstudio.com/aochuang1/ac16.htm ????
http://www.blogstudio.com/aochuang1/ac17.htm ????
http://www.blogstudio.com/aochuang1/ac18.htm ????
http://www.blogstudio.com/aochuang1/ac19.htm ????
http://www.blogstudio.com/aochuang1/ac20.htm ????
http://www.blogstudio.com/aochuang1/ac21.htm ????
http://www.blogstudio.com/aochuang1/ac22.htm ????
http://www.blogstudio.com/aochuang1/ac023.htm ????

http://www.greatestjournal.com/users/uk111/449.html ????
http://www.greatestjournal.com/users/uk111/729.html ????
http://www.greatestjournal.com/users/uk111/957.html ????
http://www.greatestjournal.com/users/uk111/1083.html ????
http://www.greatestjournal.com/users/uk111/1326.html ????
http://www.greatestjournal.com/users/uk111/1776.html ????
http://www.greatestjournal.com/users/uk111/2036.html ????
http://www.greatestjournal.com/users/uk111/2122.html ????
http://www.greatestjournal.com/users/uk111/2334.html ????
http://www.greatestjournal.com/users/uk111/2776.html ????
http://www.greatestjournal.com/users/uk111/2920.html ????
http://www.greatestjournal.com/users/uk111/3111.html ????
http://www.greatestjournal.com/users/uk111/3460.html ????
http://www.greatestjournal.com/users/uk111/3720.html ????
http://www.greatestjournal.com/users/uk111/4028.html ????
http://www.greatestjournal.com/users/uk111/4220.html ????
http://www.greatestjournal.com/users/uk111/4469.html ???
http://www.greatestjournal.com/users/uk111/4648.html ??????
http://www.greatestjournal.com/users/uk111/5040.html ????




# re: Running the Enterprise Library Unit Tests 10/15/2007 1:47 PM seo

Thank you for sharing the list of instruction for this test.

# re: Running the Enterprise Library Unit Tests 6/16/2008 1:15 PM wes

there, it took me awhile to figure that out it worked perfectly thanks men...

# re: Running the Enterprise Library Unit Tests 6/17/2008 9:18 AM blog

got the test, i just read the instruction first

Title  
Name  
Url
Spam Protection:
Enter the code you see:
If you can't read it, click your refresh button to get a new image.
Comments