bruno
bruno copied to clipboard
Test translation on import doesn't properly convert 'pm.response.code'
Issue
During import of a Postman collection with existing tests, Bruno attempts to import the tests and translate them into BRU.
It appears it misses pm.response.code. It should be converted to res.status. As a result, all tests will fail as the pm object is "rightfully" not defined.
Original Postman Test
pm.test("Get valid access token", function () {
if( pm.response.code === 200 ) {
var jsonData = pm.response.json();
pm.collectionVariables.set("validToken", jsonData.token);
}
});
Translated Bruno Test
test("Get valid access token", function () {
if( pm.response.code === 200 ) {
var jsonData = pm.response.json();
bru.setVar("validToken", jsonData.token);
}
});
Expected Bruno Test
test("Get valid access token", function () {
if( res.status === 200 ) {
var jsonData = res.getBody();
bru.setVar("validToken", jsonData.token);
}
});
I also notice that it didn't convert pm.response.json() to res.getBody()