SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Junior Member
    Join Date
    Dec 2006
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Executing testcases from Excelsheet - Result

    Hi People,

    I kindly need your help, this is my scenario.

    1) I have created an excelsheet in which i am passing testcase name for execution and the corresponding result column should be updated with the status pass/fail.
    2) I am able to read from excelsheet and write to corresponding column, but not the proper status. Here is what i am doing

    *Have overridden default recovery system with TestCaseEnter and TestCaseExit methods.
    in TestCaseExit(boolean bException)
    if(bException)
    ExceptLog()
    *from the main function i am calling a method which as this code

    // for reading exceldata code

    do
    @(testcasename)() -> for execution of the TC
    database execute statement for result updation i.e PASS
    except
    database execute statement for result updation i.e FAIL

    * In the testcase i have used RaiseError for error handling

    3) The testcase is being executed but,if the TC fails also it is not going to except part, means it is updating excel sheet as PASS.

    i dont know why is it happening like that.

    Kindly help. Plz revert for more clarification.
    I appreciate your help.

    Thanks,
    Sushmith

  2. #2
    Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Executing testcases from Excelsheet - Result

    Hi,

    If you have used RaiseError in your testcase it should transfer the control to the next error handler. I checked it and works fine, but if you use LogError the control would not be passed to the next error handler(if any, in your case you have one.).

    Are you sure that there was an unhandled exception in your testcase(not a handled failure) or you are using RaiseError itself which would be directly passing the control to this do except where your testcase is being called?

    If you have do except in your test case, remove it and see if the status is being updated.

    Hope this helps..
    SMP

  3. #3
    Advanced Member KishoreApplabs's Avatar
    Join Date
    Oct 2006
    Posts
    965
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Executing testcases from Excelsheet - Result

    Hi Susmitha,

    Please find the Below function to update the results in Excel sheet. Please call this function in TestCaseExit()


    [-] List of String ReadTestDataFromXL(String sTableName,String sFieldName)
    [-] do
    [ ] HDATABASE hdExcelResultDB
    [ ] HSQL hsExcelResult
    [ ] string sData
    [ ] list of string lsTestData
    [ ] string sResultPath="D:\Silk_Automation\Ref2\BP\Test Data\TestData.xls"
    [ ] hdExcelResultDB=DB_Connect ("DRIVER=Microsoft Excel Driver (*.xls);DRIVERID=790;FIRSTROWHASNAMES=1;READONLY=F ALSE;DBQ={sResultPath}")
    [ ] hsExcelResult = DB_ExecuteSQL (hdExcelResultDB,"Select {sFieldName} from [{sTableName}$]")
    [+] while(DB_FetchNext(hsExcelResult,sData)==TRUE)
    [ ] ListAppend(lsTestData,sData)
    [ ]
    [ ]
    [ ]
    [ ] DB_FinishSQL(hsExcelResult)
    [ ] DB_Disconnect(hdExcelResultDB)
    [ ] return lsTestData
    [-] except
    [ ] ExceptLog()


    whe you implementing any testcase you can the expection raise statument ex:

    testcase test1() appstate none
    do
    //Test case action

    except
    raise 1, "Failed to execute above testcase"

    for the above test cases result will store

    date, testcasename,result expection etc.....

    let me know if any clarifications

  4. #4
    Junior Member
    Join Date
    Dec 2006
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Executing testcases from Excelsheet - Result

    Hi SMP123 and Kishore,

    Thank you for the reply.

    SMP123-> at first i used LogError, then i replaced it with RaiseError because of the reason you gave. Still it is not working. Everything is working fine, reading writing, but since the control does not transfer properly it is not going to except part, it is going to next statement after @(testcasename)(), i.e even if the testcase is failing, it is updating excelsheet as PASS. I checked by adding and deleting do except in testcase. I am getting confused [img]/images/graemlins/frown.gif[/img]

    Kishore-> I have used almost the same function, and also i am dynamically creating the result file using a base driver excelsheet, each time for each run.

    Thanks,
    Sushmith

  5. #5
    Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Executing testcases from Excelsheet - Result

    Hi Sushmith,

    Why dont you remove the do..except block in your testcase and run the scripts.

    Now since the script which calls the testcase is in do except block, the control should be transferred to the except block in case of an exception and see if writes the results correctly.

    Give it a try,
    SMP

  6. #6
    Junior Member
    Join Date
    Dec 2006
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Executing testcases from Excelsheet - Result

    Hi SMP,

    I Checked that, by removing do except, i had not done that first, i added it and then deleted it also.

    Thanks,
    Sushmith

  7. #7
    Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Executing testcases from Excelsheet - Result

    Hi Sushmith,

    another way you could deal with this is, In your testcase handle the error, Increement a counter for each error you encounter. Use a global variable as the counter, before each testcase is executed reset the counter.
    So at the end of each testcase you can check this counter to see if the testcase has failed or passed. Here you will also get the no. of errors in your testcase.

    If you think it would do for you give this a try,
    SMP

  8. #8
    Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Executing testcases from Excelsheet - Result

    Hi Sushmith,

    Thats surprising, are youn saying that when you are having an exception in the called function the exception is not raised to the calling function??

    If the testcase does not have error handling and the statement that calls the testcase is inside do..except the control should be passed to the except block.

    Have never come across this kind of a situation!!

    Why don't you raise a divide by zero exception in your testcase(comment all the line of code that you are having now) and see if the control is passed to the except block. to remind you again dont put the code inside your testcase in do..except.

    Thanks,
    SMP

  9. #9
    Junior Member
    Join Date
    Dec 2006
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Executing testcases from Excelsheet - Result

    Hi SMP,

    Thank you, once again.

    See i am making the TC fail using RaiseError, so that it would come to except part. So how will the errorcount help here? i dont want the errorcount for a testcase, if the TC fails it should come to except part, which is not happening.

    Sushmith

  10. #10
    Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Executing testcases from Excelsheet - Result


    I asked to you to raise an exception only to check this, if you forcefully generate an exception we will know for sure what is causing the problem.

    If you reset the error count for each testcase, after the testcase is executed, you can raise an error and write to the excel sheet if the error count is not equal to zero.

    that was one idea I thought about, may be there will be better ways of doing this!!

    Thanks,
    SMP

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:16 PM.

Copyright BetaSoft Inc.