locked
Test Case failure RRS feed

  • Question

  • Hi All,

    I am working on Coded UI and my question is,

    I have some validation in my test cases and after the validation I have some further steps but suppose there is some validation failures in my test case then at the time of execution it will come out from the execution and my further steps which is there in my test script after the validation will not execute.

    I want to execute full test case till end if there it has a failure also. it should not come out from the execution.it should show execute the remaining steps if it is not a blocking issue.

    I am working on windows application.

    Please suggest

    Thanks

    Laxmikant


    laxmikant

    Tuesday, September 3, 2013 11:57 AM

All replies

  • You need to add exception hanlders (Try/Catch) to your source code to allow the code to get past any excpetions.  If you don't have exception handlers in your csource code then a microsoft default exception handler is used which will abort after the first exception.

    jdweng

    Tuesday, September 3, 2013 12:06 PM
  • Thanks Jdweng,

    I can use try/catch block but I don't think so it is a good practice to use if we have so many validation in our test script.

    is there any other solution to solve this issue

    Thanks

    Laxmikant


    laxmikant

    Tuesday, September 3, 2013 12:09 PM
  • It is always good programming practive to have exception handlers in your source code to handle invalid conditions.  When building test benches you want have the following  options in the exception handlers

        1) To display exception to user with a message box

        2) Not to use message box and save exception to a log file

        3) to Continue or not continue after exception (optional).


    jdweng

    Tuesday, September 3, 2013 12:14 PM
  • One thing I would like to know, I am generating HTML log file using QTagent32.exe.config file it is generating the .html log file but if I want to print anything in html file during the automation then how can we achieve that.

    Please suggest.


    laxmikant

    Tuesday, September 3, 2013 12:38 PM
  • Write to the log file like any other output.  Usually I use the following to write to the console

     

    catch (Exception e)

         Console.WriteLine("Error in function XYZ : {}", e.Message);

    Instead of writing to console, write to youy log file.


    jdweng

    Tuesday, September 3, 2013 12:43 PM
  • but console will print on the console section in visual studio but I am generating HTML log file I am not using console. if I use console it will print in the console section. Please refer below my failure log screen shot in HTMl format

    Here it is printing only the comment line but if I want to print anything from my side it will not means I don't know how to do that


    laxmikant

    Tuesday, September 3, 2013 12:49 PM
  • Do you have a sample of where you are writing to the log file?

    jdweng

    Tuesday, September 3, 2013 1:01 PM
  • Please find below my code what it is printing in the log file

    Thanks

    Laxmikant


    laxmikant

    Tuesday, September 3, 2013 1:07 PM
  • Hi Joel,

    I didn't get your answer, actually I want to print the line where we are doing the validation it is printing the line where we are doing action means where we are clicking by mouse.click . But I want to print the line also where we are doing the validation I have sent you the html log file and we can see it is printing only the clicking action.

    So I want to know is there any way so we can print the validation line also.

    Thanks


    laxmikant

    Wednesday, September 4, 2013 5:37 AM
  • Read the webpage I refered to in my last posting carefully.  It shows a few different ways of handling an exception in a test bench.


    jdweng

    Wednesday, September 4, 2013 6:49 AM
  • for exception is fine for me but how can I print the validation(Assert) comment in HTML log file. it is printing only the mouse click event not for validation.

    Please suggest


    laxmikant

    Friday, September 6, 2013 6:04 AM
  • Hi Laxmikant,

    Thank for your posting.

    From your deseription,I think that this issue is related to Code UI,Visual studio Unit Test  forum is more suitable for it.So i move it to Visual studio Unit Test  forum .

    Visual studio Unit Test  forum : http://social.msdn.microsoft.com/Forums/en-US/home?forum=vsunittest

    Hope these help.


    Lilia Gong <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 18, 2013 11:59 AM