1

How to use data structures to pass Input and Verification in JSON format file in the Rest Assured framework. In the below file I am passing the Username and password as the input as the payload and verifying different User types from the JSON response.

Basically I want to avoid passing the data from Cucumber Example keyword and excel files. I want the data to be passed from JSON format file. Need inputs on how to get this done

{
 Login_Pass_1:
              {
                Input: 
                         Username:paulproux
                           password: xyz123
                Verification:
                          Usertype: admin
               }
Login_Pass_2:
             {
               Input: 
                         Username:johnrossu
                           password: abc456 
               Verification:
                          Usertype: reviewer
             }              
Login_Pass_3:
              {       
                 Input:  Username:johnrossu
                           password: sdf234
               Verification:
                          Usertype: moderator
              }

}
  • Rest-Assured has nothing to do with your requirement. It's just a HTTP client lib. If you want to data-driven testing, choose csv file + JUnit5/TestNG paramerterized test. – lucas-nguyen-17 May 11 '22 at 06:49
  • @lucas-nguyen-17 I dont want to pass it from excel or CSV file. Rather I want to pass the data in JSON file format. – Dylan Joseph May 11 '22 at 13:55
  • 1
    Then load file --> deserialized to POJO by Jackson/Gson --> put it in JUnit5/TestNG paramerterized test – lucas-nguyen-17 May 12 '22 at 02:16

0 Answers0