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 7713029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:46:09+00:00 2026-06-01T01:46:09+00:00

I realize this is a duplicate of about 20 different posts, but none of

  • 0

I realize this is a duplicate of about 20 different posts, but none of them are specific to MVC4, and none that I’ve seen really answer all of my questions. So far my first foray into the world of TDD has been frustrating to say the least. Most of what I’ve tried to do seems incompatible with MVC 4 or next to impossible without using poorly documented third party libraries I don’t quite understand yet.

What I want to be able to do, is write a tests that will test my Controller Actions, The Model they’re passing and The View the action is sending the model to. I want to test if the view exists, I want to test if the model being passed is the right type for the view, I’d like some way to test if it will process properly. I also want to be able to test my routes. And testing Authentication filters?

I want a way to unit test ASP.Net MVC that will leave very little to chance.

Testing the Model output of an Action seems easy enough, but testing the views has been next to impossible.

So here’s my list of questions:

  1. Once I test the action and get the action result, how do I test to see if the view it wants exists?
  2. How do I test my routes?
  3. How can I test to be sure my views are being processed properly?
  4. What is really “best practice” for THOROUGH unit testing of ASP.Net MVC 4?
  5. How do I unit test forms authentication?
  6. How do I unit test Action Filters?

I’d prefer to use the built in Visual Studio test projects, but if I must use NUnit, I must. I just need to make sure it gets done properly.

Thank you in advance for your responses.

EDIT: I also couldn’t get NUnit working with my MVC4 app because of some incompatibly with the version of .NET one of the assemblies was compiled in.

  • 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-06-01T01:46:10+00:00Added an answer on June 1, 2026 at 1:46 am
    1. Making sure a view exists
    2. http://haacked.com/archive/2007/12/17/testing-routes-in-asp.net-mvc.aspx/
    3. http://blog.davidebbo.com/2011/06/unit-test-your-mvc-views-using-razor.html
    4. see below
    5. How can I unit test my ASP.NET MVC controller that uses FormsAuthentication?
    6. How-to test action filters in ASP.NET MVC?

    no. 4: This is a hard question. How does one test anything thoroughly? Personally, I don’t really test the views, other than with the 3 major browsers and my two eyes, as it’s hard to test a website and all it’s components without actually using it. You have JavaScript firing, CSS stylizing, and it looks different across different browsers. So, to me, it seems like testing the view that thoroughly is a minor part of the overall usability of your site. If you’re developing a simple table based report of financial data, test that data hard. If your view is a the base for a fancy Ajax site, maybe don’t test the HTML so much as the experience. I know it’s not an easy, cut-and-dry answer, but the acceptable level of coverage always involves trade offs.

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

Sidebar

Related Questions

Greets. I realize this might be seen as a duplicate question as this but
I realize that this might be a duplicate question but this question is very
I realize this is likely a duplicate, but I've been googling/SOing for a day
I realize the knee-jerk response to this question is that you dont., but hear
I realize this would violate convention, but I'm curious to know if you can
I realize this perhaps a naive question but still I cant figure out how
I realize this is more of a hardware question, but this is also very
I realize this is a rather odd request, but I was wondering if anyone
I realize this is probably a hopelessly newbie question, but what is the difference
I realize this is a basic question but I have searched online, been to

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.