목록전체 글 (21)
ITGeine
1. empty array 여부 확인 - { "resultData": [], "errorCode": 0 } pm.expect(jsonData.resultData[0]).to.be.null; - 이 경우 undefined to be null 에러가 떨어진다. pm.expect(jsonData.resultData[0]).not.to.have.property('dd',pm.environment.get("dd")); - 이 경우 Target cannot be null or undefined 에러가 떨어진다. 아래와 같이 array의 length가 0인지 확인하면 된다. pm.test('Assert array is empty', function(){ pm.expect(jsonData.resultData.lengt..
테스트 스크립트를 짜다보면 시간을 활용해야 하는 항목이 꽤 많다. 다시 찾기 귀찮아서 이쪽에 시간 관련된 항목이 나올때마다 정리하려 한다. Unix 타임스탬프 형식으로 구하기 //millsecond 단위 var timestamp = Date.now(); - 결과 : 1572403320540 //second 단위 var timestamp = new Date().getTime() / 1000; - 결과: 1572403320 ISO String 형식으로 구하기 //ISOString 형태로 구하기 (yyyy-mm-dd'T'HH:mm:ssZ) var dateIso = new Date().toISOString(); - 결과: 2019-10-29T01:36:55.904Z pm.environment.set("Tag_c..
목표Postman에서 Test script를 작성한 뒤, Jenkins를 연동하여 주기적으로 Run을 시키고 결과를 export할 수 있도록 함 Postman API postman에서 제공하는 API를 사용하여 생성한 collections, environments 에 대한 uid를 얻을 수 있다.아래는 collection에 대한 GET API 를 호출했을 때 결과이다. id, name, owner, uid 가 리턴되는데 jenkins 연동에 쓰이는 데 필요한 값은 uid이다. Build execute shell 아래와 같이 호출할 경우 json 파일 업로드 없이 postman 에 저장된 collcection, environment 값을 가져와 run 하게 된다. newman run https://api...