Environment configuration for Salesforce APIs
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Environment configuration for Salesforce APIs
Hi,
I'm just having a mental block on this so would like some help with ideas on how to solve my issues.
So i am currently performing API testing on salesforce thru both the Salesforce SOAP and REST service. So if we concentrate on just the SOAP service for now, To use the Salesforce Service, you need to first call the Salesforce Endpoint login method with your sandbox environment login credentials and then in your subsequent calls you would then use the ServerUrl and SessionId returned back in the response in your subsequent Salesforce calls.
In my Project i copy the response fields into a Property Step
and use them in the corresponding Requests to Salesforce
so this is working all fine with ReadyAPIs 'default environment'. My issue comes when i try to set up 'Environments'. We have multiple test sandboxes so currently in my test I change the login parameters to login to the different sandobxes under test. I want to use the Environments dropdown, however i dont know how to setup the endpoint parameter in the Environment dialog to accept/use the passed back endpoint from Salesforce
currently if i set up the endpoints to have a QA environment, the endpoint dialog will only let me have 1 endpoint for salesforce (the base Salesforce url)
so the subsequent calls will not have the right endpoint as supplied back from Salesforce
Has anyone worked with sort of setup and gotten it working in ReadyAPI?
An ideas on how to set (reset my setup) this up would be greatly appreciated.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@troyyerJP parameterize environment base url if required.
For example: define ${#Project#QA} under SOAP Services or REST Services, and add custom properties.
SOAP Services or REST Services:
${#Project#QA}
Custom Properties
If it is dynamically retrieved, then update project properties in your subsequent steps.
Thanks,
/Aaron
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Aaron,
Sorry, I didn't quite understand the steps of what I need to do or change. Here are my current steps I've performed for this.
I've gone into the Configure Environments section
Currently my QA environment has a Soap Endpoint called SoapBinding, which is the Salesforce Soap Service API
if I click the + symbol and try to add a new endpoint for SoapBinding to be a parameter ${SFProperties#serverUrl} the value now gets updated
however this is not the right endpoint for logging into Salesforce (needs to point to test.salesforce.com)
if i go to the API section of the project, and I try to add/update an Environment, then the same behaviour occurs (the end point gets replaced with the Parameter
If i am just Testing Salesforce API alone, changing the environment login user to the Salesforce Environment being tested is fine, however I have to now add in our external API dependencies as part of my test flow. In my existing project with the External APIs, I have set up the Environment groups for the APIs in ReadyAPI, but now when I merge in the steps for Salesforce, I'm not able to proceed as expected. Also im trying to set it up with as little configuration for someone non technical to repoint the test to suit the environment they are working on (which the Environment drop down greatly helps with)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't need to add env in endpoint.
Since you configure different test environment, each env has a different base url, right? you just need to configure your base url of environment (i.e. QA, Dev) in Custom properties
Dev=https://abc/456
And then reference them in SOAP Services or REST Services. like ${#Project#QA} or ${#Project#Dev}.
When you switch environment, the base url will be changed to follow your selection. because only 1 env is activated.
Thanks,
/Aaron
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @aaronpliu ,
Thanks for the further suggestion. I feel I have understood what you mentioned so the end state is that in the API section I would update the end points to have the Custom Property as the below screen
I have previously tried this and I can't hardcode the url in this manner. The first call to Salesforce is to test.salesforce.com. I would supply my login corresponding to the Sandbox i want to log into and once authenticated, Salesforce supplies back the URL for the environment under test.
for example
SIT I would navigate to "test.salesforce.com" and use my login id of troyyerJP@salesforce.com.sit, and then Salesforce would would create a session for the SIT environment sit.salesforce.com . the SIT url endpoint is supplied back to me by salesforce from the login api response data.
Stage I would navigate to "test.salesforce.com" and use my login id of troyyerJP@salesforce.com.prep and then Salesforce would create a session for the Stage environment prep.salesforce.com . the Stage url endpoint is supplied back to me from salesforce from the login api response data
I can't hardcode the sit url custom property to sit.salesforce.com as when we refresh the environments we could be assigned a new sandbox for the environment so the suggested process to login is to start from test.salesforce.com and use the ServerUrl supplied back in the login response.
As mentioned we have multiple APIs so we need to configure them in the Environments feature where I can set it once and other non-technical testers can select the environment they want to test in.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Any other options for this?
I tried to implement @aaronpliu pattern, and hardcoded the salesforce URL for the specific environment to 2 different Test Project Custom Properties QA and UAT environment parameters, however that fails as a Salesforce update has now changed those URLs. So this pattern is a bit too brittle and has to be constantly managed.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An interesting thread!
@nmrao @HimanshuTayal @ChrisAdams , any ideas?
Sonya Mihaljova
Community and Education Specialist
