I’ve built 15 API requests in Postman and they run great there. The requests are gathered into a common Collection folder.
But when I open the Collection Runner (CR), I find that it insists on running old versions of these request.
For example, I had an assert in one method that I removed an hour ago. But CR insists that it is still there.
I have saved the collection multiple times. I have clicked the little orange Sync button. I have restarted Postman. But is makes not difference.
I can’t convince CR to run the updated requests.
What should I do?
Hey @kevinashaw
Welcome to the community site
That sounds a bit odd, which version of the app are you using and what’s the OS?
Is there anyway that you can share the Collection with us to take a look locally?
Have you tried running the collection with Newman?
Are you
Hi Danny,
Thanks for the help.
I’m running Postman 7.0.9 on MacOS 10.14.2.
I’m not familiar with Newman.
But, I just installed it, exported the Collection and Environment and ran it.
The results are the same as the Collection Runner in Postman.
For example, the ‘user-list’ endpoint has only a Status=200 test:
But Newman and the CollectionRunner are convinced that it has a second test:
→ Test_UserList
┌
│ '############## Creating request for access token ################'
│ '[email protected]'
│ 'JWT request: [object Object]'
└
POST https://xxxxxx.auth0.com/oauth/token [200 OK, 1.4KB, 212ms]
GET https://api.xxxxx.com/xxxxxx/user-list?prov_id=2800&page_size=10&page_num=0 [401 Unauthorized, 473B, 96ms]
**3.** **Status code is 200**
**4.** **Check count total**
and
3. AssertionError Status code is 200
expected response to have status code 200 but got 401
at assertion:0 in test-script
inside "Test_UserList"
4. AssertionError Check count total
expected undefined to deeply equal 11
at assertion:1 in test-script
inside "Test_UserList"
I’ve checked and this is the only Test_UserList
that I have.
Any thoughts?
-K
This appears to be a console.log()
statement coming from somewhere:
┌
│ '############## Creating request for access token ################'
│ '[email protected]'
│ 'JWT request: [object Object]'
└
Did you receive this collection from someone or is it one that a team member has access to modify?
I would check the Collection and Folder level Tests
and Pre-request
tabs to see if something isn’t in those and hide from your current view.
You can see these from the Collection level by pressing the ...
and then select Edit:
And following the same process on the sub-folders
.
Hi Danny,
Thank you for the help.
I am the sole creator of this Collection, so no worries about access.
I have some javascript in the Pre-request Script (at the Collection level) to request a JWT prior to every run session.
Following your thoughts, I removed all code from Pre-request script block and re-ran the test, but with NO change. The mysterious tests are still listed as being present in the Runner and are still absent in the Builder.
There are no tests at all at the collection level.
Below I have included the JWT request code, but its pretty standard stuff and makes no reference to any tests.
const moment = require('moment')
console.log("############## Creating request for access token ################")
let auth0_audience = pm.environment.get('auth0_audience')
let auth0_token_url = pm.environment.get('auth0_token_url')
let auth0_client_id = pm.environment.get('auth0_client_id')
let auth0_client_secret = pm.environment.get('auth0_client_secret')
let username = pm.environment.get('username')
let password = pm.environment.get('password')
console.log('username='+username)
const getJWT = {
url: auth0_token_url,
method: 'POST',
header: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: {
mode: 'urlencoded',
urlencoded: [
{key: 'grant_type', value: 'password' },
{key: 'username', value: username},
{key: 'password', value: password},
{key: 'audience', value: auth0_audience},
{key: 'client_id', value: auth0_client_id},
{key: 'client_secret', value: auth0_client_secret}
]
}
}
console.log('JWT request: '+getJWT)
var getToken = true
//if (!_.has(pm.environment.toObject(), 'access_token_expiry')
// || !_.has(pm.environment.toObject(), 'access_token')
// || pm.environment.get('access_token_expiry') <= moment().valueOf()) {
//} else {
// getToken = false
//}
if (getToken) {
pm.sendRequest(getJWT, (err, res) => {
if (err === null) {
pm.environment.set('access_token', `${res.json().access_token}`)
var expiryDate = moment().add(res.json().expires_in, 's').valueOf()
pm.environment.set('access_token_expiry', expiryDate)
}
})
}
Again, here is the only code listed in the Tests block for Test_UserList
:
I’m sure it’s something very simple going on and we can fix this
By the way, that JWT code looks very familiar, looks like something I created
Are you able to either share the collection with me? You can remove an sensitive info in there.
Also, could you show some images of the Runner output with the additional test please?
Thanks for all the help…and the sample code!!!
I’ve direct messaged you screen shots.
Kevin A. Shaw, Ph.D.
CTO / CoFounder | Algorithmic Intuition Inc
www.algorithmicintuition.com
[email protected] | Twitter: @kevinashaw | WeChat : kevinashaw