i want to add my project's endpoint in the project tear down script. What is the syntax in order to get the endpoint for all requests and test requests as the user will assign their endpoint via all requests and test requests before running the project?
i seen an example using test step but i don't want to retrieve it via the test step route:
testRunner.testCase.getTestStepByName("dd").getHttpRequest().getEndpoint(); The tear down script use either , log, context, runner nd project variables.
Thanks
Screenshots:
I removed the last digits of the endpoints in the screenshot below but there are 5 end points
1 Answers
Answers 1
Based on the information updated in the question, it looks like you have to access the endpoint in the TearDown Script of the project.
It also appears that you would need to execute the same set of tests against different base url of the endpoint and domain. Not sure even you might need to use the credentials accordingly.
Considering the above, it would be easy to project level properties.
Here you would go:
- Create a project level custom property for base url, say
BASE_URLas property name and value ashttp://10.0.0.1:8008. Of course, change it with actual value as needed with respect to the tests to be executed. - Similarly create another project level property for domain, say
DOMAIN_NAMEand provide its value according the test. - Double click on service / interface, click on
Service Endpointstab. - Remove all the existing values.
- Add a new endpoint by clicking
+icon. - Add
${#Project#BASE_URL}as endpoint and${#Project#DOMAIN_NAME}as domain values - If required, you use the same approach for the credentials.
- Now click on
Assignbutton there and chooseAll requests and Testsoption from the dropdown. - Similarly, do the same if you have multiple services / interfaces.
How to access the above values in TearDown Script?
log.info "Endpoint : ${project.getPropertyValue('BASE_URL')}" log.info "Domain : ${project.getPropertyValue('DOMAIN_NAME')}" When you want to change domain or base url, just change the values of the respective project properties before you run execute the tests against different servers / environments.



0 comments:
Post a Comment