How to implement TDD in ASP.NET WebForms -


I know that test driven design (TDD) due to Microsoft coming out with ASP.Net MVC is ASP.NET However, I have a large brown area (existing) application in the ASP.NET webform, in which I would love to implement some TDD type functionality. I am assuming that there is a way to do this, but what are some viable options? Microsoft introduced ASP.NET MVC because they felt they could earn money from an unused market - those who feel that the web forms are also "heavyweight", and that are programming using the lighter-weight framework Those people who are addicted to the MVC paradigm are included.

It also includes those who did not understand the way to test the unit in web forms, and who want to use unit testing and TDD.

The way to do this with web forms, apart from anything else, is to separate everything, but a user code is in different classes in the class library. Use TDD to develop those classes.

The next layer of the dispute is to use TDD to develop the remainder of the code: markup, client side code, user interaction etc. My answer is that if you have been separated and tested, then there is no problem in using TDD.

Consider: Your pages should be present in a special way. Are you writing an unsuccessful unit test to prove that you are using CSS? To prove that you're using the right CSS styles? I do not think so.


To clarify: In TDD, we start with unsuccessful unit testing. We make the easiest possible changes that make the test a success.

Imagine using a TDD for a web page.

  • Test the page to include the correct title
  • Check the test that joins the page
    1. "Enter ID" label
    2. An ID text box
    3. A data grid
    4. a "go" button
  • Check that the data grid GET
  • Check with the data from the customer that grid load when "1" is entered in the text box and "go" is clicked.
  • And there is no one of the above tests for the presence of the page; None of these test the javascript's client-side behavior on the page.

    I think it is silly, instead, test your DAL method which retrieves data based on ID, make sure that it returns the correct ID for ID1. Then, to make sure that how much time will it take to manually test the page manually, you can enter "1" and click on "Go", and the data that appears in Is the grid data correct for the customer?

    Test-induced development and automated unit testing are meant to test behavior. The UI of a web form is mostly declarative. There is a big "impedance mismatch" here.


    Comments

    Popular posts from this blog

    c++ - Linux and clipboard -

    What is expire header and how to achive them in ASP.NET and PHP? -

    sql server - How can I determine which of my SQL 2005 statistics are unused? -