• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Unit testing ASP.NET

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Unit testing ASP.NET

    I am just interested in how people approach this and what they've seen in use at various client sites lately.

    Being limited to ASP.NET 2.0 and MS products, my approach has been to make use of Model View Presenter and testing the presenters using mocks. I thought that might be a pretty standard approach, but the interviews I recently attended suggested otherwise (where the approach has been generally manual).

    #2
    Originally posted by Jaws View Post
    I am just interested in how people approach this and what they've seen in use at various client sites lately.
    Nunit is used quite a lot.
    Cooking doesn't get tougher than this.

    Comment


      #3
      MbUnit and WatIn together will do it pretty well.

      Comment


        #4
        A combination of NUnit for non UI code (business, data) and Selenium for your ultra thin ASP.NET pages is what I recommend.

        http://www.peterkrantz.com/2005/selenium-for-aspnet/
        http://selenium-core.openqa.org/

        However, most ASP.NET sites are actually tested by the users. Users are cheap and don't impact the coding phase.

        Comment


          #5
          Tend to side with manual testing at the moment, but with the new MVC extensions for .Net just round the corner, hopefully VS2008's testing tools will provide more coverage.

          Or rather, I should rephrase my statement to say, I tend to unit test upto the class level, as there's no VS2008 way of testing the UI at the mo. Hence, manual testing of the UI as such
          Last edited by Weltchy; 3 July 2008, 07:09.

          Comment


            #6
            We tend to use the testing within Visual Studio 2008 and the Assert Class, and creating a testing project. Pretty good at the class level but as mentioned previously NUNIT seems to be pretty standard practice for unit testing outside of this

            Comment


              #7
              At the risk of straying off topic, I was trying out the Web Client Software Factory for VS 2008 the other day and it creates all these test projects and mocks, etc. “What the frack is all that about?!”, thinks I, scratching my hairy arse.

              Has anyone made use of all this stuff? I too am interested in automated testing as well as the MVP pattern.

              It looks like what I need for a new product/service I have in mind. I’m not as techie as I once was so it’s all become a struggle to keep up with all this.

              I’m going to need to use the web services stuff to get to my main database, but that will come next.
              How did this happen? Who's to blame? Well certainly there are those more responsible than others, and they will be held accountable, but again truth be told, if you're looking for the guilty, you need only look into a mirror.

              Follow me on Twitter - LinkedIn Profile - The HAB blog - New Blog: Mad Cameron
              Xeno points: +5 - Asperger rating: 36 - Paranoid Schizophrenic rating: 44%

              "We hang the petty thieves and appoint the great ones to high office" - Aesop

              Comment


                #8
                Originally posted by HairyArsedBloke View Post
                At the risk of straying off topic, I was trying out the Web Client Software Factory for VS 2008 the other day and it creates all these test projects and mocks, etc. “What the frack is all that about?!”, thinks I, scratching my hairy arse.

                Has anyone made use of all this stuff? I too am interested in automated testing as well as the MVP pattern.

                It looks like what I need for a new product/service I have in mind. I’m not as techie as I once was so it’s all become a struggle to keep up with all this.

                I’m going to need to use the web services stuff to get to my main database, but that will come next.
                I did take a look at that but didn't really like the way everything was structured so opted against using it (more out of personal preference than anything else). I've used MVP in a very similar way to how they use it there, but using MS Unity for dependency injection rather than Object Builder. It's working very well for me. The general approach to the WCSF seems good though, MVP with a controller for UI logic is probably how I'd approach it for a more complex site. If you're willing to adopt technology early, as mentioned earlier, the MVC framework might be a better option (at least for your CV)!

                Comment


                  #9
                  I've had a brief glimpse at the software factory ui stuff, To be honest the amount of code generation scared me. for production code...but thats just me...Also started looking at the Unity block recently for DI (my first look at this pattern), looks pretty good.

                  I would be interested to know if there is any uptake for these factories though...I've previously hand crafted(or should i say hacked?!) everything and used the Ent Lib for my crosscutting functionality.

                  Apart from unit testing what other gains do you get from MVP? I might be stupid but it appears to me that if your manually testing then the page behind model gives you a useable MVP model (if rather crude).

                  Comment


                    #10
                    Originally posted by LittlestHobbo View Post
                    Apart from unit testing what other gains do you get from MVP? I might be stupid but it appears to me that if your manually testing then the page behind model gives you a useable MVP model (if rather crude).
                    I suppose you could theoretically use MVP to swap in alternative interfaces (winforms for instance) - although in practice that is unlikely to be a requirement. The main gain is in unit testing the code in your event handlers - that's the only reason I've ever used it.

                    Comment

                    Working...
                    X