How to restore a service endpoint

I want to add my project endpoint to the project by dumping the script. What is the syntax for getting the endpoint for all queries and test queries when the user will assign his endpoint through all queries and test queries before starting the project?

I saw an example using a test step, but I don't want to retrieve it using the test step route:

testRunner.testCase.getTestStepByName("dd").getHttpRequest().getEndpoint(); 

A stall script uses either project variables, log, context, runner nd.

thanks

+5
source share
1 answer

Based on the information updated in the question, it looks like you need to access the endpoint in the TearDown Script project.

It also seems that you will need to run the same test suite for different base url endpoint and domain . Not sure if even you might need to use credentials accordingly.

Given the foregoing, it would be easy to design level properties.

Here you have to go:

  • Create a custom project-level property for the base url , say BASE_URL as the property name and value http://10.0.0.1:8008 . Of course, change it with the actual value as necessary in relation to the tests performed.
  • Similarly, create another project-level property for the domain , say DOMAIN_NAME and specify its value in accordance with the test.
  • Double-click on the service / interface, go to the Service Endpoints tab.
  • Delete all existing values.
  • Add a new endpoint by clicking the + icon.
  • Add ${#Project#BASE_URL} as an endpoint and ${#Project#DOMAIN_NAME} as domain values
  • If necessary, you use the same approach for credentials.
  • Now click the Assign button and select All requests and Tests from the drop-down menu.
  • 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')}" 

If you want to change the domain or base url , simply change the values ​​of the corresponding properties of the project before running the tests on different servers / environments.

EDIT:

Values ​​for endpoint or domain can be transferred dynamically (without changing the value stored in the project) from the command line using the SOAPUI_HOME/bin/testrunner during test execution. For more information, see the documentation .

+6
source

Source: https://habr.com/ru/post/1263446/


All Articles