---
title: "Basic Guidelines for using RowTest and data driven tests"
url: "https://osherove.com/blog/2007/12/18/basic-guidelines-for-using-rowtest-and-data-driven-tests.md"
canonical: "https://osherove.com/blog/2007/12/18/basic-guidelines-for-using-rowtest-and-data-driven-tests.html"
published: "2007-12-18T16:28:32"
updated: "2007-12-18T16:28:32"
tags: ["Agile", "Agile Related", "Art Of Unit Testing", "Testing Guidelines", "Unit Testing", "altnet"]
author: "Roy Osherove"
description: "I took a look at the code that was used to create the NUnit RowTest Extension (which is pretty neat) and found this in one of the samples: The highlighted areas in the code show something which I feel is problematic and…"
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/"
---

# Basic Guidelines for using RowTest and data driven tests

By Roy Osherove December 18, 2007 In [Agile](https://osherove.com/blog/category/agile), [Agile Related](https://osherove.com/blog/category/agile-related), [Art Of Unit Testing](https://osherove.com/blog/category/art-of-unit-testing), [Testing Guidelines](https://osherove.com/blog/category/testing-guidelines), [Unit Testing](https://osherove.com/blog/category/unit-testing), [altnet](https://osherove.com/blog/category/altnet)

**Historical article** · Originally published December 18, 2007; technical details may be outdated.

I took a look at the code that was used to create the [NUnit RowTest Extension](http://www.andreas-schlapsi.com/projects/rowtest-extension-for-nunit/) (which is pretty neat) and found this in one of the samples:

![image](https://osherove.com/img/wb/f072d669_weblogs.asp.net_blogs_rosherove_WindowsLiveWriter_a177d915a4ab_1383_image_thumb.png)

The highlighted areas in the code show something which I feel is problematic and is the manifestation of a unit test anti-pattern which the XUnit book calls "Interacting tests". basically, there is a dependency that is created by the first and second row, in which the second row cannot run individually.

**Bad Naming once again leads to confusion**

I'm not saying that this test is bad, because perhaps that is what they author was **trying** to test - that the class level members are not destroyed between each row. I guess we'll never know because the naming of the test is problematic - it doesn't say what the expected behavior is, or what the scenario\\context is. just what the general object being test is (and I'm not even sure about that). Still, it makes for a nice example for your own tests.

**The symptoms of interacting row tests**

Back to the issue at hand, the symptoms detailed below are caused by the wrong usage (in my mind) of the RowTest facility. The second argument in the RowTest is provided for the sole purpose of changing the behavior of the class under test (changing s\_classMember) so that the **next** row will be able to assert on the string.

Now this prevents you from doing the following without going into annoying routines of code replacements:

- You can't remove a row test without making sure you don't break any other rows
- You can't just insert a row test randomly in between without possible breaking another row
- You have to read the code in the test to understand what the row test is doing.

Introducing dependencies between row test essentially makes the specific test method unmaintainable to a large degree. Since row-tests and data driven tests are a fairly new syntax for most of us, here are a few guidelines I try to follow:

**Some Basic Guidelines**

- Treat each test row as if it will be the only one on the test method (so that you don't feel the need to interact with other rows).
- Test rows must be a simple as possible to understand - that is - have no logic. In this case we **do** have logic int he test row (pertaining to the next row)

## More in Agile

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

- Dec 31, 2007

    ### [Joining TypeMock](https://osherove.com/blog/2007/12/31/joining-typemock.html)

- Dec 18, 2007

    ### [How uTest will destroy your Quality Assurance](https://osherove.com/blog/2007/12/18/how-utest-will-destroy-your-quality-assurance.html)

- Dec 18, 2007

    ### [\[RowTest\] for NUnit, File System Interfaces for unit testing](https://osherove.com/blog/2007/12/18/rowtest-for-nunit-file-system-interfaces-for-unit-testing.html)

- Nov 28, 2007

    ### [Data Layer Testing: Test Inheritance Patterns](https://osherove.com/blog/2007/11/28/data-layer-testing-test-inheritance-patterns.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/
