Forum Discussion

SagarShroff's avatar
SagarShroff
Occasional Contributor
8 years ago

Using variables in LoadComplete Data Selectors

Hi,

 

I have a requirement where i need to extract the data from response using regular expression. Part of my query is dynamic and is test data specific ; so i was using LoadComplete variables in DataSelector, but on using variables it fails to extract.

 

Regards,

Shroff.

3 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I am not sure that I got the actual problem...

    Have you checked that your regular expression extracts correct data?

    Or the problem is that the regular expression works but the extracted value is not assigned to the variable at all?

    Or the variable contains some unexpected value?

    Any error in the log?

    Any chance to see the sample response, regular expression and how things are setup in your project (screenshot(s) for the setup part)?

    • SagarShroff's avatar
      SagarShroff
      Occasional Contributor

      Hi Alex,

       

      Excuse me for not being clear in post description.

      Regular expression works fine when specified in data selectors directly. But if a variable containing the expression is specified then the expression fails to extract the value from the response.

      I think LoadComplete treats @variable also as regular expression string and does not evaluate the variable.

       

      Regards,

      Shroff.

      • AlexeyKryuchkov's avatar
        AlexeyKryuchkov
        Staff

        Hi,

         

        Try defining an appropriate auto-correlation rule instead - in the "Find names and extra attributes" section, it is possible to define a regular expression for finding names or extra attributes. Then, it will be possible to reuse found values for building regular expressions for data selectors.