Skip to content

Templates and Apis added to fetch posts and albums for UserId 1#9

Open
NamanKhurana wants to merge 8 commits intoznsio:mainfrom
NamanKhurana:main
Open

Templates and Apis added to fetch posts and albums for UserId 1#9
NamanKhurana wants to merge 8 commits intoznsio:mainfrom
NamanKhurana:main

Conversation

@NamanKhurana
Copy link

Assignment Completed - Naman Khurana

@@ -0,0 +1,14 @@
@eat @assignment
Feature: API tests for https://jsonplaceholder.typicode.com/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Validation.

@@ -0,0 +1,36 @@
@template
Feature: API tests for https://jsonplaceholder.typicode.com/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect Feature description

Given def path = "/posts"
* def queryParam = {userId : '1'}
And print "Get list of Posts from " + env.fetchPostsAndAlbumsUrl + path
And path path

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments as above

@@ -0,0 +1,14 @@
@eat @assignment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@assignment is not a proper tag for this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants