Forum Discussion

troyyerJP's avatar
troyyerJP
Contributor
3 years ago

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.

6 Replies

  • aaronpliu's avatar
    aaronpliu
    Frequent Contributor

    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

    QA = https://x.x.x.x/abc/123

     

    If it is dynamically retrieved, then update project properties in your subsequent steps.

     

     

    Thanks,

    /Aaron

    • troyyerJP's avatar
      troyyerJP
      Contributor

      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) 

       

       

      • aaronpliu's avatar
        aaronpliu
        Frequent Contributor

        troyyerJP 

        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

        QA=https://abc/123

        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