Ability to add a profile variable. For each profile it has different values. Then have a step to be able to switch profiles.
This would allow us to much easier change users instead of having the following variables as a simple example:
6 Answers, 1 is accepted
I understand your point of view and how an automated step to switch profiles can increase productivity in some scenarios. At this point, I can provide a quick solution with a coded step (see sample project), where you can add this coded step for your test and change the credentials or other variables. In the example I attached, you can see the behavior as I explain it below.
- Initially, I added a profileName project variable with value "John". In my first test "Set profile credentials", I use a coded step to get this variable and set the correct username and password for this test. Note that you can use different parameters to set the variable on project level.
- The next action is a Http Request which posts username and password in the body of the current test. You can check that the variables are set.
- In my next test "Execute test steps without credentials", I don't use a coded step and since in my previous test I only set the variables on test level, they are not available here (check the post's body).
- As a final test in "Change profile credentials and test" again, I added a coded step to set new value for profileName on project level and set new test variable for username and password. Those values are updated in the next Http Request.
At the moment, we don't have plans to implement such feature, but we will improve our documentation for this scenario and provide the solution with a coded step.
Thank you for your feedback, we appreciate it.
Thanks for the workaround.
IMO, the team should really reconsider it. In the new world of cloud services, bearer tokens and jwt tokens, this is standard fare for all API calls. Until the ability to run test as a step is available in the API Testing Tool, this will create a lot of work to build and maintain scripts.
Thanks for the workaround.
IMO I think your team should reconsider this. Until Run Test as Step is available (With the ability to send inputs to it), this would end up being a lot of work to maintain and build the steps.
This is just the wish list though ;)
As we continue this discussion I believe that I am starting to understand more about your request and scenario. Please correct me if I am wrong, thinking that you are trying to pass variables from web & desktop project to an API project, using the API Test As Step. If this is indeed the case, it is already available in the properties pane from the web & desktop project. To demonstrate it, I have created new web & desktop project and added only 1 step - API Test As Step. The attached example project uses the same logic to set username and password depending on the value of "profileName" variable, as the previous sample API project, but this time I pass the value "Jane" to the API test.
Please check the above details and sample project and let me know if this information is relevant to your scenario. I would like to make sure that we are on the same page.
Thank you in advance.
I am actually referring to Use API step as Step within the API Tool. I believe there is an existing feature request for this. The profile variables in conjunction would be a very powerful feature.
I now understand your scenario better and I believe that the feature request, that you are referring to, is - Test Reusability (Test as Step). The implementation of this request should allow you to add API tests as step and pass variables, in Test Studio API projects, in similar way as I showed in the example, in the previous reply.
Am I correct in assuming that when this feature is implemented along with the ability to pass variables to the test as step, your scenario will be covered? If that is the case, you could vote for this feature and also leave a comment, if you have something to add or clarify there. This way the feature will go up in priority for our future releases.
Thank you for your understanding.