+ Start a Discussion
WizradWizrad 

Ruby Apex WSDL runTests()

Hi,

 

I've been writing some Ruby code that utilizes wsdl2ruby and the Apex WSDL to run unit tests from ruby.

 

rtr = RunTestsRequest.new(:allTests  => false, :classes   => 'MyClassName')      
@sfApex.runTests(:runTestsRequest => rtr)

 Code above is pretty simple, just attempting to run a single test class with a one small unit test.

 

Problem is that this takes way longer to execute than it should.  This class executes in about 10 seconds in the browser but takes about half an hour to run as shown above from irb.

 

Anyone try to do something similar before?

Best Answer chosen by Admin (Salesforce Developers) 
WizradWizrad

Well I got things working.  The makeup of the soap envelope was not the issue.  For anyone interested, its what you would expect.

 

<runTests xmlns="http://soap.sforce.com/2006/08/apex">
  <apex xmlns:ns2="http://soap.sforce.com/2006/08/apex" xsi:type="ns2:RunTestsRequest">
    <allTests>true|false</allTests>
    <classes>MyClassName</classes>      
  </apex>																			 </runTests>

 

I guess ultimately runTests does not work for some reason or another when you generate ruby from the apex wsdl using the wsdl2ruby utility bundled with soap4r.

All Answers

WizradWizrad

I still haven't been able to figure this out.  Even on a test class without any unit tests, the request times out and locks up my org for half an hour with the "Org Administration Locked" error.

 

Other calls, such as compileClasses work properly.  Can someone provide an example of the soap envelope used for the runTests call?

WizradWizrad

Well I got things working.  The makeup of the soap envelope was not the issue.  For anyone interested, its what you would expect.

 

<runTests xmlns="http://soap.sforce.com/2006/08/apex">
  <apex xmlns:ns2="http://soap.sforce.com/2006/08/apex" xsi:type="ns2:RunTestsRequest">
    <allTests>true|false</allTests>
    <classes>MyClassName</classes>      
  </apex>																			 </runTests>

 

I guess ultimately runTests does not work for some reason or another when you generate ruby from the apex wsdl using the wsdl2ruby utility bundled with soap4r.

This was selected as the best answer