Session 2: API Testing | RestAssured | Creating Post Request Payloads in Multiple Ways
Вставка
- Опубліковано 7 жов 2024
- #apitesting #restassured #sdet
Topics Covered:
How many ways we can create request body
1) using HashMap
2) using Org.json
3) using POJO (Plain Old Java Object)
4) using external json file
@0:46 Ways to create request body
@3:20 Start local API
@5:24 Create package and class in Eclipse
@6:09 Increase font size in Eclipse
@7:20 Import static packages
@8:23 Creating a test
DECLARE REQUEST BODY USING HASHMAP
@9:13 Declaring input data in Hashmap
@12:11 Declaring input data in Array
@13:02 Combining Hashmap and Array
@14:14 Declaring input type and referring input data in Given()
@14:48 Create POST request with url in When()
@15:21 Validate status code and JSON response in Then()
@17:37 Validate array in JSON response in Then() (correction @21:10)
@19:18 Validate header in JSON response in Then()
@20:29 Print JSON response in console
@22:43 Create a method
@23:34 Create DELETE request for specific ID (here student)
@24:49 Validate status code in Then()
@25:40 Execute the test case according to priority
DECLARE REQUEST BODY USING ORG.JSON
@27:38 Add org.json dependency in pom.xml
@28:35 Declaring input data in JSONObject class
@36:50 Converting input data in JSONObject into String format in Given()
@37:47 Execute the test case according to priority
DECLARE REQUEST BODY USING POJO (PLAIN OLD JAVA OBJECT)
@40:00 Create a another class for getter and setter methods
@42:48 In actual class, call setter methods from another class to declare input data
@44:40 Using setter methods from another class, declaring input data in Array
@46:23 Referring input data in Given()
@47:05 Execute the test case according to priority
DECLARE REQUEST BODY USING EXTERNAL JSON FILE
@48:21 Create a JSON file under project to store input data
@50:18 Referring the JSON file into actual class as input data and declare it as JSONObject
@56:00 Converting input data in JSONObject into String format in Given()
@56:57 Execute the test case according to priority
@57:29 Final note
########################
Udemy Courses:
########################
Manual Testing+Agile with Jira Tool
***
► lnkd.in/gNqhEq9K
Selenium with Java+Cucumber
***
► lnkd.in/g5YcAQyR
Selenium with Python & PyTest
***
► lnkd.in/gvrpyYan
Selenium with python using Robot framework
***
► lnkd.in/gxsDf8zR
API Testing(Postman, RestAssured & SoapUI)
***
► lnkd.in/gHKQ2v2e
Web & API Automation using Cypress with Javascript
***
► lnkd.in/gcZz5Psx
Playwright with Javascript
***
► lnkd.in/g-ePPav6
Jmeter-Performance Testing
***
► lnkd.in/gA3eiZPY
SDET Essencials(Full Stack QA)
***
► lnkd.in/gmBc4-wD
Appium-Mobile Automation Testing
***
► lnkd.in/gi_UiRTA
Java Collections
***
► lnkd.in/gZftiiEn
Python Programming
***
► lnkd.in/ghP6WHQz
Cucumber BDD Framework
***
► bit.ly/3F7d69r
Protractor with Javascript
***
► lnkd.in/gZnJ2qsS
#############
UA-cam Playlists:
#############
Manual Testing & Agile
***
► bit.ly/3ujvaYa
► bit.ly/3OYzxQj
SQL
***
► bit.ly/3R6XjeG
► bit.ly/3nE0a1s
► bit.ly/3IeKuuJ
linux & Shell Scripting
***
► bit.ly/3up1Z6a
► bit.ly/3nzvGxx
Java
***
► bit.ly/3R9QfOs
► bit.ly/3AoRMKM
► bit.ly/3IbTTDn
► bit.ly/3ybXInv
► bit.ly/3yCoHdw
Selenium With Java+Cucumber
***
► bit.ly/3P2FMm4
► bit.ly/3yhiIt4
► bit.ly/3uokzet
► bit.ly/3a7XIND
► bit.ly/3umN2S9
► bit.ly/3aar7GW
► bit.ly/3y9kD2S
► bit.ly/3uhLskn
Python
***
► bit.ly/3agNgU0
► bit.ly/3NJNnoy
► bit.ly/2CTQ4mR
► bit.ly/3OIYWh1
Selenium With Python,Pytest&Behave
***
► bit.ly/3OHHoC9
► bit.ly/3IeNLdv
► bit.ly/2J4tPeT
► bit.ly/3ydSkAq
Selenium With Python Using Robert Framework
(Web&API Testing)
***
► bit.ly/3nUvlpr
► bit.ly/3nUvE3z
API Testing (Postman,SoapUi,&Rest Assured)
***
► bit.ly/3OXacWY
► bit.ly/3yh0UhE
► bit.ly/3nC9DWQ
► bit.ly/3yGfhNS
► bit.ly/3OJa11H
► bit.ly/3P2slCC
Mobile App Testing Appium
***
► bit.ly/3Al49HG
Performance Testing Jmeter
***
► bit.ly/3nz4fE7
Maven,Jenkins,Git,Github,CI/CD
***
► bit.ly/3P16HPj
► bit.ly/3yhlUVA
► bit.ly/3afYfwT
► bit.ly/3yGzweG
► bit.ly/3yF73Ws
► bit.ly/3NCOmH7
SQL,DB Testing&ETL,Bigdata
***
► bit.ly/3NKOcNY
► bit.ly/3OVpDyI
► bit.ly/3NEvUy0
► bit.ly/3IryxlT
► bit.ly/3RkWBLh
JavaScript Based Automation Tools
***
► bit.ly/3nUx51X
► bit.ly/3AqI6Q0
► bit.ly/3yeurbT
► bit.ly/3ujzpTK
Selector Hub Tools
***
► lnkd.in/gfqbR5TC
GraphQL
***
►
Cypress API Testing
***
►
Cypress Web Testing
***
► lnkd.in/gW8SgMna
Playwright with Javascipt
***
► lnkd.in/gQZwaaVD
sir, you are best teacher.Thanks a lot for giving so much knowledge on you tube for free.This is worth gold.
My pleasure
I cannt explain how much thankful I am. This course is curated so nicely. I am going one by one from your playlist along with parallel practice. Thank you sir
You're very welcome!
Good day! I' ve just joined to this course and I don't understand from where were downloaded Json files that showed in this course. Can anybody help me please?
what postman tutorial
@@kubanychtashbaev4898
By far the best explanation on handling JSON payloads for POST requests. Thanks a lot for the effort.
Welcome
Excellent teaching. Very useful videos for the entire testers community.
My pleasure
@@sdetpavan Brother pavan, It will be better to post the videos abt webdriverio with appium.
sir thanks for describing and sharing your valuable knowledge through this step-by-step process-oriented videos. Really appreciate your effort
You are most welcome
Sir, wish you all the best! Please keep up!!! We are benefiting from your beautiful tutorials immensely.
Thanks
I am from Vietnam, and thank you so much from bottom of my heart, sir!
Welcome
Thank you so much for your service to the nation building..
Greater clarity of thoughts, well explained Pavan. Easy to understand, replicate and practice. Thankyou
Welcome
Best in the industry, thank you for all of your videos
Welcome
Most clear explanation. Hat off for effort to create this.
Thanks
I just discovered this channel and I loved it, I will do all the courses
Thank you so much! I was struggling to get the correct method to create body for POST
You're so welcome!
Thank you :) Appreciate all the efforts you are putting in. I am a great admirer of you. :)
Welcome
Thx for session 2. It was very helpful :)
Glad it was helpful!
Thanks for all video you made 🙏
Welcome
Thanks alot sir, indetailed explanation and easy to understand
You are most welcome
You are best Sir Thank you
Welcome
body.json could be rightly kept under resources folder which was told to delete in Session 1.
Excellent teaching. Very useful videos for the entire testers community. and i want documents for Practice pls send upload that documents also
hello i think we need to creat by self if you need help I can help you
becoz I am also trying to make
Nice and clean videos 😇 after seeing this video i got that i missed npm commands for starting this json-server xyx.json
😊Thanks a lot for Taking the Session Pavan Sir, Thank you so much.😍Waiting for the Next session✌✌
Welcome
Thank you Pavan Sir.
Welcome
Thank you so much sir🙏💐💐
Welcome
Great video, but which video do you talk about running the JSON-server?
Simply superb
Thanks
you are the great sir
Thanks
Thanks Pavan sir taking session but not a single vedio on UA-cam how to username and password store in AWS and then use rest token generate , please make a vedio. It very helpful to understand real time api automation framework..
My json file does not create the id in order. It creates the id with letters and number . why?
Thank you
Welcome
Awesome videos ... sir do you have git repo of this code ? available in public and can it be shared plz
Nice Explanation.. sir...
Welcome
@@sdetpavan Thanks a lot for your response sir.
Thanku so much
Welcome
My name is GM Rafed.I have learnt so many topics by watching your you tube video.I am a US citizen.If it possible Can you find for me QA job.Thanks
thankyou Sir
Welcome
@0:46 Ways to create request body
@3:20 Start local API
@5:24 Create package and class in Eclipse
@6:09 Increase font size in Eclipse
@7:20 Import static packages
@8:23 Creating a test
DECLARE REQUEST BODY USING HASHMAP
@9:13 Declaring input data in Hashmap
@12:11 Declaring input data in Array
@13:02 Combining Hashmap and Array
@14:14 Declaring input type and referring input data in Given()
@14:48 Create POST request with url in When()
@15:21 Validate status code and JSON response in Then()
@17:37 Validate array in JSON response in Then() (correction @21:10)
@19:18 Validate header in JSON response in Then()
@20:29 Print JSON response in console
@22:43 Create a method
@23:34 Create DELETE request for specific ID (here student)
@24:49 Validate status code in Then()
@25:40 Execute the test case according to priority
DECLARE REQUEST BODY USING ORG.JSON
@27:38 Add org.json dependency in pom.xml
@28:35 Declaring input data in JSONObject class
@36:50 Converting input data in JSONObject into String format in Given()
@37:47 Execute the test case according to priority
DECLARE REQUEST BODY USING POJO (PLAIN OLD JAVA OBJECT)
@40:00 Create a another class for getter and setter methods
@42:48 In actual class, call setter methods from another class to declare input data
@44:40 Using setter methods from another class, declaring input data in Array
@46:23 Referring input data in Given()
@47:05 Execute the test case according to priority
DECLARE REQUEST BODY USING EXTERNAL JSON FILE
@48:21 Create a JSON file under project to store input data
@50:18 Referring the JSON file into actual class as input data and declare it as JSONObject
@56:00 Converting input data in JSONObject into String format in Given()
@56:57 Execute the test case according to priority
@57:29 Final note
thanks sir
Most welcome
Sir please suggest which laptop is best for testing student
Processor?
ROM?
Brand and model
Hi Bro, you can go with any market leading brand, like Acer, HP - Victus, ...etc. Just concentrate on the processor -> i5 or i7 (latest), RAM -> 8+ GB, SSD 1TB, etc.
Anybody who needs step by step help in installing JSON server and running students.json file - sir has explained in this video - ua-cam.com/video/tnpqR7Ar-BQ/v-deo.html
Is it mandatory to use json server or can we use endpoint from website?
Sir , you have provide multiple playlist for rest assured , which one is to referred first...please reply sir.
Very informative. Got question in 1 interview as below.
if you are testing one service in API testing, every 3 minutes your session is deactivated. before testing, u need to verify whether the session is active or not. how you will achieve.
Bro . Answer Please for above question . it wil be useful for me and others
@@sureshisoft4555😂😂
Hii sir, Actually I have a doubt, what if the json body is large like 40,50 lines how can we put request, likewise you shown in the video as we add data like 40,50 lines for this or is there any simple method for to add larger data json..?
did you get reply?
4th approach u can use if json has more lines
Use the last approach in this video..
Testing using external json file
Hello Sir, Please make videos on AWS Kafka and AWS Glue data load aitomation testing.
how do we know that the "Id" will be populated/generated as "4" and same we are deleting ?
when i try in my machine it generates any random id for newly created record hence failing method-2 i.e. testDelete()
Please clarify.
I got the same error and unable to find any solution for the same @sdetpavan
Hello! Could you please tell, what approach is more usefull if you got a reaaly huge json object?
out of this ,which is the way mostly use in industry?
Hello Sir, Can you please provide the collection of this Student API.
Sir how to create our own dummy api??? For practicing
where can i get these json files that u are using sir
Hi, where I can find how you've created 'Student Json' file. Can ypu pls share the link of the video?
Hello Sir, Can you provide local Students.json file for study purpose?
Can we use direct endpoint from website instead of local api?
From where we can get the json files which you are using like student.json?
Is their any prerequisite for learning this course?
When I am running the command line json-server Filename.json it is giving me error saying "'json-server' is not recognized as an external or internal command what to do.?
when I tried to install json server then also getting error " 'npm' is not recognized as an internal or external command, operable program or batch file."
I have installed nodejs as well but still the problem resists. Tried many solutions from stackoverflow community but all in vain.
I am very late here, but how are you using that local address json file in the post request? Can anyone pls help?
Sir pls reply me. I hv a career gap of yr. Im completed my B. E in ECE. After that i worked as a guest lecturer in polytechnic because of my family prblm i couldn't go out of home. Now i want to start my career in IT. What to do sir. Pls reply for me. Thank u sir
sir why we written status code response 200 for delete request instead of 204
While passing body from external json file , even if we are passing the File object (f) , in the .body() , there's no such error shown . Can you pls explain this ?
do we need to provide private for the variables while following pojo class method?
@sdetpavan Sir, Getting AssertionError: expected undefined to deeply equal "Success: API session successfully started!"
Please provide your guidance on it. Since, bcoz of this I can't generate Token.
I am referring to lecture 10 of this series.
Is their some issue in the API?
Hello Sir , I am getting this error.
The method then() is undefined for the type HTTPRequest
Hello Sir, Where we can get this code, can you please share the link. Thank you.
Welcome
Hi Sir, I have a doubt. When I executed the code the courses got displayed first in JSON and the name and gender. Why so can you please explain ?
Sir I am using Mac so I am not able to get home and resources in terminal for students file while creating own api ..can u plz help with this bcz I been trying since 2 days ..still not getting any solution from google as well ..!
Sir first of thank you for the content. I have a question when I m creating the body.json file the image of the file is not changing like in your records. I installed Json Editor Plugin but still does not workes
hi
i am getting the error in "then " when i am doing the validation using equalTo function.
can any one please help me?
Pls help me someone... I'm using eclipse latest version and java 17 ... I'm not able to get the response....their is no mistake in code I'm following as it is pavan sir... So kindly suggest me the supported software versions
👍
What is use of jsontokener?
Good day! I' ve just joined to this course and I don't understand from where were downloaded Json files that showed in this course. Can anybody help me please?
From Maven repository.
How can we get the data in our file explorer
For delete status code is 204 then why u wrote 200 in delete method
Throwing an error : SLF4J: No SLF4J providers were found.
java.lang.Error: Unresolved compilation problem:
The constructor JSONTokener(FileReader) is undefine
can any one pls help me
"key_results": [
{
"title":"test cases",
"measuring_unit": {
"type": "BINARY"
}
}
]
how to post this type of array body in rest assured,please reply
Why don't write data.coursearr and why did you write string.coursearr sir
25:42 Can someone help me to run this ? If i do Right click then Run, i am not getting Run with TestNG.
please help me !!!!
How to convert String to int in rest assured
Where is student.json file ? plz attach it
id is not increasing like 1 2 3
4 its taking random number
facing the same issue here.
This is JAVA?
Yes, Java and RestAssured
@@kishorem8488 thank you! I just started studying Python and unfortunately I don't understand anything from Java
@@gsx RestAssured works with Java not python.
How can i get that sample students.json file
Need to create your own API
Watch API testing with postman sessions
Hi i am getting below error..its is not creating records in students.json file. Can you plz tell me what's wrong?
FAILED: day2.DiffwaystocreatePostRequestbody.testPostusingHashMap
java.lang.AssertionError: 1 expectation failed.
JSON path name doesn't match.
Expected: Scott
Actual: null
Did you solved this error?
Pass data.tostring()
@@mayankmadhur4630 Thank you so much bro! Was struggling with this error for 2 hours
@@SugavaneshChandrasekar no worries
sir, can you add otomatic subtitle? because my primary language is indonesian. thanks u
Sir please provide document and pom.xml file where i take pom.xml file please help
I think you should teach first how to create own api.... I don't know how to create own api
Api will create developers testers who will test that api how it is working
please provide student.json file