watery
watery

Reputation: 5487

soapui same username and password for authentication with all rest resources

I have a Rest Project generated from a WADL, that contains tens of resources. The whole API domain requires authentication (using the same username and password for every resource): how do I share the credentials among all the resources?

So far I managed to set the username and password for each request (by using the Auth button at the bottom of the request window), but this means I have to set the credentials for each resources I'm going to query.

I found that the "service" entry in the project tree has a "Service Viewer" where, inside the Service Endpoints tab, I can enter username and password, but these do not seem to be used anywhere in my requests.

Upvotes: 1

Views: 2752

Answers (1)

Ud_Undefined
Ud_Undefined

Reputation: 104

Any thing that needs to be Shared can be set as properties at different levels.

  1. Project level properties
  2. Testsuite level properties
  3. Testcase level properties

    As per your requirement it seems like you want to share the credentials for all resources in the project so you can define it at Project level
    Below Screen shot will explain better:
    enter image description here

You can refer these properties in the UserName and Password Textbox as
${#Project#UserName}
${#Project#Password}

If you are wondering that password field is showing dots so relax SoapUI will take care of it,although I could not test it but below is the screen shot of my Project XML file.
enter image description here

I hope this will help and should work fine.

Upvotes: 3

Related Questions