Feature: sample karate test script
Background:
url baseURl
def jsonFiles = Java.type('com.demo.utill.UntillMethods')
def now = function(){ return java.lang.System.currentTimeMillis() }
#karate.readAsString('classpath:CreateUser.js')
Scenario: create user and then get the first user by id
Given path mainURl
def json = jsonFiles.jsonFile("CreateUser.js")
def name = 'Test-' + now()
replace json.userName = name
And request json
def headValues = { Authorization: 'Bearer 7232803c821bc49a0bd5c56d7df39c5289168e323fb17c5b6b1597d8941e33ef', Content-Type: 'application/json' }
headers headValues
When method post
Then assert responseStatus == 201
print response
On this page of the site you can watch the video online Karate Framework Beginner Class 11: Post Method | Calling Java Code | Headers | Request Method with a duration of hours minute second in good quality, which was uploaded by the user Testing Tutorialspoint 24 July 2022, share the link with friends and acquaintances, this video has already been watched 171 times on youtube and it was liked by 3 viewers. Enjoy your viewing!