• Brian Lange
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hi

I have .NET SOAP integration.
When I add a new field to Salesforce of data type other than type text, the field is not included in the SOAP request to Salesforce.
So if I add a new field a__c of type text, after updating the wsdl in the .NET project I am able to set the value for this field in .NET which then updates Salesforce.
But if a new field of type number or checkbox is created in Salesforce, even after updating the wsdl in .NET the field value is not updated in Salesforce. In the debugging I can see that the new field is not part of the SOAP request to Salesforce.

Any ideas what could be causing the issue?

Thanks heaps.
I am currently automating a salesforce application using selenium and apex TC.  We use the salesforce Soap api and enterprise wsdl for our DML and SOQL updates, queries, etc. We are also using the soap api to run the apex tests. We run all of our selenium tests through tfs build using the microsoft build system.  The reporting reports on each test method if it to fail or pass.  I am trying to figure out how to run each apex test method instead of running the entire class.

The code below is one selenium method that runs the entire apex TC class with many methods.  I want to be able to do a 1 to 1 and have a selenium method call each apex test method however I am not finding away to do this.

The Selenium test method:

    [TestMethod]
        public void TestFromEventDetailsSprint181()
        {
            //This line of code logs into the dev org as defined in App.config and runs the specified apex test class.
            //   Use intellisense to see the available properties returned in testResults. This can be used to assert against for reporting back to TFS. 

            //CommonFunctionLibrary.SfApex.RunTestsResult testResults = Helper.RunSalesforceApexTestClass("TestForecastedRevWithoutECUpts_Test", null);
            CommonFunctionLibrary.SfApex.RunTestsResult testResults = Helper.RunSalesforceApexTestClass("somenamespace.someclass", null);
            
            //Some notable data available in the returned results to assert against:
            //   numTestRuns = # of testmethods executed in the apex test class
            //   numFailures = # of failed test methods
            //   failures = array of failure structures, each contains the methodName and message (see below)
            //   successes = array of success structures

            string failureMessage = "";
            if (testResults.numFailures > 0)
            {
                foreach (var failure in testResults.failures)
                {
                    failureMessage += "Test failure encountered in method: " + failure.methodName + ", error: " + failure.message + ".\n";
                }
            }

            //For demo purposes this assert assumes at least 1 testmethod will fail, as designed in the example TestClassTemplate run above.
            Assert.AreEqual(0, testResults.numFailures, failureMessage);
        }

The soap api called method to run the apex test class:

    public static RunTestsResult RunSalesforceApexTestClass(string testClassName, string testClassNamespace)
        {
            bool isSandbox = !AppSettings["EnvironmentType"].Equals("developer");

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            //Log into SFDC. Retrieve the Session ID and instance URL.
            SoapClient soapClient = new SoapClient((!isSandbox ? "Sfdeveloper" : "Sfsandbox"));

            SfPartner.LoginResult loginResult = soapClient.login(null, null, AppSettings["Username"], AppSettings["Password"]);

            SfApex.SessionHeader apexSessionHeader = new SfApex.SessionHeader();
            apexSessionHeader.sessionId = loginResult.sessionId;

            RunTestsRequest runTestsRequest = new RunTestsRequest();
            runTestsRequest.classes = new[] { testClassName };
            runTestsRequest.@namespace = (string.IsNullOrEmpty(testClassNamespace) ? AppSettings["OrgNameSpace"] : testClassNamespace);

            ApexService apexService = new ApexService();
            apexService.Url = loginResult.serverUrl.Replace("/u/", "/s/");   //The instance URL has a path change to call the SOAP service
            apexService.SessionHeaderValue = apexSessionHeader;

            RunTestsResult ret = apexService.runTests(runTestsRequest);

            return ret;

        }