Service_Mesh-SU
11 years agoOccasional Contributor
[Resolved] Dynamically set resource path of WADL at runtime
I have the following scenario:
1) Our product supports "X" number of versions for our REST API:
v3.0, v3.5, v4.0, etc
2) Each version of our API has a unique WADL, where the resource path has the version of the API contained in it like so:
/product/api/v4.0/.....
3) We import the WADL (say from v4.0) and create our automated tests based on it.
4) To have these same tests execute against v3.0 and v3.5, we must maintain each of these tests in a separate soapUI project, which is not only difficult (can't easily copy tests between these different projects due to the resource path difference), but also maintenance intensive (having the same test in more than one place when test needs update).
5) We currently have coded soapUI with the ability to enable/disable tests (cases and suites) based on the API version. For example, v4.0 may introduce a new resource that we can restrict so it is NOT run against v3.5
6) What we would like to do is maintain only 1 project, with the latest version WADL, and "dynamically" set the resource path at test runtime:
ex: change "product/api/v4.0/foo" to "product/api/v3.5/foo", run the tests, then change to "product/api/v3.0/foo" and run the tests again
7) I've played around a bit with a RequestFilter Event, attempting to dynamically modify the version portion of the resource path like so:
request.getPath()
//modify path and then set it
request.setPath()
This does modify the path, but only for the "next" run of the test, not the current run.
8.) I'd like to know if there is a better approach/solution to the above described problem that I should be looking at.
One thought was to edit the WADL in soapUI and replace the "version" in the resource path with a variable ($foo, for example) and then set this variable based on needs.
Any pointers would be greatly appreciated!
1) Our product supports "X" number of versions for our REST API:
v3.0, v3.5, v4.0, etc
2) Each version of our API has a unique WADL, where the resource path has the version of the API contained in it like so:
/product/api/v4.0/.....
3) We import the WADL (say from v4.0) and create our automated tests based on it.
4) To have these same tests execute against v3.0 and v3.5, we must maintain each of these tests in a separate soapUI project, which is not only difficult (can't easily copy tests between these different projects due to the resource path difference), but also maintenance intensive (having the same test in more than one place when test needs update).
5) We currently have coded soapUI with the ability to enable/disable tests (cases and suites) based on the API version. For example, v4.0 may introduce a new resource that we can restrict so it is NOT run against v3.5
6) What we would like to do is maintain only 1 project, with the latest version WADL, and "dynamically" set the resource path at test runtime:
ex: change "product/api/v4.0/foo" to "product/api/v3.5/foo", run the tests, then change to "product/api/v3.0/foo" and run the tests again
7) I've played around a bit with a RequestFilter Event, attempting to dynamically modify the version portion of the resource path like so:
request.getPath()
//modify path and then set it
request.setPath()
This does modify the path, but only for the "next" run of the test, not the current run.
8.) I'd like to know if there is a better approach/solution to the above described problem that I should be looking at.
One thought was to edit the WADL in soapUI and replace the "version" in the resource path with a variable ($foo, for example) and then set this variable based on needs.
Any pointers would be greatly appreciated!