I need to develop test case for testing the rest services and the only resource provided to me by my client is WADL file and with the help of this I need to come up with the rest client test case. Have written using requests & pytest modules of python. however not sure if it covers all the scenarios for this WADl..help much appreciated to find out gaps in the test case if any
WADL:-
resources base="http://mygame.herokuapp.com/rest/">
<resource path="nextgame">
<method id="getNextGame" name="GET">
<response>
<representation mediaType="text/plain"/>
</response>
</method>
</resource>
<resource path="lastGame">
<method id="getLastGame" name="GET">
<response>
<representation mediaType="text/plain"/>
</response>
</method>
</resource>
<resource path="recentGame">
<method id="getRecentGame" name="GET">
<response>
<representation mediaType="text/plain"/>
</response>
</method>
</resource>
</resources>
</application>
My Python Test case:
import pytest
import requests
@pytest.mark.parametrize("input,expected", [
("http://mygame.herokuapp.com/rest/lastgame", 'XYZ'),
("http://mygame.herokuapp.com/rest/nextgame", 'ABC'),
("http://mygame.herokuapp.com/rest/recentmovie", 'DEF')
])
def test_eval(input, expected):
r = requests.get(input)
assert r.text == expected
assert r.status_code==200
assert r.headers['Content-Type']=='text/plain'