예, 어느 방법 으로든 수행 할 수 있으며 추가 단계입니다.
현재 테스트 단계에서 Script Assertion
을 사용하여 추가 단계없이 수행 할 수도 있습니다. 거기도 응답을 주장 할 수 있습니다.
의사 명령들은
- 응답을 검색하여 필요한 값
- 사용 검색된 값을 사용하여 테스트 케이스 레벨의 값을 설정 응답
- 으로 존재하는 것이
- 어설 경우 파싱 테스트 케이스의 다른 테스트 단계에서 속성 확장.
스크립트 어설
/**
* This is a script assertion
* which reads the response and asserts if there is response
* reads response property and sets at test case level property SESSION_ID
*/
def jsonString = context.response
def json = new groovy.json.JsonSlurper().parseText(jsonString)
//Check if the response is not empty or null
assert json, "Response received is empty or null"
def sessionId = json.response as String
//Check if there is reponse property exists in response json
assert sessionId, "response property is empty or null"
log.info "Session id : ${sessionId}"
//To set the value at test case level
context.testCase.setPropertyValue('SESSION_ID', sessionId)
은 어떻게 테스트 케이스의 다른 테스트 단계에서 검색된 세션 ID를 사용하는?
참고 : 물론, 스위트 오에 값을 설정하는 것도 가능합니다 또한 프로젝트 레벨에서 검색된 값을 재사용 할 수있는 프로젝트 레벨
출처
2016-09-29 04:04:25
Rao