You must Sign In to post a response.
  • Category: .NET

    How to do Unit testing in asp.net?

    I have not used unit testing any time or any software yet for testing. Suppose I have webform.

    //
    Name : testbox1
    Surname : textbox2
    city : dropdownlist
    Submit button
    //

    Onclick of submit button,I want insert the record.

    // cs file
    I am using sqlhelper class file having some function. I am using that function for insertion and selection.
    In my cs file I am creating sqlfile's object and calling method and passing parameter.

    For debugging I am using Visual Studio, not any software. Manual testing I am doing by means of passing different value to textbox.

    Can anybody tell me how to do unit testing in this case? Do I need to download any software for this? Is it free or not?
  • #765788
    Hi Pinky,

    Visual Studio debugger is more than enough for Unit testing, i'm not aware of available softwares for unit testing, lets see others comments on the same.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #765789
    You can go with multiple options.. I assume you are developing this page using MVC.
    1. Write your own testing methods using MsTest (visual studio version) and validate your functions.
    2. If you want to do in client side then use jquery unit testing (i.e https://qunitjs.com/) and try it.
    3. If you want to write unit testing only for your business /data logic then write Mock object for your UI and create a unit test cases.

  • #765805
    Hello Rajaraman,I did not get u.I am not using MVC.It is plain asp.net web application using C# and sql

  • #765806
    You use ASP.NET unit tests to test methods that are part of ASP.NET projects. You can create an ASP.NET unit test in either of two ways:
    By generating the ASP.NET unit test from an ASP.NET project. This is the most common scenario.
    By configuring an existing unit test as an ASP.NET unit test.
    check out below link for more detail
    https://msdn.microsoft.com/en-us/library/ms182526(v=vs.80).aspx

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]


  • Sign In to post your comments