Happy Business Starts Here

Remove Zuora error on Salesforce unit tests

Is there anyway to avoid the Zuora error in Salesforce unit tests that states "Please upload Zuora WSDL at first" without having to use the @isTest(SeeAllData=true) attribute? Salesforce best practices are to not use SeeAllData=true. Using SeeAllData has the potential to create other issues when testing which I'm trying to avoid.

To generate the error I simply need to attempt to create a dummy Zuora object within the context of a test

Zuora.zObject zCharge = new Zuora.zObject('RatePlanCharge');


Is there anything else I can do to prevent this error? "Please upload Zuora WSDL at first"

How does one avoid this bug if it's not really a bug but what looks like bad design?

22 Comments

I would love to see a programmatic way to upload the zuora wsdl that makes things easy to test.

 

That said, perhaps there is a work around that makes this not necessary? If we could get details on where the zuora wsdl is saved when uploaded we could have each of our tests to that and store the wsdl in a static resource for later test usage. It'd require a bit of work when new fields are added, but that'd be just an exercise is copying what is stored currently into the static resource when tests start failing. This approach saves Zuora from having to add new feature, and saves Zuora Salesforce customers from having to use seeAllData with any tests that touch zuora callouts.

 

Anyone at zuora have this information and could post to this thread?

Guru

@ralphcallaway glad to see you join this discussion.

 

I have been trying for years to get answers to this and other issues concerning unit testing in Salesforce where the Apex code is calling into Zuora for Salesforce. The predominate answer I have asked for is documentation on how the Z for S code behaves under test.  I have provided numerous examples of specifically what a developer needs to know.

 

I have painstakingly gone through a refactor where zobjects are never created in my code while it is running under test, yet I still get the wsdl error!!! even when calling zqu.zQuoteUtil.getChargeGroups(). 

 

This is beyond frustrating because if I use SeeAllData=false I find some Zuora code swallows some of the wsdl exceptions in their code. SeeAllData=true means I cannot write any tests with a renewal quote since Z for S adds charges of each type to my quote.

 

 

@nathanc Will there be any work in your group to remove the dependence on the WSDL in your groups code.  Just simply moving the wsdl into Custom Metadata would solve this.

this idea has been under consideration for several years, is there any real plan to address this? not looking for a big fix, just a workaround that allows us to write unit tests without seealldata

 

very frustrating to see this just dangling here with no communication

all we need is some details about where the zuora wsdl is stored and we can work around this ourselves ...

Savvy Scholar

It's got to be in a protected object, right? The only way I know to see it is by using the zSchemaSetup visualforce page.

Zuora Alumni

All, I've raised this with Engineering and it will be considered for the September/October release of 360 package.  Will update more when they confirm a solution.

 

 

@nathanc that's awesome, fingers crossed it gets on the backlog.

 

short term, are there any details you can provide about where the zuora wsdl is stored? that would let us work around the issue while we're waiting on an official fix ...

Guru

@ralphcallaway It is stored in a protected space that you cannot get to outside of the managed package interface currently. This is why we asked @nathanc for some official API or method to add it during testing.

Scholar

@nathanc any update here?

Guru

@doyeli  @eric-neto any update?

 I think Nathan is no longer at Zuora.