---
title: "Another Entlib example: Separate integration tests from unit tests (and learn to know the difference)"
url: "https://osherove.com/blog/2005/4/11/another-entlib-example-separate-integration-tests-from-unit.md"
canonical: "https://osherove.com/blog/2005/4/11/another-entlib-example-separate-integration-tests-from-unit.html"
published: "2005-04-11T14:54:00"
updated: "2005-04-11T14:54:00"
tags: ["Agile Related", "Testing Guidelines"]
author: "Roy Osherove"
description: "Here are some more inputs on the EntLib unit tests runnability issues ( problems as specified in this blog post ) [I've bolded some phrases I thought were important in the original text] : Data 56 tests will fail if you…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Another Entlib example: Separate integration tests from unit tests (and learn to know the difference)

By Roy Osherove April 11, 2005 In [Agile Related](https://osherove.com/blog/category/agile-related), [Testing Guidelines](https://osherove.com/blog/category/testing-guidelines)

**Historical article** · Originally published April 11, 2005; technical details may be outdated.

Here are some more inputs on the EntLib unit tests runnability issues (_problems as specified in_ [_this blog post_](http://www.agileprogrammer.com/oneagilecoder/archive/2005/04/07/3162.aspx))

_\[I've bolded some phrases I thought were important in the original text\]_:

**Data**

**56 tests will fail** if you do not have Oracle installed. If you do happen to have oracle installed, youll need to manually open the Data\\Tests\\TestConfigurationContext.cs file and change your oracle connection settings.

_That configuration should have been in a config file relating to the tests and the user should have been asked what the connection to the Oracle server they would like to run against._

- 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.

_[TypeMock](http://www.typemock.com/) could have been used or interfaces could have been made to test that "interaction" between the object indeed occurred. Testing the real email is an \*integration test\* and should be run separately._

- 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. Youll also need to change line 53 in Security.ActiveDirectory.Tests.TestConfigurationContext to reflect your ADAM setup.

_Again - interfaces and mock objects could have been used to test this. testing against a live directory is an integration test that should be run separately._

- 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.

_Why not have the method that sometimes fails and sometimes not be run twice or three times by a unit test that checks that it succeeds at least one of those times? A test that "sometimes" passes is not a unit test anyway - but if you want to make sure there are no false negatives - this is a great way to check._

One thing to note here -

these are all considered **integration tests** because they rely on external objects beyond the tested ones to do their bidding and thus need special setup. there is a very good place for such tests, but they should not be called unit tests (even though they are automated - they don't test a unit - they test a set of related technologies and objects in scope).

**Integration tests should be run separately and setup separately a special install program.**

Why? because if they are mingled with your \*real\* unit tests and they keep failing - your end-developer will throw out the good with the bad and decide that it's not worth to run \*any\* of the unit tests since they can't be trusted (a few rotten apples spoil the bunch).

**You should always provide a basic set of tests that \*always\* runs** and is fully green when someone runs it. You can leave the other integration tests for a special run with special setup  - but it's important not to mess up the developer experience and sense of test runnability in this regard - something has to be run consistently and easily to make people use and extend your tests. otherwise you've done a lot of work for nothing- people won't use it. We're a lazy bunch.

## Lessons on this topic

- [Unity Test Review](https://courses.osherove.com/courses/the-art-of-unit-testing-and-tdd-master-class-in-net/unity-test-review/) · The Art of Unit Testing & TDD Master Class in .NET
- [Test Cases, String Asserts and more](https://courses.osherove.com/courses/tdd-in-net-in-hebrew/test-cases-string-asserts-and-more/) · TDD in .NET in Hebrew

## More in Agile Related

[All posts in Agile Related](https://osherove.com/blog/category/agile-related)

- Apr 14, 2005

    ### [Try to avoid multiple asserts in a single unit test](https://osherove.com/blog/2005/4/14/try-to-avoid-multiple-asserts-in-a-single-unit-test.html)

- Apr 14, 2005

    ### [Setting Up VirtualMock in the Eclipse IDE](https://osherove.com/blog/2005/4/14/setting-up-virtualmock-in-the-eclipse-ide.html)

- Apr 11, 2005

    ### [Test maintainability: consider creating a test fixture "per method" instead of "per class"](https://osherove.com/blog/2005/4/11/test-maintainability-consider-creating-a-test-fixture-quotpe.html)

- Apr 11, 2005

    ### [Enterprise library -- Test usability and "runnability"](https://osherove.com/blog/2005/4/11/enterprise-library-test-usability-and-quotrunnabilityquot.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
