I also encountered such situations.

One thing we could do is do compare both the direct response and response
through connector with a known value. Example scenario is as follows.
-------------------------------------------------

knownValue = "<commentId>";

directApiResponse = callApiDirectly();
connectorResponse = callApiThroughConnector();

boolean condition = directApiResponse.contains(knownValue) &&
connectorResponse.contains(knownValue);


Assert.assertTrue(condition);

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

So in a situation when we get two values like

<comment>
<commentId>xxxxxxxxxxxx</commentId>
<commentText>hello</commentText>
</comment>

<comment>
<commentId>yyyyyyyyyyyyy</commentId>
<commentText>hello</commentText>
</comment>

we could still be sure that both gave the correct responses because the
"knownValue" will only contain in a successful response.

if we could log the 2 responses, in an event of test failure, we could
determine whether the test failure is actually due to the connector failure
or the 3rd party back end API failure.

Thanks.




On Fri, Apr 11, 2014 at 5:11 PM, Madhawa Bandara <madh...@wso2.com> wrote:

> Hi,
> I am implementing the integration test cases for a Google Tasks ESB
> connector.
>
> We were asked to implement the integration tests in a way that, the
> response of the test case though the ESB connector is asserted against the
> response through a *direct API call*.
> This is opposed to the existing method: asserting against a *known *value.
>
> Consider an API call that *creates* or *deletes a *resource.
> So how can we assert the connector response against the direct API call
> response in such a case, since the response values of the two requests
> would be different?
>
> --
> Regards,
>
> *Madhawa Bandara*
> Software Engineer
> WSO2, Inc.
> lean.enterprise.middleware
>
> Mobile - *+94777487726 <%2B94777487726>*
> Blog* - *classdeffound.blogspot.com
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Nalin Chamara
Software Engineer
071-56-147-56
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to