Forum Discussion

gvedula's avatar
gvedula
New Contributor
13 years ago

Using Regular expression in web testing

Hi,



I am  currently testing a ecommerce website. I am recording a script and using datadriven loop to repeat the same tests with different users. I am recording a transfer action. However, when selecting transfers, since different users will not have the same account, I need to use regular expressions on soemthing else to say use any account that has "visa" in the description.  Otherwise, its always trying to find acct nbr 12345 but others users will not have this account but they will have a diff visa acct. Here's my namemapping editor.

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Is there a reason why, in your data driven loop, you can't include a user's account numbers in your data source?  That would be easier than messing around with regular expressions, IMO.  
  • aqAnt's avatar
    aqAnt
    SmartBear Alumni (Retired)

    Hello King,





    It looks like the mapped objects do not rely on the account number, so you do not need to modify them. In the Keyword Test editor, you can specify the "*Visa*" value (without quotes) for the ClickItem action. However, if you have several items with the "Visa" string, TestComplete will select the first item that matches the pattern. If it is suitable for you, you can just change the value. If not, you should parameterize your test as Robert suggested.