Re: [rest-assured] Continue test method after expect is not satisfied

45 views
Skip to first unread message

Johan Haleby

unread,
Nov 15, 2012, 11:51:21 AM11/15/12
to rest-a...@googlegroups.com
Hi, 

Currently this is not supported, but it would be really cool if it would (and it would not be impossible to implement). If you're up for it please help out.

Regards,
/Johan

On Thu, Nov 15, 2012 at 5:17 PM, Kevin Swanson <kswa...@gmail.com> wrote:
How can I execute the entire test case even if the first portion fails?

Example, lets ay the first statement fails and I still want to execute the second statement. How can I do this?

    @Test
    public void testCreatePropertyQuote() throws IOException {
   
       
        given().body(b).   
        expect().
        statusCode(200).
        body(
                "ACORD.SignonRq.SignonPswd.SignonRoleCd", equalTo("Agent")).
                when().
                post("propertyquote/create");
       
        given().body(b).   
        expect().
        statusCode(200).
        body(
                "ACORD.SignonRq.SignonPswd.SignonRoleCd", equalTo("Agent")).
                when().
                post("propertyquote/query");
    }   

Johan Haleby

unread,
Nov 18, 2012, 5:39:19 AM11/18/12
to rest-a...@googlegroups.com
I think I misunderstood your original post. I thought you meant that is e.g. the status code didn't match 200 AND your body expectation fails at the same time you wanted to log BOTH errors. This has now been implemented in master and you're free to try it out (even if this wasn't the question you had :)). Depend on 1.7.2-SNAPSHOT after having added the following maven repo:

<repositories>
        <repository>
            <id>sonatype</id>
            <snapshots />
        </repository>
</repositories>

So back to your question, what is it really that you want to get out of what you're proposing? What I believe you ought to do is to split up the two POSTs in two different tests.

/Johan
Reply all
Reply to author
Forward
0 new messages