Results 1 to 3 of 3
  1. #1

    Constants in TestPartner 6.0

    In TestParter how do you create a constant? All attempts are not resolving to the correct text at runtime. Watch window shows empty string "". Obviously I'm missing something here [img]/images/graemlins/smile.gif[/img]

    The application under test has multiple edit boxes on the same screen with the same label. This application will be run in various languages. Therefore need to isolate the labels to a constant.

    Here’s an example, in the following the word “First” will change in other languages and needs to be a global constant/variable.

    EditBox("Parent.Label=First Index=1").SetText "Zack"

    What was tried:
    In shared module titled “Lang” created

    Global Const sFIRST = "First"

    Then in script
    EditBox("Parent.Label=’sFirst’ Index=1").SetText "Zack"

    When using 'sFirst' Test Partner is setting the text for the wrong edit box. Not the Index=1 edit box with the label of “First”.

    A watch window shows sFirst as resolving to "". How is Test Partner even setting the test of the wrong edit box then? If anything I would expect it to set text in the box with Index=1 but it's finding another.

    How would you handle this situation in Test Partner.

    Thank you

  2. #2
    Senior Member
    Join Date
    Apr 2003
    Wisconsin, USA

    Re: Constants in TestPartner 6.0

    You have the wrong syntax for what you want to do.

    You started with:

    EditBox("Parent.Label=First Index=1").SetText "Zack"

    Actually, I think you have this wrong. It is more likely that the line is:
    EditBox("Parent.Label='First' Index=1").SetText "Zack"

    Then you wanted to replace the label content with a variable: Global Const sFIRST = "First"

    So far, so good.

    Then you want to put the variable in where the label content is. That is where you went wrong.

    EditBox("Parent.Label=’sFirst’ Index=1").SetText "Zack"

    What this does is look for an edit box with the parent.label content of 'sFirst' (literal), not the content of a variable called sFirst.

    It should have been:

    EditBox("Parent.Label=" & sFirst & " Index=1").SetText "Zack"

    or, if the line is really as I think it is, then it will be (include the single quotes inside the double quotes):

    EditBox("Parent.Label='" & sFirst & "' Index=1").SetText "Zack"

    This is standard VBA use of variables. I would suggest a good VBA book.

  3. #3

    Re: Constants in TestPartner 6.0

    Thank you DSquared that solved the problem.

    EditBox("Parent.Label=" & sFirst & " Index=1").SetText "Zack"


    Any recommendations on an applicable book?



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 05:53 PM.

Copyright BetaSoft Inc.