Text Data validation

ShivamRaj123ShivamRaj123 Posts: 12

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

Comments

  • benken_parasoftbenken_parasoft Posts: 736 ✭✭✭
    edited July 12

    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.

  • ShivamRaj123ShivamRaj123 Posts: 12

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

  • benken_parasoftbenken_parasoft Posts: 736 ✭✭✭
    edited July 12

    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.

  • ShivamRaj123ShivamRaj123 Posts: 12

    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_parasoftbenken_parasoft Posts: 736 ✭✭✭
    edited July 12

    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.

  • ShivamRaj123ShivamRaj123 Posts: 12

    Thank You So Much. Its working now:) .

Sign In or Register to comment.