SPONSORS:






User Tag List

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

    Roundings on returned data

    Background:
    I'm currently testing a mortgage application that obtains data from a client, mortgage amount, term etc and returns a quotation amount.

    Problem:
    I've been given some figures from the client and am performing checkpoints from a data table to ensure that the figures appearing on screen are the same as the client will expect - nice and easy so far. However, the client accepts a one percent tolerance/rounding up or down on the returned figure. I'm not sure how to do this.


    Current Code:
    Browser("Quick online").Page("Overview").Check CheckPoint("253,172.07").

    I've put this checkpoint into a Parameter so that the Checkpoint Properties are "Check that <Total_Mortgage_Interest> is displayed between mortgage interest and Total amount

    Please help

  2. #2
    Junior Member
    Join Date
    Dec 2004
    Location
    West Sussex
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Roundings on returned data

    Okay, well I've worked out what I should do but not how to do it. I'm calling a function and sending some variables which detail the amount returned from the application and the amount expected from this information I want to insert this data into a table on the new function (don't know how to do this) and then calculate using the excel functionality whether the figure is 1% greater or lower than the expected figure. If the returned amount (from the application) is greater than the 1% lower limit and lower than the 1% higher limit then True is returned to the main script and the script continued.

    This will allow me to use this script to test all tollerances using variables, however I'm stuck on the following:

    1. How to populate the datatable with the data that's passed into the function from the main function.

    2. How to return the data into the main function

    3. How to receive the info into the main function (please help).


    thanks


    samantha

  3. #3
    Super Member
    Join Date
    Oct 2004
    Posts
    1,222
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Roundings on returned data

    Originally posted by Samantha Bailey:
    I want to insert this data into a table on the new function samantha
    <font size="2" face="Verdana, Arial, Helvetica">Samantha,

    I am not sure why you might need to insert passed data into a table. I'm not sure how you'd implement this too.

    Here is an alternate approach. Simply capture the actual and expected value. You could use output checkpoints for this or GetROProperty("innertext"). Pass these as input parameters to the function. The function calculates 1% above and below the expected value, compares the actual value and returns True or False based on your set criterion.
    ----------------
    &lt;Steps of your script&gt;
    &lt;....&gt;
    ReturnVal = PercentCal(actualval, expectedval)
    If ReturnVal = "True" Then....
    &lt;your logic here&gt;
    ------------------
    Function PercentCal(actualval, expectedval)
    &lt;Your logic to calculate and compare the 1% bit&gt;
    PercentCal = &lt;ReturningValue based on comparison&gt;
    End Function
    ------------------

    Hope that helps. It's just the basic logic I though off, haven't tried out though.
    (I'm hiring Software Development Engineers in Test in Seattle, WA)

  4. #4
    Junior Member
    Join Date
    Dec 2004
    Location
    West Sussex
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Roundings on returned data

    this is great, you've really improved my weekend by stopping me thinking of bl00dy work!!!

    I'm just going to try it, when I'm creating functions do I just stick them in Notepads with .vbs suffixes sounds a bit strange? Surely this means we can't use the full functionality of QTP within these functions then?

  5. #5
    Super Member
    Join Date
    Oct 2004
    Posts
    1,222
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Roundings on returned data

    Originally posted by Samantha Bailey:
    this is great, you've really improved my weekend by stopping me thinking of bl00dy work!!!
    <font size="2" face="Verdana, Arial, Helvetica">Well, you are here so technically you are thinking of work.

    when I'm creating functions do I just stick them in Notepads with .vbs suffixes sounds a bit strange?
    <font size="2" face="Verdana, Arial, Helvetica">Yup

    Surely this means we can't use the full functionality of QTP within these functions then?
    <font size="2" face="Verdana, Arial, Helvetica">Yup again. Technically you could use even objects from your OR, though most would recommend you not to. But in your case I dont see why you'd need anything from QTP except for the 2 values for comparison. Otherwise things are the same, you use the same commands et al.
    (I'm hiring Software Development Engineers in Test in Seattle, WA)

  6. #6
    Junior Member
    Join Date
    Dec 2004
    Location
    West Sussex
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Roundings on returned data

    I wanted to perfrom comparisons and calculations using Excel, lazy I know but my excel is better than my vbscript. Anyway, thanks I'm off to the pub, I'll update this on Monday, thanks for your help, mines a Vokda and Red Bull

  7. #7
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Roundings on returned data

    Samantha you should declare these VBS files to your QTP script as external library files: Test &gt; Settings &gt; Resources &gt; select the + and add your file.

    Use this as a demo
    ===============================================
    Add this to your VBS file and associate to the script:

    Function ReportLine(rStatus,rStep,rResul)
    Reporter.ReportEvent rStatus,rStep,rResult
    End Function
    ===============================================
    This is the call from QTP (Reporter is a QTP functionality not VBScript):

    rStatus = 0
    rStep = "Logon to Application"
    rResult = "Logon Successfull"

    Call ReportLine(rStatus,rStep,rResult)
    ==============================================

    Hope this helps, Mark.

  8. #8
    Super Member
    Join Date
    Oct 2004
    Posts
    1,222
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Roundings on returned data

    Ahhh lucky you. I still have the day ahead of me and thanks to you I'll be thinking of my after-work friday exploits all day now!

    Btw, I think I heard in some news report that red bull with alcohol, though a popular mix, is known to cause cardiac arrests or hypertension. Just a note. Having said that, the media has never deterred me from my happy hour practices (nothing has for that matter) so go ahead and have a good weekend.

    Not to **** off the moderators, I find myself forced to write something relevant to the original post. Well, my excel isn't great but you can always post your queries here and I'm sure they'll get answered. If I'm in a good mood, I might do so myself [img]images/icons/smile.gif[/img]
    (I'm hiring Software Development Engineers in Test in Seattle, WA)

  9. #9
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Roundings on returned data

    Can't believe you get to leave work and go to the pub at 6pm.

    I must be doing something wrong, knew I should have stayed a permmie.

    Have a good session and try not to think of those b1oody scripts until Monday.

    Mark Smith.

  10. #10
    Junior Member
    Join Date
    Dec 2004
    Location
    West Sussex
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Roundings on returned data

    Okay I'm back now, no Cardiac arrests, I hope you lot had a great weekend. thanks for the comments, mwsrosso I have a question, I have added this to the library which is fine but am a little confused, I am passing five variables as inputs to the function from the script and my main issue is using these variables to perform a calculation and then return a pass or fail code. What you've told me relates to logging onto an application, which I'm not doing I'm extracting data from an application into my data table and then sending this information to the function for calculation purposes. so far the code is like this (I know it won't work but this is where I am at:

    QTP Script:
    Call GetTolerance(AppOutput, ExpResultOutput, PerorAmount, UpDown, Tol)
    abc = Toleranceoutput()
    Function Tolerance()
    Text - "Return value from function"
    Status = Passfail
    End Function

    The Notepad (Function):

    Dim AppOutputMin, AppOutputMax, ExpResOutMin, ExpResOutMax
    Function Tol(AppOutput, ExpResultOutput, perorAmount, UpDown, Tolerance)
    'AppOutputMin = AppOutput - 1%
    End Function

    As you can see I'm a long way off doing this but the basic premise is.

    I'm outputting the Application Result (AppOutput), the expected result from the data table (ExpResultOutput), whether the roundings are % or (PerorAmount), whever the rounding can be Up or Down (UpDown) both in this case, the percentage roundings that are allowed (tolerance - in this case 1%). The reason for the above is to allow this function to be flexible for other scripts.

    Then I want to move the application amounts (AppOutput) and add 1% (AppOutputMax) and minus 1% (AppOutputMin) and then ensure that the expected amount is within these two boundaries (inclusive), if it is I want to return a pass if it's not I want to return a fail.

    I know it sounds complicated but I know what I want to do, but don't understand how to code it.

    Thanks


    Samantha

 

 
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.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 08:12 AM.

Copyright BetaSoft Inc.