portman
portman copied to clipboard
Renaming tests possible?
Hi,
is there a way to rename tests generated from the YAML (not configured as variations)? I have a YAML file that contains the API spec and I'm using it for the Portman generation of my tests but I need to name the tests in a specific way, which is different from the name that comes from the YAML file. The problem is I also can't make changes to the YAML. I've tried adding it in the JSON config, but it seems to generate the same test again with the attached name.
Example name from YAML:
summary: Get users
Example test name I'm trying to get:
TST_123_123: Get users
The name you are seeing coming from the spec ends up as the name of the Postman request comes the first of description, operationId or url. I point this out as the name is the name of the request itself, and each request has it's own set of one or many tests...
While there is not a specific option for renaming requests, you could in theory use the portmanReplacements config in globals.
https://github.com/apideck-libraries/portman/tree/main/examples/portman-globals#portmanreplacements
Maybe would help if you explained why the name from the spec needs to be changed in your use case?
Hey, sorry for the delayed answer.
Maybe would help if you explained why the name from the spec needs to be changed in your use case?
In our project, we wanted to have the tests contain an ID that can be referenced to JIRA tasks for tracking purposes. Also, we have several endpoints which have attributes in the request body that can be required for one market but not required for a different one.