REST Assured Beginner Tutorial 6 | GET & POST

Поділитися
Вставка
  • Опубліковано 14 гру 2024

КОМЕНТАРІ • 88

  • @akashmurumkar
    @akashmurumkar 3 роки тому +7

    Your a gem to the Automation Community & Bread n butter for many :)

    • @RaghavPal
      @RaghavPal  3 роки тому +2

      So happy and humbled to see this Akash

  • @SumanKumar-mn5sg
    @SumanKumar-mn5sg 10 місяців тому +1

    Awesome Raghav.. You are blessed to teach this effectively. I can only say Thank You.. I regularly follow your videos to learn more about

    • @RaghavPal
      @RaghavPal  10 місяців тому

      So nice of you Suman.. humbled

  • @TravelNow-vl1fh
    @TravelNow-vl1fh 8 місяців тому +1

    Hello bro I learnt this in 30 mins you are an absolute legend,🎉

    • @RaghavPal
      @RaghavPal  8 місяців тому +1

      Glad it helped.. humbled

  • @hassellvinny
    @hassellvinny Рік тому +1

    Thanks Raghav, another great video!

  • @saranyajothi9691
    @saranyajothi9691 2 роки тому +2

    Kindly update videos on hamrest matcher methods and rest assured class methods and so on which we use on rest api pls update in depth

    • @RaghavPal
      @RaghavPal  2 роки тому

      I will check and update Saranya

  • @rajkamalm420
    @rajkamalm420 5 місяців тому

    Superb videos , thankyou sir

    • @RaghavPal
      @RaghavPal  5 місяців тому

      Most welcome Raj

  • @rashmichavan8317
    @rashmichavan8317 Рік тому

    Amazing 👍🏼👍🏼👍🏼

  • @rahuldeshpande7725
    @rahuldeshpande7725 2 роки тому

    Great teaching sir

    • @RaghavPal
      @RaghavPal  2 роки тому

      Thanks and welcome Rahul

  • @Nykster
    @Nykster 2 роки тому

    You are brilliant!

    • @RaghavPal
      @RaghavPal  2 роки тому

      Thanks for watching Anyik

  • @poojadhamale3874
    @poojadhamale3874 2 роки тому +1

    The type org.hamcrest.Matchers can't be resolved. It is indirectly referenced from required .class file , why I got this error message?

    • @RaghavPal
      @RaghavPal  2 роки тому +1

      Hi Pooja, this can help - stackoverflow.com/questions/46347494/error-as-the-type-org-hamcrest-matcher-cannot-be-resolved
      Do let me know if this resolved your issue

  • @altwathaidar3447
    @altwathaidar3447 3 роки тому

    Thank you man for this video!

  • @abhijithkumar4896
    @abhijithkumar4896 4 роки тому

    there is some caution in line number 42 and 43 as below where json contents are added into "request" object. Please can you give solution for this.
    "Type safety: The method put(Object, Object) belongs to the raw type HashMap. References to generic type HashMap should be parameterized"

    • @RaghavPal
      @RaghavPal  4 роки тому +1

      Hi, this may be due to the json library we are using. In case its only warning, can proceed.
      stackoverflow.com/questions/35453110/json-simple-causes-compiler-warning-type-safety-the-method-putobject-object

    • @AyyAppA_009
      @AyyAppA_009 3 роки тому

      @@RaghavPal Hi Sir, according to stackoverflow comments we need to use GSON or JACKSON lib instead of JSONSimple...?

  • @prashantj7839
    @prashantj7839 3 роки тому

    Very well explained

    • @RaghavPal
      @RaghavPal  3 роки тому

      Glad it was helpful Prashant

  • @AnhNguyen-zp4iw
    @AnhNguyen-zp4iw 2 роки тому

    Greate website, I highly recommend it

  • @poojadhamale3874
    @poojadhamale3874 2 роки тому +1

    When I used equalTo method I got error this method is undefined for type string

    • @RaghavPal
      @RaghavPal  2 роки тому

      Hi Pooja,
      Can you add this import and see if it works
      import static org.hamcrest.Matchers.equalTo;
      stackoverflow.com/questions/49120056/restassured-cant-find-the-equalto-method

    • @poojadhamale3874
      @poojadhamale3874 2 роки тому

      @@RaghavPal after import org.hamcrest.Matchers.equalTo I will get same error message

    • @RaghavPal
      @RaghavPal  2 роки тому

      will need to check more online

  • @prabaldutta
    @prabaldutta 3 роки тому +1

    Hi Raghav, my requirement is to compare the responses of two end points in JSON using POST request. I have an old end point and a newer version. The result should be the same except few known values like Reference# which will be unique for each POST request. How to approach it? Also, I need test the same using 500 test data to run through both old and new end points and verify the results are same. Please help if there is a smart way of doing the comparison.

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Prabal, I will check and try to do a session, Meanwhile, pls check there should be some examples online

  • @kushalb.n.4452
    @kushalb.n.4452 3 роки тому

    how to pass array of objects in body ex - [{"id":123,"first_name":"george"},{"id":234,"first_name":"arun"}], can we use jsonobject in this case, any other ways of passing this, also what if body is object of arrays

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Kushal, yes you can do this way or can store in a variable, Can also get this from a file

  • @amadhavi5190
    @amadhavi5190 3 роки тому

    Hi raghav, can you make videos for mobile testing using espresso and xctest

  • @honeythakur1526
    @honeythakur1526 2 роки тому

    Hi Ragav,
    How to initialize multiple RestAssured url in the same project without overriding each other?
    I have multiple modules within same project which needs to communicate with entirely 2 different REST API systems. I want to use Rest Assured for both. could you please let me know the process to define multiple base URI and use it.

    • @RaghavPal
      @RaghavPal  2 роки тому

      Hi Honey, this can help stackoverflow.com/questions/30426397/how-to-initialize-multiple-restassured-url-in-the-same-project-without-overridin

  • @ievgeniikravtsov1597
    @ievgeniikravtsov1597 3 роки тому

    Thanks a lot!

  • @tester4044
    @tester4044 3 роки тому

    Very Good Lesson!

  • @MrManandevil
    @MrManandevil Рік тому

    While creating object for JSONOject and printing it out we can see that the sequence is not followed. How to create a json in which sequence is the way that we have specified?

    • @RaghavPal
      @RaghavPal  Рік тому

      Hi Manan
      In Rest Assured, the JSON objects are represented using the JsonObject class provided by the JSON library used (such as JSON Simple, Jackson, or Gson). The JSON objects created using these libraries typically do not preserve the order of elements because JSON itself does not guarantee the order.
      If you require a specific order of elements in your JSON, you can use a LinkedHashMap or LinkedHashSet to create your JSON object. These data structures maintain the insertion order of elements.
      Here's an example using JSON Simple library:
      import org.json.simple.JSONObject;
      public class JsonExample {
      public static void main(String[] args) {
      JSONObject json = new JSONObject();
      // Use LinkedHashMap to maintain the order of elements
      LinkedHashMap map = new LinkedHashMap();
      map.put("name", "John");
      map.put("age", "30");
      map.put("city", "New York");
      // Add the elements from the LinkedHashMap to the JSON object
      json.putAll(map);
      // Print the JSON object
      System.out.println(json.toJSONString());
      }
      }
      The output will be:
      {"name":"John","age":"30","city":"New York"}
      By using a LinkedHashMap, you can ensure that the elements are added to the JSON object in the order you specify.

    • @MrManandevil
      @MrManandevil Рік тому

      @@RaghavPal Thank you so much

  • @soumendukhilar2043
    @soumendukhilar2043 3 роки тому

    Hi Raghav, How do I verify that the details are added using the POST method. I tried with the Single User GET request mentioned in the website but it gives a blank body as response. Please help.

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Soumendu, are you using the same apis as shown, there can be something missing or incorrect in the request format, check the logs

  • @krunalidedhia7117
    @krunalidedhia7117 Рік тому

    how do script when i want to take response from post api and send it to put api

    • @RaghavPal
      @RaghavPal  Рік тому +1

      Hi Krunali
      Here is an example of how to take the response from a POST API and send it to a PUT API using Rest Assured:
      ```java
      import org.hamcrest.Matchers;
      import org.junit.jupiter.api.Test;
      import io.restassured.RestAssured;
      import io.restassured.response.Response;
      public class RestAssuredExample {
      @Test
      public void testPostAndPut() {
      // Create a POST request to the /products API.
      Response postResponse = RestAssured.given()
      .contentType("application/json")
      .body("{ \"name\": \"Product 1\" }")
      .post("/products");
      // Assert that the POST request was successful.
      postResponse.then().statusCode(201);
      // Get the product ID from the POST response.
      String productId = postResponse.jsonPath().get("id");
      // Create a PUT request to the /products/productId API.
      Response putResponse = RestAssured.given()
      .contentType("application/json")
      .body("{ \"name\": \"Product 2\" }")
      .put("/products/" + productId);
      // Assert that the PUT request was successful.
      putResponse.then().statusCode(200);
      // Assert that the product name was updated.
      putResponse.then().body("name", Matchers.equalTo("Product 2"));
      }
      }
      ```
      In this example, we first create a POST request to the /products API. We pass in a JSON payload that contains the name of the product. We then assert that the POST request was successful.
      We then get the product ID from the POST response. We use this product ID to create a PUT request to the /products/productId API. We pass in a JSON payload that contains the new name of the product. We then assert that the PUT request was successful.
      Finally, we assert that the product name was updated.
      I hope this helps

    • @krunalidedhia7117
      @krunalidedhia7117 Рік тому

      Thank you sir.! I am trying this method@@RaghavPal

  • @shwetabolar
    @shwetabolar 4 місяці тому

    sir , can you explain me what is the benefit i get if i join your channel?

    • @RaghavPal
      @RaghavPal  4 місяці тому

      Shweta
      Joining is not mandatory.. it's only if you want to support my work for free education to all.. you will get all the benefits, videos, etc even if you don't join

  • @ahmethalukbilgic1985
    @ahmethalukbilgic1985 3 роки тому

    Hi. I give error when i add json to pom.xml "json-simple:1.1.1"not found. Please help

    • @RaghavPal
      @RaghavPal  3 роки тому

      Can change the lib or ver and try again

  • @elmariscal5394
    @elmariscal5394 3 роки тому

    Hi Raghav, you are creating request json object and then parsing it to a json string as well. I was wondering that maybe the second step is not necessary as the request is already in a json request format. It is just to show that it can be parsed into another format , is that correct?

    • @RaghavPal
      @RaghavPal  3 роки тому +1

      Hi Frank, ya it that case may not be required, can try at your end and if working, should be fine

  • @leenabharambe3260
    @leenabharambe3260 3 роки тому

    I am getting javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure exception

    • @RaghavPal
      @RaghavPal  3 роки тому

      hi leena, this can help stackoverflow.com/questions/37714696/not-able-to-connect-to-server-through-java-code-getting-javax-net-ssl-sslhandsh

  • @mhoff-beattraveling2946
    @mhoff-beattraveling2946 2 роки тому

    JSONObject cannot be resolved to a type, why this error msg got ?

    • @RaghavPal
      @RaghavPal  2 роки тому

      it may either be due to some library missing or some syntax/structure issue
      Please check if you have imported all the correct libraries and then compare the code,
      Can check some examples online

  • @zahidullaghouri4532
    @zahidullaghouri4532 3 роки тому

    Hey Raghav, i am not able to write equalTo it's giving me an error i've imported everything as you mentioned

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Zahid, the only issue I can think of is either some library mismatch or syntax error

  • @yuktibaheti621
    @yuktibaheti621 3 роки тому

    Hello Raghav!!
    I have a query related to payment portal in case of api
    How can we do payments thru api
    Scenarios:
    We booked a hotel
    We now have to do payment thru credit card
    But this api request is asking for some encrypted data too
    Which is dynamic in nature
    How can we handle such scenarios
    Please suggest

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Yukti, you just need to have APIs for these requests, Check with your team, if you have you can just follow the tutorials

  • @sachinmane1391
    @sachinmane1391 3 роки тому

    you didn't explained, what is hashmap and why you used given when and then for post not for put. It will be great if you explain or show what changes you made on record . What is the difference between PUT and POST

    • @RaghavPal
      @RaghavPal  3 роки тому

      I will try to add a session on this Sachin

  • @andreytravkin7579
    @andreytravkin7579 3 роки тому

    When I trying to create response: "JSONPObject request = new JSONPObject(map);
    I've get the error: "JSONPObject request = new JSONPObject(map);"
    Does anybody know how to fix it?

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Andrey, what is the error log

  • @AmanRaj-lq4je
    @AmanRaj-lq4je 3 роки тому

    Raghav I am working in mindtree... I joined mindtree on 25th jan 2019. We had training for 3 months in SDET.. After that we didnt move to project due to pandemic... They shifter us to support and I got as Service Desk Engineer.. Now can you please help me to tell that is there any chance to come back in SDET in any other company??? Please Raghav , I need your help on this

    • @RaghavPal
      @RaghavPal  3 роки тому +1

      Hi Aman, yes you already had a basic training, I will suggest to check the current SDET role needs and requirements and skill yourself according to that and start applying

    • @AmanRaj-lq4je
      @AmanRaj-lq4je 3 роки тому

      @@RaghavPal thanks Raghav... That means there is a chance to come back...Thanks for the suggestion..

    • @AmanRaj-lq4je
      @AmanRaj-lq4je 3 роки тому +1

      @@RaghavPal thanks Raghav... That means there is a chance to come back...Thanks for the suggestion..

    • @RaghavPal
      @RaghavPal  3 роки тому +1

      Yes, absolutely

  • @mani36526
    @mani36526 Рік тому

    Has items giving me error that the method hasitem is undefined, you didn't get this error
    Please help me to resolve this

    • @RaghavPal
      @RaghavPal  Рік тому

      Hi Manisha, will need more details and context on this

  • @yazh403
    @yazh403 3 роки тому

    Mobile testing ku video podalaiya

  • @andyrockstar78
    @andyrockstar78 3 місяці тому

    Getting this error when trying to run GET. groovy

    • @RaghavPal
      @RaghavPal  2 місяці тому

      Andy
      will need more details, your steps, code etc

    • @andyrockstar78
      @andyrockstar78 2 місяці тому

      @@RaghavPal not able to post screenshots

    • @RaghavPal
      @RaghavPal  2 місяці тому

      can upload on some sharing sites like WeTransfer and give me the link with details

  • @sreelatha4230
    @sreelatha4230 2 місяці тому

    Thanks a lot Raghav, for very easy and excellent teaching 👍 very helpful to learn in less time even in a day 🫡

    • @RaghavPal
      @RaghavPal  Місяць тому

      Most welcome Sree Latha

  • @smartha06
    @smartha06 Місяць тому

    I need jobs in qa these days are virtually hiring they are way to much... Like did some sort of phd

    • @RaghavPal
      @RaghavPal  Місяць тому

      Smarath
      It’s true QA roles have evolved with many companies now looking for candidates with strong technical and analytical skills, sometimes at an almost research-level depth .. Skills in automation, scripting, API testing, CI/CD, and performance testing are becoming common requirements. ..
      Here are some highly valued skills and certifications in the QA field that can enhance your profile:
      Automation Testing - Learn tools like Selenium or Cypress.
      API Testing - Practice Postman and scripting tests.
      Performance Testing - Try JMeter or LoadRunner.
      CI/CD - Get familiar with Jenkins or GitLab CI.
      Test Strategy - Improve test planning, especially in tools like Zephyr in Jira
      Certifications
      ISTQB Foundation - Testing basics
      Postman Certification - API testing
      Certified Selenium Tester - Automation expertise
      Quick Resources
      Automation: Udemy for Selenium/Cypress.
      API Testing: Postman Learning Center.
      Performance Testing: BlazeMeter for JMeter training
      This can give you the edge needed for top QA role