Forum Discussion

RyKling's avatar
RyKling
New Contributor
8 years ago

Property Checkpoint cmpContains Question

I have a notepad containing the following text:

"
press login/out button

Sending login message invalid admin 2.4.0.0

Request:<br>
* login:<br>
* (invalid, admin, 2.4.0.0)<br><br>

* Response:<br>
* login:<br>
* {transid=0, message=Unable to Login, sessionid=-1, success=false, servletver=5.0.0.0, interfacever=2.4.0.0}

ID for this session = -1

Unable to Login

applet Engine: return from servlet for login was unsuccessful with sessionid:-1

Return from login. msg: false

"

I am trying to utilize a property checkpoint to compare the "wText" property of Notepad which contains the output above. I am using the contains condition and am looking to make sure it contains the following:

"
"
press login/out button

Sending login message invalid admin 2.4.0.0

Request:<br>
* login:<br>
* (invalid, admin, 2.4.0.0)<br><br>

* Response:<br>
* login:<br>
* {transid=, message=Unable to Login, sessionid=, success=false, servletver=, interfacever=2.4.0.0}

ID for this session =

Unable to Login

applet Engine: return from servlet for login was unsuccessful with sessionid:

Return from login. msg: false

"

The property checkpoint is failing stating that wText does not contain the substring. Do you have any suggestions on how to get this working? Also, is there a way to utilize wild cards in the Value field when you specify comparison settings when creating a property checkpoint?  This would be so I dont have to worry about values which auto increment, etc.  

1 Reply

  • baxatob's avatar
    baxatob
    Community Hero

    Hi,

     

    As about me, I am using regular expressions to solve such kind of tasks.

    The general idea is to create a pattern, which will cover all possible valid data for you.

    Something like:

    pattern = "transid=([0-9]+), message=(Unable to Login|Able to login), sessionid=[-0-9]+, success=(true|false), servletver=(\d\.\d\.\d\.\d), interfacever=(\d\.\d\.\d\.\d)"

    Then you need to check whether your actual value matches the pattern.

     

    More about regex support in TestComplete: https://support.smartbear.com/viewarticle/75798/