Templates and Apis added to fetch posts and albums for UserId 1#9
Templates and Apis added to fetch posts and albums for UserId 1#9NamanKhurana wants to merge 8 commits intoznsio:mainfrom
Conversation
| @@ -0,0 +1,14 @@ | |||
| @eat @assignment | |||
| Feature: API tests for https://jsonplaceholder.typicode.com/ | |||
There was a problem hiding this comment.
Avoid using URL in Feature description . and rewrite the description to something more meaningful.
|
|
||
| Scenario: Get list of Posts | ||
| Given def listOfPosts = karate.call('classpath:com/znsio/templates/jsonPlaceholderTemplates.feature@t_getPosts').response | ||
| Then print "listOfPosts: " + listOfPosts.length |
There was a problem hiding this comment.
Missing Validation. Please apply suitable API validation.
| Scenario: Get list of Posts | ||
| Given def listOfPosts = karate.call('classpath:com/znsio/templates/jsonPlaceholderTemplates.feature@t_getPosts').response | ||
| Then print "listOfPosts: " + listOfPosts.length | ||
| And print "This is my list of posts-------------> " + listOfPosts |
There was a problem hiding this comment.
Rather than using print , use karate.log() .
|
|
||
| Scenario: Get list of Albums | ||
| Given def listOfAlbums = karate.call('classpath:com/znsio/templates/jsonPlaceholderTemplates.feature@t_getAlbums').response | ||
| Then print "listOfAlbums: " + listOfAlbums.length |
| @@ -0,0 +1,36 @@ | |||
| @template | |||
| Feature: API tests for https://jsonplaceholder.typicode.com/ | |||
| Given def path = "/posts" | ||
| * def queryParam = {userId : '1'} | ||
| And print "Get list of Posts from " + env.fetchPostsAndAlbumsUrl + path | ||
| And path path |
There was a problem hiding this comment.
Why multiple line of code for declaring path ? #line10 and line13
| @t_getPosts | ||
| Scenario: Get list of posts for userId 1 | ||
| Given def path = "/posts" | ||
| * def queryParam = {userId : '1'} |
There was a problem hiding this comment.
Why we are declaring userId here in template? What if any other scenario wants to run same template with different userId?
| And def posts = response | ||
| * print "Response from /posts: ", response | ||
|
|
||
| # Examples: |
There was a problem hiding this comment.
remove unused and commented line of code.
| Then status 200 | ||
| And print response.length | ||
| And def posts = response | ||
| * print "Response from /albums: ", response No newline at end of file |
| @@ -0,0 +1,14 @@ | |||
| @eat @assignment | |||
There was a problem hiding this comment.
@assignment is not a proper tag for this feature.
Assignment Completed - Naman Khurana