Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 933329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:49:04+00:00 2026-05-15T20:49:04+00:00

I just started a new project, and now with ASP.NET MVC being designed in

  • 0

I just started a new project, and now with ASP.NET MVC being designed in an extremely composable way, I figured it might be a good time to start with unit testing. Most of my code is fresh, and I’m writing the tests before I’m writing the actual production code.

My frustration, though, is that I spend a lot more time fixing mistakes in my tests than in fixing anything wrong with my production tests.

My typical workflow ends up being something like this:

  1. Write a stub
  2. Write the test
  3. Ensure that the test fails
  4. Fill in the stub
  5. The test still fails, so spend a while going over the expected and actual output.
  6. The error turns out to be in the test, not the actual code. Fix the test.

If you think about it, this is somewhat to be expected: unit tests involve producing output by hand and so is error-prone; code written in a strict language and with good coding practices has behavior that is specified very much automatically.

Of course, there are odd times when my production code is the actual cause of a test failing, but it’s just really comparatively rare.

There’s no reason to eliminate unit tests entirely, of course; there are times when I simply don’t trust my own code at all. On the other hand, I’m starting to feel like it’s not all that valuable — especially the test-first philosophy.

Anyone else feel this way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:49:05+00:00Added an answer on May 15, 2026 at 8:49 pm

    I feel you there, here are a couple of things I have found useful when writing unit tests to make them more solid:

    • If you haven’t already, try breaking down your unit tests to one assertion per test. You may have to do many assertions per unit of code that your testing if the methods are massive (this may mean your methods should be broken down too). But this will loosen up your unit tests and make them less prone to time consuming maintenance. Theres a good pattern to put into practice called Arrange, Act Assert (AAA)
    • Make sure your unit tests are completly isolated, i.e., there are no interactions or calls outside your code i.e., databases, web services etc.
    • Use available frameworks to make your unit testing experience easier and to do most of the work for you, e.g., Nbuilder to hack up lists of objects and Moq to mock out objects you need for testing.
    • If you don’t already, use test fixtures so you dont have to set everything up for each test.

    TDD and unit testing is definitly something that starts off a real pain in the butt, but its one of those things that gets much easier and faster to do the more you keep at it.

    Richard Dingwall’s blog has quite a few articles on best practices for unit testing and TDD, many actually regarding unit testing with MVC.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We just started a new ASP.Net project that uses web services to serialize some
Intro I'm developing a project with MVC.Net. I have just started a default website
Hi all I've just started a new project using Visual Web Developer 2008 Express
I'm just starting with ASP.NET MVC and I was trying the Authentication with this
We have just started our new assignment - web-based project. Before I get directly
I just started to read about this new technology... Does someone have some knowledge
Just started getting a bunch of errors on our C# .Net app that seemed
I just started using the WPF WebBrowser that is included in Net 3.5 SP1.
I just started to learn Ruby and as a .Net developer, I'm wondering if
I am just getting started with Silverlight and have recently added a Silverlight project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.