Given-When-Then scenarios for Webservice calls

孤人 提交于 2019-12-10 11:42:34

问题


We are using Specflow for automating our regression suite but now we would like to take it to a next level of automating our webservices.

Using the Gherkin “Gven-When-Then”, how can I use / write the webservices calls.

For e.g : How do I write my given - when - then for the below request?

<ns:request>
    <ns1:ServiceAuthenticationRequest>
        <ns1:Password>?</ns1:Password>
        <ns1:Station>?</ns1:Station>
        <ns1:UserName>?</ns1:UserName>
    </ns1:ServiceAuthenticationRequest>
    …
</ns:request>

回答1:


Unless you're writing webservice code itself, the behaviour of a generic webservice probably isn't that interesting.

What does your webservice do?

1) Can you give me an example?

2) Is there any situation in which your webservice would behave differently to that?

If you can answer those questions, you'll probably have a better idea of what to use as your first, and then second, scenario. The situations in which the webservice behaves differently are the contexts (givens); what you get as a result of those contexts will be the outcomes (thens). Calling the webservice will be your event. If your webservice has different capabilities, you'll probably have different events for each one.

As with anything related to BDD, have a conversation with someone and see if you can give them some examples of what you're thinking / ask them for some examples if they're more knowledgeable than you are.



来源:https://stackoverflow.com/questions/34444007/given-when-then-scenarios-for-webservice-calls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!