Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Text Data validation

ShivamRaj123
ShivamRaj123 Posts: 13

While Running a request i am getting response in text format for eg. INC000003425644. How to verify it using soatest tool.

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,297 ✭✭✭
    edited July 2019

    I'd probably just use the Diff tool. It has a "text" mode for diffing text.
    You can add and configure one quickly to a test by right-click, click "Create/Update Regression Control", click "Create Regression Control", then click Finish.

  • ShivamRaj123
    ShivamRaj123 Posts: 13

    Thanks. But that value keeps on changing everytime i run the request.

  • benken_parasoft
    benken_parasoft Posts: 1,297 ✭✭✭
    edited July 2019

    Thanks. But that value keeps on changing everytime i run the request.

    What validation do you want to perform on this value? In other words, even though it changes every time, what test do you need to perform on it to know whether it is an expected value or not? If you can answer this question then I can help tell you how to configure SOAtest to do what you want.

  • ShivamRaj123
    ShivamRaj123 Posts: 13

    I understand but if this value keeps on changing then by using diff control it will fail ryt?. Can we use regular expression here ? If yes then please tell me in this case what will be regular expression for some value like INC000003425644 where INC is constant but numeric is increasing every time we run.

  • benken_parasoft
    benken_parasoft Posts: 1,297 ✭✭✭
    edited July 2019

    Can we use regular expression here ?

    Yes. The Diff tool's text mode has a regular expression option. When you use this, you can type a regular expression in the control source. For details see Text Diff Mode.

    If yes then please tell me in this case what will be regular expression for some value like INC000003425644 where INC is constant but numeric is increasing every time we run.

    You could use a regex like INC[0-9]+ or INC[0-9]{12} to check if the value at least follows a certain pattern.

    If you want to check that the number is increasing every time you would need to perform an additional assertion on top of regex. High level, it sounds like you need to extract the numerical part and check if it was greater than some previously saved value. To extract the numerical portion you can use the Text Data Bank tool. After that, you might consider using an Extension Tool to script comparing the value.

  • ShivamRaj123
    ShivamRaj123 Posts: 13

    Thank You So Much. Its working now:) .