---
title: "Unit Testing scalability and performance"
url: "https://osherove.com/blog/2004/7/19/unit-testing-scalability-and-performance.md"
canonical: "https://osherove.com/blog/2004/7/19/unit-testing-scalability-and-performance.html"
published: "2004-07-19T19:34:00"
updated: "2004-07-19T19:34:00"
tags: [".Net Original", "Agile Related"]
author: "Roy Osherove"
description: "I had an interesting chat with Clemens today. I told him about the Rollback ability using ES and he totally disagreed with me that its a viable option for testing database usage for several reasons: If you run tests…"
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/"
---

# Unit Testing scalability and performance

By Roy Osherove July 19, 2004 In [.Net Original](https://osherove.com/blog/category/net-original), [Agile Related](https://osherove.com/blog/category/agile-related)

**Historical article** · Originally published July 19, 2004; technical details may be outdated.

I had an interesting chat with [Clemens](http://staff.newtelligence.net/clemensv/) today. I told him about the Rollback ability using ES and he totally disagreed with me that its a viable option for testing database usage for several reasons:

- If you run tests with LOTS of data - rollback will take a loooong time
- You're introducing "context" into your running code - thus changing is runtime behavior, even if ever so slightly
- If you have components that require new transactions or do not support transactions you can't use this technology

So how does **he** do it? he restores the database every time. Costly? yes - but less expensive than the other way and the weaknesses just listed won't happen. But more importantly - **why is this big difference in opinion happening**? why do these rollbacks seem perfectly natural to me and so unnatural and irrelevant to him? Its because we're doing the testing in **different ways of thinking**. Clemens is testing scalability issues and integration issues in a much more fierce manner than I have ever though about doing. I guess it comes with the territory. Personally - I never needed such tests. What **would** be required to test load balancing, scalability and perf issues?

- Multi threaded testing
- Repeated - long running, large data volume tests
- lots of interaction in the DB for DALs

My tests look nothing like this. I support the approach that when you test something you test it solely for its own functionality and nothing else. for example - an object that is supposed to behave in a specific way with other objects might be tested using mock objects to verify that it works fine. A DAL will be tested for the simple functionality it has, without multiple threads testing it. I know that it works. If I get a scenario that fails it - \*then\* I'd test the harder stuff. here are pointers from my testing needs:

- they should run as fast as possible so that you can run them all the time. all of them.
- they should test individual object functionality - often using mock objects and interfaces
- Against the database I will test the simplest functionality until I need something bigger. Scalability testing does enter this field until I \*need\* scalability. KISS principle.

So - what's the big deal? we're  both working on the same direction - on different paths. I do suspect a time will come when I will need to get into hardcore perf and scalability testing. I know Rollback won't help me then. But being able to restore a database easily will.

Hopefully - both of these will be available via attributes in my unit tests. [It's possible even today](http://weblogs.asp.net/rosherove/archive/2004/07/20/187863.aspx) \- with a little effort.

## More in .Net Original

[All posts in .Net Original](https://osherove.com/blog/category/net-original)

- Jul 29, 2004

    ### [The SQL Server usability advantage](https://osherove.com/blog/2004/7/29/the-sql-server-usability-advantage.html)

- Jul 21, 2004

    ### [ADO.Net talk went great](https://osherove.com/blog/2004/7/21/adonet-talk-went-great.html)

- Jul 18, 2004

    ### [Announcing:Coolest Add-in Contest - Entries available for download](https://osherove.com/blog/2004/7/18/announcingcoolest-add-in-contest-entries-available-for-downl.html)

- Jul 11, 2004

    ### [Introducing: NUnitX and the Rollback attribute - Seamless database rollback with Nunit](https://osherove.com/blog/2004/7/11/introducing-nunitx-and-the-rollback-attribute-seamless-datab.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/
