---
title: "NerdDinner Test Review"
url: "https://courses.osherove.com/courses/the-art-of-unit-testing-and-tdd-master-class-in-net/nerddinner-test-review.md"
canonical: "https://courses.osherove.com/courses/the-art-of-unit-testing-and-tdd-master-class-in-net/nerddinner-test-review/"
tags: []
author: "Roy Osherove"
description: "Lesson 7 of 14 in The Art of Unit Testing & TDD Master Class in .NET (Test Review Insights), 27:17. Free video by Roy Osherove."
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/"
---

# NerdDinner Test Review

1. [Courses](https://courses.osherove.com/#courses)
2. [The Art of Unit Testing & TDD Master Class in .NET](https://courses.osherove.com/courses/the-art-of-unit-testing-and-tdd-master-class-in-net/)
3. Test Review Insights

Lesson 7 of 14

Duration: 27:17 [Watch on YouTube](https://www.youtube.com/watch?v=xjlsDaX4NEs)

Roy Reviews NerdDinner project with the class

## In this lesson

Roy Osherove reviews the [NerdDinner](https://osherove.com/blog/2009/3/20/test-review-1-nerddinner.html "Test Review #1 - NerdDinner (osherove.com)") tests, starting with a single test project that mixes unit and [integration tests](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-1#sigil_toc_id_25 "Integration tests (The Art of Unit Testing, 3rd ed., ch. 1)"); he wants them separated into a [safe green zone](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-7#ch07lev1sec2 "Mapping out tests based on speed and type (The Art of Unit Testing, 2nd ed., ch. 7)") of tests that always pass. A failing HTML rendering test depends on the machine's locale, and he discusses [test names](https://osherove.com/blog/2005/4/3/naming-standards-for-unit-tests.html "Naming standards for unit tests (osherove.com)"), var, [magic numbers](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-9#sigil_toc_id_169 "Magic values and naming variables (The Art of Unit Testing, 3rd ed., ch. 9)") such as 999, and [mock](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-4#sigil_toc_id_76 "Interaction testing, mocks, and stubs (The Art of Unit Testing, 3rd ed., ch. 4)") helpers that are really [stubs](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-3#sigil_toc_id_62 "Reasons to use stubs (The Art of Unit Testing, 3rd ed., ch. 3)"). Different naming conventions show him there was no [test review](https://osherove.com/videos/2011/2/6/how-to-do-test-reviews.html "How to do test reviews (osherove.com)") process, and he objects to test dinners created in a hidden helper with a dynamic date.

## Transcript

3,554 words

[\[00:25\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=25s) Let's open up the [NerdDinner](https://osherove.com/blog/2009/3/20/test-review-1-nerddinner.html "Test Review #1 - NerdDinner (osherove.com)") solution. What we're going to do is we're going to take a quick look at how to actually review other people's code and what do I think about when I look at other people's code in terms of tests. Don't ask me anytime anytime everywhere about this. Okay, so let's take a look at the solution for NerdDinner.

[\[01:03\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=63s) This is a new machine. This is like a really brand new machine. Okay. So, what do we have here? Just just ignore any security dialogue that you get. It's just for the team system connection. That's why it's there. So what what am I looking for when I'm reviewing code? Well, as the first thing I look for is structure. You can see that the structure contains only two projects.

[\[01:36\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=96s) There's a NerdDinner and there's a NerdDinner. That already that gives me an uneasy feeling because usually I try to have at least a couple of test projects. one will be dedicated to [unit tests](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-1#sigil_toc_id_17 "Defining unit testing, step by step (The Art of Unit Testing, 3rd ed., ch. 1)") and the other will be dedicated to [integration tests](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-1#ch01lev1sec3 "Integration tests (The Art of Unit Testing, 2nd ed., ch. 1)") and I separate them. So first of all, does anyone remember what is the definition of a unit test versus an integration test? How how can I tell what's a unit test and what's an integration test?

[\[02:08\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=128s) Any thoughts? The naming. Okay, but what if I named it incorrectly? How can I tell that someone named it incorrectly? What's the difference from a between a unit and integration test? Integration test tests all layers and might depend on the state of the system. >> Multiple layers. Yeah. Whatever. All but multiple layers.

[\[02:38\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=158s) >> Okay. What else? So, here's an easy way to tell if a unit is really an integration test. If it touches the file system, if it uses the database, if it uses things that are out of our control, it's an integration test. If it's slow because it depends on something that is slow, it's an integration test. If it's not repeatable or every or it's not consistent.

[\[03:10\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=190s) So every time you run the test or every se once in a while the test returns a different result. It means that there is some problem and the test is might not be a unit test. So I might actually look at the the using for the test and if it's using the file system etc. But why do I want to separate unit tests from integration tests in the first place? What's the point?

[\[03:48\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=228s) Unit tests run much faster and integration test run slower. So I might not want to run my integration tests all the time. Okay, so what's preventing me from doing that? What's the I mean why would I separate so that I can right click on one project and get to run faster? So, it's good to have a separation so that I can have a series of tests that

[\[04:22\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=262s) Run faster. But that does that's that's not the only reason why I would separate. Yes, I might not want to run the integration tests on the build server. Well, usually on a build server maybe at night I would want to run the integration tests. So, but the separation of units from integration is not just about selection because there are other ways to select test. For example, you can put a special attribute called category on tests and ask nunit to run all the tests with a specific category on them.

[\[04:58\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=298s) The real problem that I see with mixing up unit test and integration tests is a really human problem. Imagine that you just got the latest source code from NerdDinner.Tests. You right click on this, you run all the tests. and it's compiling etc etc. We'll see what happens. But what happens if one of the test fails?

[\[05:32\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=332s) Now if I'm new to the team or I don't know this test, I might ask in my team, why does this test fail? And someone might tell me, oh, don't worry about it. It uses a database, so maybe you just don't have a database. Don't worry about it. Someone might say yeah, you probably just missed a configuration somewhere, etc. So here I have 70 tests passing and one failing. Okay, that's the perfect example of such a situation.

[\[06:04\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=364s) Now could it be that this is an integration test? Integration tests are more prone to failures because they need configuration. My problem is that I might think that this test is an integration test. So it's no big deal that only one test fails. But I could be wrong. I could be lying to myself. So the reason I want to separate unit test from integration test is so that if I have a project just with integration tests, they should all be passing.

[\[06:36\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=396s) There should be no question whether a failing test is a problem or not. A failing test is a problem in a unit test project. So I call this the [safe green zone](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-7#ch07lev1sec2 "Mapping out tests based on speed and type (The Art of Unit Testing, 2nd ed., ch. 7)"). I should have at least one project in my solution. I can right click and all the tests should be passing green no matter what when I get the latest version. And that gives me some confidence in the code. If some of them fail and I then I don't and I think that they might fail for the wrong reason then I don't [trust](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-7#sigil_toc_id_134 "How to know you trust a test (The Art of Unit Testing, 3rd ed., ch. 7)") the result of the tests.

[\[07:07\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=427s) So I want to be able to have at least a piece of code a a project that I know that everything there works. And by mixing them up, I'm not giving myself the chance to do that because now I have to go through and understand why is this test failing. I've never seen this test before. Let's take a look. And by the way, with test driven, you can see here whenever you have this at the output window, you can actually double click on the line because this is the line the line number and the column number. This is built into Visual Studio.

[\[07:39\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=459s) And this is where it jumped us to here. So we have expected HTML and actual HTML. Interesting. Now this looks like an interesting test we can actually start with. We don't know if it's an integration test or not. Even though it looks rather interesting, we're not sure what the problem is. So this is an expected HTML and actual HTML and something was wrong there.

[\[08:16\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=496s) And this is exactly my problem. I don't know if I should trust the result of this test. If this was a unit test project, then I would know absolutely for sure that there is a problem here. That's one of the reasons I want to separate. If this was an an integration test project, then the project could have its own set of instructions on how to get all the tests passing. But I would pay less attention to failures here if I just ran the test out of the box. But if this was failing in a unit test project, I would feel much more concerned. Right now, I don't know what to feel.

[\[08:47\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=527s) And I want to prevent that feeling of not knowing what's supposed to happen. And even worse is I could tell myself maybe it's not that important. And it could be if we look at the output. Let's see. Blah blah blah verify rendered list of my dinners. Okay. So the name of the test is also interesting in this case. What does that mean? Verify rendered list of my dinners. Should the lists be you should know what the HTML should be?

[\[09:19\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=559s) Where is the list coming from? This is the only thing. New list of RSVP. Create HTML helper. New my view class. Get my dinners to string. Interesting. So why the hell is this failing? expected blah blah blah but got something that looks different. And the problem here

[\[09:49\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=589s) Is that the machine I'm running this on has a different local, a different language. That gives you an example of what happens when you're preparing strings and you assume a specific local. So it can actually fail on different machines for the wrong reasons. So this is somewhat an integration test. If we assume that all machines render text the same way and they can't.

[\[10:19\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=619s) Now if we wanted to make this test compatible with all machines, we could set the local at the by default for for all the tests to always be American English if you wanted to. So we can have the amun test running specific local. But since we forgot to do this and this machine is actually running with I think Norwegian local then this is exactly why it's failing. Okay. So it feels like a unit test but the problem is that it's not really a unit test because it depends on the local of the system.

[\[10:53\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=653s) And in fact a lot of our tests depend on the local of the system. We don't even think about it. But the moment you go into translation mode and various different translation languages in your own application, you realize that no no string is actually assumed to be American English. let's look at the test in particular. Do you guys have any issues with this test? Do you like it? Do you hate it? Is it amazing?

[\[11:24\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=684s) Is it amazing beautiful? Is it amazingly horrible? Any thoughts? >> It's the name. >> You would change the name. >> Yeah. >> What's missing from the name?

[\[11:58\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=718s) Unit that's being tested. >> What is the [unit of work](https://osherove.com/blog/2020/3/12/unit-testing-entry-points-and-exit-points "Unit Testing Entry and Exit Points (osherove.com)") here? To verify rendered list, we're not sure what is the thing being tested. Is this the thing being tested? Get my dinners to string or is this being tested? Is this being tested? Which one of these is it all of them together? It would be nice to know. So, the name is probably not good enough. Okay. What else other than that? Is is this test perfect?

[\[12:57\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=777s) Okay. Well, revar is usually an invitation to question. Maybe you know what it means because you wrote the code, but for the reader of the test, they now have to look in two different places to understand what is the type. So, be more as more explicit as you can helps the reader.

[\[13:29\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=809s) Yeah, I agree that it's it's almost like yeah, I mean I can see what the type will be here. >> I can see what the type will be here. But my problem is that when you say to people it's okay to have vars sometimes then people like to stretch the red line of when it's okay. So you give them one loophole and assume everything is a VAR. So I would just say look just just don't have VAS at all so that we don't even have to ask oursel that question.

[\[14:01\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=841s) There is an interesting experiment that they did in New York a few good years ago. Many years ago I think it's called the broken window experiment. Have you heard of this? The broken window theory. It talks about the fact they had a building in New York that was run down and they it was a deserted building. They left they broke a couple of windows on the building and within a few days

[\[14:32\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=872s) It was full of junkies and and you know addicts et etc and graffiti but the month before they actually kept the building clean and everything was clean although the building was fully empty for a month or a few weeks and no one touched the building. It was only until you broke a single window is that you actually gave people permission to say it's okay, you're not the first one to do something and so people took advantage of this. So it was an interesting experiment and I think it's the same a lot of times for for people

[\[15:06\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=906s) Where you want to make sure that a specific standard is upheld is that you don't want to give loopholes. But it also goes to the idea of trust. Sometimes you can just trust your team to not use VAR when they shouldn't. But it's a good standard to to you can start with no red line. You just say everything and then a few weeks later to see if you can relax that a little bit if you if it's a more of a teaching tool really. Things I would change here.

[\[15:36\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=936s) There are there are a few u [magic numbers](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-9#sigil_toc_id_169 "Magic values and naming variables (The Art of Unit Testing, 3rd ed., ch. 9)") here like latitude 99 and minus 999. What does that even mean? Now the nice the nice thing that I like about this is that I used to review earlier versions of this code and it used to be much worse. So NerdDinner it appears that people are listening and the test doesn't have a lot of magic stuff here. Although this is still kind of magic.

[\[16:07\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=967s) Does it have to start with 425 to be okay as an input? How long should the description be? Why are these 99? So if it doesn't exist, it could have been one and minus one. Who cares, right? So, when we have magic numbers, we'll just reduce them to the simplest

[\[16:41\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1001s) Closest numbers to the beginning of the area where it's okay. So, if if it's a positive number, we'll use the first positive number. If if it's a positive number that has to be two digits long, we'll use the first one, 10. We won't use 17 because someone will ask what is 17. Or worst case scenario, we'll just extract a cons from this and say introduce a variable

[\[17:15\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1035s) Some latitude. It doesn't really matter. that point is that it's some latitude and so the numbers doesn't really mean anything. Things that also I would change [mock](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-4 "Interaction testing using mock objects (The Art of Unit Testing, 2nd ed., ch. 4)") helpers. Usually people call mock helpers for subh helpers. I innumerable of dinner create HTML helper. If we look at this is this helper method.

[\[17:46\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1066s) Check this out. This is using [Moq](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-5#ch05lev1sec5 "Current isolation frameworks for .NET (The Art of Unit Testing, 2nd ed., ch. 5)"). So it's creating a mock of view context to create new mock of view context. Okay. initializing it with a new controller context that has a mock context based. Now all these mocks are really [stubs](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-3#ch03lev1sec1 "Introducing stubs (The Art of Unit Testing, 2nd ed., ch. 3)"). They're all stubs because at the end of the test, what did we check? The assert was equals on strings. So all these mocks are actually stubs. The words are are meaningless.

[\[18:18\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1098s) We have a lot of [fake](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-4#ch04lev1sec2 "The difference between mocks and stubs (The Art of Unit Testing, 2nd ed., ch. 4)") things here and we're initializing. return this return HTML helper. Create fake HTML helper is probably how I would call it. I don't know if it's a real HTML helper or not. Fact that it's a mock helper may tell me this but again I would use I would call it fake helpers helper to make sure that the wording is better more complete.

[\[18:50\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1130s) Now we have a different test right below this details action should return view for dinner a very different [test naming](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-9#sigil_toc_id_168 "Naming unit tests (The Art of Unit Testing, 3rd ed., ch. 9)") convention. How would you explain that this test name and this test name are very different? How can you explain that? Any ideas why multiple people wrote this code? But just the fact that multiple people write the code doesn't mean that the test name should be so radically different.

[\[19:23\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1163s) What does it mean that they're so radically different? It means that there was no [code review](https://osherove.com/blog/2007/3/13/test-reviews-vs-code-reviews-some-helpful-tips.html "Test Reviews Vs. Code Reviews - Some Helpful Tips (osherove.com)") process or [test review](https://www.artofunittesting.com/unit-testing-review-guidelines "Test Review Guidelines (artofunittesting.com)") process. There is no convention or naming convention that everyone agrees on. And people don't change existing tests that they don't like. They're they're afraid of changing them. Maybe because they don't understand. Maybe because there's a hierarchy there. Maybe there's miscommunication. And so this tells me a lot about the communication the team has between them or lack of communication.

[\[19:54\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1194s) So just because different people write something doesn't mean that it shouldn't look in a coherent manner. Naming conventions are important for tests. They should be agreeable to everyone. So details action should return view for dinner. But when should it return view for dinner? every time it gets called only with when you have details for 999 whatever that means. That's an interesting magic number. By the way, what happens when you see 999 in a test?

[\[20:27\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1227s) Oh, sorry. I looked at a different test. Sorry. Create control details one. So, one is much better than 999, right? Still doesn't mean anything to us. What does one mean? It still looks like a magic number to me. So what does that mean? Details one and it gets an int and it has a file not found result if it's null and then it has a repository find.

[\[20:58\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1258s) So it's an ID of some of something. So where did that ID come from? So this is a magic number. We need to find out where it came from. And how do you solve this? One of the problems with this test is that the dinner with ID 1 was not created or was not set by the current test. It was set somewhere in a hidden way. It was probably created here at create dinners controller hopefully.

[\[21:32\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1292s) If we look at dinners controller, we can see create test dinners right here. Okay, create test dinners. What do we have here? There's a loop and we have 100 dinners being set up. So there's a hard-coded list of dinners. They all look the same and they use the daytime now.

[\[22:03\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1323s) So that means that every time our tests run, every day that our tests run, they're actually running a different test. They're not using the current date. They're they're using a a dynamic date. For this to be a real unit test, for me, it I would use a hard-coded date so we can actually have a consistency among the dinners and among the tests results. But then one day suddenly this test these tests will start failing.

[\[22:35\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1355s) Now that's not a bad thing per se but I would but that means that there was that we we wouldn't be able to understand where the failure came from because these tests used to pass. We would look in many different places. >> Then you should have test for different fixed dates. I might have tests for different fixed dates or I will have integration tests for specific date ranges

[\[23:06\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1386s) >> like with lists of millions of rows for like the minimum date, the maximum date, Georgian calendar, different calendars, different loces. But for a unit test, remember the point of a unit test for us is to generate some functionality in our code. not to prove that everything works all the time, but to drive new code. It's not supposed to be perfect. It's supposed to explain how things should work. Right now, it's it's also doing more things than that.

[\[23:38\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1418s) Yes. The one thing I'm confusing when we check on this now was the dinners controller. the name of this [factory method](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-2 "Trying the factory method route (The Art of Unit Testing, 3rd ed., ch. 2)") or what [setup method](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-8#sigil_toc_id_162 "Avoid setup methods (The Art of Unit Testing, 3rd ed., ch. 8)") didn't explain that they were all that dinners were already created. So I couldn't tell without stepping two steps in that be my problem. >> I fully agree you didn't know that dinners were created. That was kind of my point is that when we look at the test

[\[24:19\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1459s) Create controller and let's go back here is when you create dinners you don't realize you have a bunch of dinners. you you'll realize it from now on, but there's something that's in terms of [readability](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-9 "Readability (The Art of Unit Testing, 3rd ed., ch. 9)") really problematic here. So I would rather say create dinners controller with 100 dinners as the name of the method so that I know where ID1 came from or I would just create a dinner controller with a single dinner which I know the ID for directly in the text in some helper method.

[\[24:58\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1498s) Now I don't need the arrange act and assert here because they're already separated by lines, right? It's just an extra embellishment we don't need. Now this is interesting. Details action should return not found view for bogus dinner. Okay, that's kind of a good name. But remember that the details action that's the unit of work in this case

[\[25:28\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1528s) Bogus dinner is the scenario and this is the expected behavior. So all three parts actually exist. So this test name is actually pretty good. How do we know that 999 is a bogus dinner? That's our problem. So instead of that maybe I would say fake dinner data dinners count plus one sorry like this maybe that would be better

[\[26:01\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1561s) So that I know or even even better is that I would say minus one with an ID that could never exist cuz 999 could actually exist. It looks like a magic number. Or worst case scenario,

[\[26:33\]](https://www.youtube.com/watch?v=xjlsDaX4NEs&t=1593s) Value that says does not exist. ID like this. But still my big problem is that I cannot I'm not creating the dinners in the same test that's using them. And so I have to guess I have to to have a mental map of how everything works in the inside. And I I'm not crazy about that. Okay. So that should get us kind of started on our way on how to look at other people's code.

## Related

- [Test Review #1 - NerdDinner](https://osherove.com/blog/2009/3/20/test-review-1-nerddinner.html) · osherove.com

    Roy's earlier published review of the same NerdDinner tests, for comparing notes with this class session.

- [Mapping out tests based on speed and type](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-7#ch07lev1sec2) · The Art of Unit Testing, 2nd ed., ch. 7

    The 2nd edition's section on mapping tests by speed and type, the unit and integration separation Roy asks for.

- [Magic values and naming variables](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-9#sigil_toc_id_169) · The Art of Unit Testing, 3rd ed., ch. 9

    The 3rd edition's section on magic values and naming variables, like the 999 and bogus values found here.

- [8 techniques to find problems in your unit tests within 30 seconds](https://osherove.com/blog/2009/8/31/8-techniques-to-find-problems-in-your-unit-tests-within-30-s.html) · osherove.com

    Quick ways to spot trust, maintainability and readability problems when reviewing tests, as done in this review.

### Also linked in this lesson

#### The Art of Unit Testing, 3rd ed.

- [Integration tests](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-1#sigil_toc_id_25), ch. 1
- [Interaction testing, mocks, and stubs](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-4#sigil_toc_id_76), ch. 4
- [Reasons to use stubs](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-3#sigil_toc_id_62), ch. 3
- [Defining unit testing, step by step](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-1#sigil_toc_id_17), ch. 1
- [How to know you trust a test](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-7#sigil_toc_id_134), ch. 7
- [Naming unit tests](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-9#sigil_toc_id_168), ch. 9
- [Trying the factory method route](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-2), ch. 2
- [Avoid setup methods](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-8#sigil_toc_id_162), ch. 8
- [Readability](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-9), ch. 9

#### The Art of Unit Testing, 2nd ed.

- [Integration tests](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-1#ch01lev1sec3), ch. 1
- [Interaction testing using mock objects](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-4), ch. 4
- [Current isolation frameworks for .NET](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-5#ch05lev1sec5), ch. 5
- [Introducing stubs](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-3#ch03lev1sec1), ch. 3
- [The difference between mocks and stubs](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-4#ch04lev1sec2), ch. 4

#### osherove.com

- [Naming standards for unit tests](https://osherove.com/blog/2005/4/3/naming-standards-for-unit-tests.html)
- [How to do test reviews](https://osherove.com/videos/2011/2/6/how-to-do-test-reviews.html)
- [Unit Testing Entry and Exit Points](https://osherove.com/blog/2020/3/12/unit-testing-entry-points-and-exit-points)
- [Test Reviews Vs. Code Reviews - Some Helpful Tips](https://osherove.com/blog/2007/3/13/test-reviews-vs-code-reviews-some-helpful-tips.html)

#### artofunittesting.com

- [Test Review Guidelines](https://www.artofunittesting.com/unit-testing-review-guidelines)

[Previous lesson Test Review Practices](https://courses.osherove.com/courses/the-art-of-unit-testing-and-tdd-master-class-in-net/test-review-practices/) [Next lesson Unity Test Review](https://courses.osherove.com/courses/the-art-of-unit-testing-and-tdd-master-class-in-net/unity-test-review/)


---

## 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/
