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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:30:55+00:00 2026-05-23T10:30:55+00:00

I recently came across this nice article from David Ebbo about Unit Testing ASP.NET

  • 0

I recently came across this nice article from David Ebbo about Unit Testing ASP.NET MVC razor views with the help of new Razor Generator tool. But I’ve been asking myself the question, what this can be best utilized for. Of course we can pass in a model and check if all the properties have been populated in to proper html as planned.

I’m new to this unit testing view business so need to get my head around what things to be Unit tested in razor views. Suggestions??

  • 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-23T10:30:56+00:00Added an answer on May 23, 2026 at 10:30 am

    I’ve been wondering the same thing. I can think of a few basic things to check, such as:

    • HTML is valid/well-formed
    • Page title (<title>/<h1>) matches the title from the model
    • Model body appears in the page
    • Correct CSS/Javascript is included
    • Important links appear correctly (paging/purchase/more info)
    • Performance (If you have lazy-loaded models, there could be performance issues you could only spot as the code in the views enumerate/access data)

    In a small app, this probably doesn’t add a lot of value. However in a big app, testing the views could come in handy to ensure changes things aren’t becoming broken as other changes are made (despite best efforts to keep things isolated, it’s not entirely unusual to break something that you believe you never made changes to!).

    I think you could come up with a few important tests to ensure major things in your app work, but you could only really catch things that would be really obvious with a very quick manual test (or even caught during dev). Some may consider this worthwhile, I guess it depends on the app/team.

    Previous experience has taught me that maintaining tests against an ever-changing UI sucks (and if it’s not often changing, the tests won’t add much value). At my last company we spent so much time trying to fix up tests that became broken with updates to the app, we couldn’t add new tests (though this was in part, due to the (crap, but expensive) software we used – Mercury QuickTest). Tests written in C# would probably be more maintainable, but you still need to really weigh up the maintaince work vs the benefit you’ll get from the tests.

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

Sidebar

Related Questions

This is my first StackOverflow question so be nice! :-) I recently came across
I recently came across a question about sequence points in C++ at this site,
I recently came across this blog post Yet another post about gamma correction which
I recently came across the Ruby EOB / -EOB construct within this context (from
I recently came across this article which explains how to use HTML5 tags in
I recently came across this piece of SQL: SELECT members.id FROM members, members_to_groups WHERE
What is scchema importer Extension class in .net webservice.Recently i came across this class
I recently came across this in some code - basically someone trying to create
I've been developing with PHP for some years now, and recently came across this
Recently I came across this error in my WCF trace: There was an error

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.