Postman runner "This request does not have any tests"

I do not understand this error. I do not want to run a test. I just want to perform a simple delete operation in Okta. I have never used Postman before. I can run a list of users using a pre-written Okta collection. Ithen tried the Okta delete uses with a small2-line .csv file and I keep getting this error. Code: [DELETE {{url}}/api/v1/users/{{username}}]. Postman runner Result: “This request does not have any tests”.

Hey @steve.robey

Welcome to the community! :trophy:

So the message isn’t an error, it’s just informing you that, those particular requests, don’t have any Tests associated with them in the Tests tab in the Request Builder. It doesn’t impact the Collection run in any way.

The issue that I can see here is that the request is returning a 404 Not Found, as you are using variables {{url}}/api/v1/users/{{username}} it might be that those are not resolving during runtime.

HI Danny, Thank you for a quick response. I was just looking at the 404 Not found, and I think you are correct and my query is not finding the users. So I need to dive into why this is occurring as I know the two users in the .csv file exist. Okta provides the simplistic code including the name for the variable for the users, but they show it with two different names, once “username” and once" userid". I have tried both and the preview of the .csv field looks ok. I have a call with Okta support this morning and although I know that Okta support people want nothing to do with customer code that deletes deactivated users, I hope I can figure out what is wrong. Here is the link to their sparse documentation: https://support.okta.com/help/s/article/How-to-bulk-delete-users-via-Postman,

Are you using the same CSV file from that article or one of your own?

Have you set the {{url}} variable anywhere else?

It looks like that CSV is only showing the {{username}} key/value so if the domain part isn’t resolving, it wouldn’t work.

If you click on the request name, in the image you posted, you will get more details about the request - This will show the resolved URL.

You should be seeing something like:

https://example.okta.com/api/v1/users/test1@rares.local

but if that’s like this:

https:///%7B%7Burl%7D%7D/api/v1/users/test1@rares.local

That’s the issue. :smiley:

The ‘url’ looks OK:PostmanError1
But the ‘username’ variable is ‘Unresolved’. How do I fix this?PostmanError2

Is that the same environment file that you using during the Collection Run?

If you’re using the Collection Runner with a CSV datafile like this:

username
Danny
Steve
Bob

It will resolve that variable at runtime.

If you’re in the Request Builder, like I can see you are, you could add a new username variable to your environment file with the value of a user you want to Delete and try it out to see if it’s working as expected before moving to the runner again.

Hi Danny, you are definitely pointing me in the correct direction. Looking up and using the Using the Okta ‘userid’ (looks like ‘00u3565wcwJQN0pm62p7’) in the Request builder works. But using the same code to run in the Collections run still cannot find the user. Even my Okta support person was unable to help me yet and will have to get back to me however. In the meantime I am going to punt with postman as I was able to get their PowerShell code to work correctly and delete the 2,800 deactivated users. I’ll post back here if I ever get it to work correctly. The Okta document page that I referenced above is clearly not correct.

Note: I find it is better to use PowerShell to deactivate and/or delete a batch of users since it will deactivate the user and then delete it in a single pass. This script also creates a useful log file. See: delete-users.ps1 found here: https://support.okta.com/help/s/article/How-to-Perform-a-Bulk-Delete-of-Okta-Users-With-API

Reference: https://support.okta.com/help/s/article/How-to-bulk-delete-users-via-Postman

To use Postman, first set up an account. I created an account linked to my persoanl account. Then I set up an environment that I call ‘Okta Lumileds Production’ with the correct URL and I generated the api key. You should also test your environment with the list user script first. Then I fount Okta’s collections and found the delete user script under Users (Okta API) à ‘Lifecycle Operations’. To successfully run this ‘Delete User’ script (Under ‘Lumileds above): DELETE {{url}}/api/v1/users/{{username}}

Hover over “Lumileds and then click on the ‘Play’ icon’ that appears:

Then Click Run:

This will open a new ‘Collection Runner Window and log you in in preparation for running the script. Verify the environment and select your .csv file. Example: 20200706_OktaDelDeaUsers.csv, containing:

username

Chandran.Varitharajoo@lumileds.com

Note: this is a deactivated user in Okta:

Click ‘Run Lumileds to see:

Ignore the ‘This request does not have any tests and ‘204 no Content’ messages. The results are meaningless to. But the user is deleted:

{

“id”: “1acc82da-5c3b-40c3-a500-e1814bc93567”,

“name”: “Lumileds”,

“timestamp”: “2020-07-06T19:53:09.134Z”,

“collection_id”: “2a5c9dd7-4700-4229-abe7-00ff95b6821e”,

“folder_id”: 0,

“environment_id”: “a04ae03d-b150-4eeb-98bd-2135edd05c59”,

“totalPass”: 0,

“totalFail”: 0,

“results”: [

{

“id”: “5677947d-fdd9-4a22-9c5e-e71c1a2f714c”,

“name”: “Delete User”,

“url”: “https://lumileds.okta.com/api/v1/users/Chandran.Varitharajoo@lumileds.com”,

“time”: 945,

“responseCode”: {

“code”: 204,

“name”: “No Content”

},

“tests”: {},

“testPassFailCounts”: {},

“times”: [

945

],

“allTests”: [

{}

]

}

],

“count”: 1,

“totalTime”: 945,

“collection”: {

“requests”: [

{

“id”: “5677947d-fdd9-4a22-9c5e-e71c1a2f714c”,

“method”: “DELETE”

}

]

}

}