레이블이 API인 게시물을 표시합니다. 모든 게시물 표시
레이블이 API인 게시물을 표시합니다. 모든 게시물 표시

2020년 11월 9일 월요일

[QA] Postman 참고될만한 SNIPPETS

Postman 참고될만한 SNIPPETS

SNIPPETSTests Code설명
Get an environment variablepm.environment.get("variable_key");Postman 전체에서 사용 가능한 파라미터 값 얻음
Get a global variablepm.globals.get("variable_key");전역 파라미터 값 얻기
Get a variablepm.variables.get("variable_key");Collection 안에서 사용 가능한 파라미터 값 얻기
Set an environment variablepm.environment.set("variable_key", "variable_value");Postman 전체에서 사용 가능한 파라미터 값 설정
Set a global variablepm.globals.set("variable_key", "variable_value");전역 파라미터 값 설정
Clear an environment variablepm.environment.unset("variable_key");Postman 전체에서 사용 가능한 파라미터 삭제
Clear a global variablepm.globals.unset("variable_key");전역 파라미터 삭제
Send a requestpm.sendRequest("https://postman-echo.com/get", function (err, response) {
console.log(response.json());
});
API 호출
Status code: Coet is 200pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
Http 코드가 200인지 확인
Response body: Contains stringp[m.test(](http://m.test()"Body matches string", function () {

pm.expect(pm.response.text()).to.include(;
});
응답 결과 중 원하는 단어 포함 여부 확인
Response body: Is equal to a stringp[m.test(](http://m.test()"Body is correct", function ()

{pm.response.to.have.body("response_body_string");
});
응답 결과가 원하는 결과인지 확인
Response headers: Content-Type header checkpm.test("Content-Type is present", function () {
pm.response.to.have.header("Content-Type");
});
응답 header 중 원하는 타입이 있는지 확인함.
Response time is less than 200msp[m.test(](http://m.test()"Response time is less than 200ms", function () {


pm.expect(pm.response.responseTime).to.be.below(200);
});
응답 시간이 200ms이하인지 확인
Status code: Successful POST requestpm.test("Successful POST request", function () {

pm.expect(pm.response.code).to.be.oneOf([201,202]);
});
http 코드가 201, 202 중 하나인지 확인
Status code: Code name has stringpm.test("Status code name has string", function () {
pm.response.to.have.status("Created");
});
응답 코드에 원하는 단어 포함 여부 확인
Response body: Convert XML body to a JSON Objectvar jsonObject = xml2Json(responseBody);XML을 JSON으로 변환
Use Tiny Validator for JSON datavar schema = {
"items": {
"type": "boolean"
}
};

var data1 = [true, false];
var data2 = [true, 123];

pm.test('Schema is valid', function() {
pm.expect(tv4.validate(data1, schema)).to.be.true;
pm.expect(tv4.validate(data2, schema)).to.be.true;
});
응답 값인 JSON 데이터데 원하는 Schema 여부 확인
참고 
https://m.blog.naver.com/wisestone2007/221393509035
https://learning.postman.com/docs/sending-requests/variables/



2008년 9월 11일 목요일

JUnit 관련 링크

흥미로운 자료들을 한글로 번역 잘해주시는 우리 ㄳIBMㄳ의 junit4로 뛰어들기!http://www.ibm.com/developerworks/kr/library/tutorial/j-junit4/?S_TACT=105AGX55&S_CMP=contentjunit4는 자바의 annotation을 이용했기 때문에 이에 대한 공부도 필요하다.
일단 선의 튜토리얼 공식 링크http://java.sun.com/docs/books/tutorial/java/javaOO/annotations.html예제는 업ㅂ어!

를 외치던 선 & 자바인줄 알았는데 이런 튜토리얼이 존재하다니 감동했다.
한글로 된 'Java 어노테이션(Annotation)에 관한 간략한 소개'http://decoder.tistory.com/21그리

Java APIs 문서 한글화 된곳

http://xrath.com/javase/ko/6/docs/ko/api/index.html은 자바6고

http://www.javastudy.co.kr/api/api1.5/index.html여기는 5다