Service Virtualization

Expand all | Collapse all

Ensure result contains expression and ensure property contain expression assertion

Jump to Best Answer
  • 1.  Ensure result contains expression and ensure property contain expression assertion

    Posted 05-23-2018 03:18 AM

    Hi, 

     

    Can any one let me know how to use ensure result contain expression \assertion 

     

     

    In my response I am having string as "Took 140 seconds to run"  number will change for each run so I have marked \d+ 

    is it correct ?

     

    Or expression I have to right something like ^Took \d+ seconds to run$, but this one is failing even my response have that string.

    Both the expression are working in helper 

     

    1)   

    2) 

     

    My only concern is which is correct 1 or 2 screen shot, When I tried to applied  the 1st one in assertion itss getting failed but second one is working for me but not sure whether is correct  or not.   

    anyone can explain me this with example, that will help a lot. 



  • 2.  Re: Ensure result contains expression and ensure property contain expression assertion

    Posted 05-23-2018 09:21 AM

    Could you please upload a sample response   that I can try. ?

     

    Thanks

     

    Shiney



  • 3.  Re: Ensure result contains expression and ensure property contain expression assertion

    Posted 05-23-2018 07:45 PM

    Hey Mate, 

     

    I am using the step execute external command to run my application using.sh script and response is a log file which looks like as below   

    RUN_Application_COMMAND:
    [sshsession] Connecting to host_name 

    ------------------------------------

    -------------------------------

    --------------------------------

    [sshexec]
    [sshexec]
    [sshexec] Took 24 seconds to run

    BUILD SUCCESSFUL
    Total time: 35 seconds

     

    Its a big response having around 2500 lines.   i am applying assertion for highlighted text.  



  • 4.  Re: Ensure result contains expression and ensure property contain expression assertion

    Posted 05-24-2018 07:06 PM

    can anyone help me pls?



  • 5.  Re: Ensure result contains expression and ensure property contain expression assertion

    Posted 05-25-2018 09:44 AM

    Hi Vinay,

     

    I validated both at Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript and both worked.

     

    I am not sure what the implementation in DevTest. If the second one is working in DevTest. I would recommend using that.

     

    -Prema



  • 6.  Re: Ensure result contains expression and ensure property contain expression assertion
    Best Answer

    Posted 05-28-2018 09:11 PM

    I just wanted to know, How we need to write the expression in Dev Test ?

     

    I mean to say expression need to be written under {{}}} or () or simply right the statement as I mentioned in earlier example

     

    Regards, 

    Vinay Nagariya  



  • 7.  Re: Ensure result contains expression and ensure property contain expression assertion

    Posted 06-04-2018 09:16 PM

    its worked for me now . 

     

    thanks for the help