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();
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:
BASE_URL
as property name and value as http://10.0.0.1:8008
. Of course, change it with actual value as needed with respect to the tests to be executed.DOMAIN_NAME
and provide its value according the test.Service Endpoints
tab.+
icon.${#Project#BASE_URL}
as endpoint and ${#Project#DOMAIN_NAME}
as domain valuesAssign
button there and choose All requests and Tests
option from the dropdown.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.
EDIT:
The values for the endpoint
or domain
can passed dynamically (without even changing value saved in the project) from command line using SOAPUI_HOME/bin/testrunner
utility while executing the tests. For more details, refer documentation