SPONSORS:






User Tag List

Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Jan 2001
    Location
    san francisco
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    data verification of randomly generated strings

    hi,
    i'm new to silk and can't seem to figure out how to verify data which is randomly generated. the randomly generated value is listed as a string.

    However, the below listed code fails at the line which attempts to return the value to the boolean statement
    (sSelectedValue)
    [ ] Print (sSelectedValue)
    [ ] Return BrowserPage.HtmlText (sSelectedValue)
    [ ] Verify (BrowserPage.HtmlText (sSelectedValue). Exists (), TRUE)
    [ ] LogWarning ("Randomly Selected Asset Type {sSelectedValue} was found")

    any help you can provide would be appreciated.

    thanks,
    esme

  2. #2
    Member
    Join Date
    Nov 2000
    Posts
    44
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: data verification of randomly generated strings

    Hi,

    The 'return' keyword in SilkTest is used to pass control from a function to it's calling fucntion (ie the last thing you should have in a function). Try removing the line with the return statement and see if your script works. Alternatively, if this is the line that you want to use to populate the variable, you should use a method, such as GetText () (ie BrowserPage.HtmlText (sSelectedValue).GetText ()), but in this case you will need to use a different menthod of identifying the control on the screen (such as the index).

    I hope this helps,

    Paul

    Paul Tucker
    Automation Expertise Europe http://www.automationexpertise.com
    Paul Tucker
    Automation Expertise Europe
    http://www.automationexpertise.com

  3. #3
    Member
    Join Date
    Dec 1999
    Location
    Portland, OR, USA
    Posts
    91
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: data verification of randomly generated strings

    [QUOTE]Originally posted by esmesqualor:
    [B]
    used the GetText command to define the string sSelectedValue. The value will print correctly it just won't passt o the boolena statement. my question now is, is it possible to pass a string to a boolean statement?
    =========================

    ??? I am sorry but I do not understand the question.

    Please be more specific about what it is you are trying to do.

    A BOOLEAN variable cannot be assigned a STRING value. Period.

    A BOOLEAN is either TRUE or FALSE and is usually the result of testing for a condition.

    Your code looks fine to me.

    [ ] Verify (BrowserPage.HtmlText (sSelectedValue). Exists (), TRUE)
    [ ] LogWarning ("Randomly Selected Asset Type {sSelectedValue} was found")

    What is the problem ?



    [This message has been edited by cradley (edited 01-04-2001).]
    Quality Control Analyst at Syntel Inc
    Project Test Lead for client Daimler Trucks - North America.
    Interested in testing dot net web services and SOA systems.
    Charles F. Radley
    Oregon, USA.

  4. #4
    Junior Member
    Join Date
    Jan 2001
    Location
    san francisco
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: data verification of randomly generated strings

    no
    the question is "is it possible to PASS a string to a boolean statement? "

    The condition which i'm testing (in the boolean statement) for is the existence of a string. (sSelectedValue)


    do you understand now?

    THE ACTUAL QUESTION

    Firstly-If i can use a boolean statement to test for the presence of a string, then what is the syntax for the boolean statement.

    Secondly-Can i search for html text within an html table, using this statement-

    Verify (BrowserPage.HtmlText ("Selected Type:{sSelectedType})").Exists (), TRUE)

    My code works untill the above line, which does not return the string sSelectedType.

    However the string sSelectedType will return correctly in other places.

    thanks,
    esme


  5. #5
    Junior Member
    Join Date
    Jan 2001
    Location
    san francisco
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: data verification of randomly generated strings

    paul, thanks for your reply. i had removed the return statement prior to your reply. i used the GetText command to define the string sSelectedValue. The value will print correctly it just won't passt o the boolena statement. my question now is, is it possible to pass a string to a boolean statement? and if so what's the syntax. or is the problem that i'm looking for html text that is captured within an html table?
    any replies will be appreciated.
    thanks.

  6. #6
    Member
    Join Date
    Nov 2000
    Posts
    44
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: data verification of randomly generated strings

    Hi,

    What error is it that you actually get? Is it a error in the script code or is it a verification error (ie the HtmlText does not exist!). There is nothing wrong with passing a variable in the way you have, but you should check that the control does actually exist. Instead of populating the variable using the GetText method, try using the GetTag method and getting just the Tag for the HtmlText control. There is no guarantee in Silktest that the tag being usedis the same as the Text value.

    The other thing to remember is that the Verify fucntion is actually a test function. That means that if the verification fails, execution of testcase is halted at that point. You could try putting the a do ... except around the line or simply change the the line to:
    [-]if (BrowserPage.HtmlText (sSelectedValue). Exists ()
    [ ]LogWarning ("Randomly Selected Asset Type {sSelectedValue} was found")

    Hope this helps,

    Paul

    Paul Tucker
    Automation Expertise Europe http://www.automationexpertise.com
    Paul Tucker
    Automation Expertise Europe
    http://www.automationexpertise.com

  7. #7
    Junior Member
    Join Date
    Jan 2001
    Location
    san francisco
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: data verification of randomly generated strings

    the error message that i recieve is *** Error: Window '[HtmlText]Asset' was not found

    the string is being passed to the statement, it's just not being found on the page. Even though the html text clearly exists.

    the test case will automatically recover even if the test fails. so it won't cause my scripts to stop running

    thanks for your help paul.

    esme

  8. #8
    Member
    Join Date
    Nov 2000
    Posts
    44
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: data verification of randomly generated strings

    Esme,

    It looks like the window does not actually exist. As I said in my previous reply, the fact that a particular piece of text is visible in an object does not mean that this is the tag that will be used by SilkTest to identify the object. When you declare object dynamically as you are doing, you are calling them by requesting an object of type [Class] with the tag Name.

    To find out what the actual tag of the window is, use the GetChildren () method on the parent window and print the results. You will then be able to check through the results and find out what the control is actually called in SilkTest.

    One other thing to check is that [HtmlText]Asset is a child of BrowserChild. If it is in a frame or a table, then the statement would need to be BrowserPage.FrameName.[HtmlText]Asset.Exists ()

    Good luck.

    Paul

    PS If you still cannot get this working, please include your frame, the script and the results file in your next post.

    Paul Tucker
    Automation Expertise Europe http://www.automationexpertise.com
    Paul Tucker
    Automation Expertise Europe
    http://www.automationexpertise.com

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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 11:10 PM.

Copyright BetaSoft Inc.