function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BarryPlumBarryPlum 

Cannot deploy controller extension with 100% coverage

public class BusTicketExtension { private final BusTicket__c BusTicket; public BusTicketExtension (ApexPages.StandardController stdController) { this.BusTicket = (BusTicket__c)stdController.getRecord(); } public PageReference save() { insert(BusTicket); PageReference p = Page.NewSystemTicket; p.getParameters().put('msg','Thank you for submitting your ticket, someone will get back to you soon.'); p.setRedirect(true); return p; } public static testMethod void testBusTicketExtension() { PageReference pageRef = Page.NewSystemTicket; Test.setCurrentPage(pageRef); BusTicket__c bt = new BusTicket__c(system__c='Salesforce.com',category__c='access',title__c='MyTest'); ApexPages.StandardController btc = new ApexPages.Standardcontroller(bt); BusTicketExtension controller = new BusTicketExtension(btc); String nextPage = controller.save().getUrl(); System.assertEquals('/apex/newsystemticket?msg=Thank+you+for+submitting+your+ticket%2C+someone+will+get+back+to+you+soon.',nextPage); BusTicket__c t=[SELECT system__c FROM BusTicket__c WHERE createdDate = TODAY and title__c = 'MyTest' ]; System.assertEquals('Salesforce.com',t.system__c); } }

 I'm not really worried about the validity of the test, since the only reason I wrote the code was to support public submission to the custom object.  I've also written a VF page that's referenced in the above controller, so I can just ship them back to the input page with a message thanking them for their submission.

 

I have tried every different way I know of to deploy this code from a sandbox to production.  In my IDE AND in the sandbox org, running tests on the class pass with 100% test coverage.

 

I've tried running Deploy to server in the IDE

I've tried creating a Change Set.

 

Thanks in advance if anyone sees anything I'm missing.

 

Barry 

Best Answer chosen by Admin (Salesforce Developers) 
mtbclimbermtbclimber

One suggestion I was given by the Knowledge team is to uninstall the package containing the classes/pages with references to Salesforce Knowledge.

 

Did you install such a package? Can you uninstall it?

All Answers

mtbclimbermtbclimber
Is this test passing?
BarryPlumBarryPlum

Yes...

 

Apex Test Result

Summary

 
Test ClassBusTicketExtension
Tests Run1
Test Failures0
Code Coverage Total %100
Total Time (ms)81.0

Test Successes

 
Method Name
Total Time (ms)
BusTicketExtension.testBusTicketExtension81.0

Code Coverage

 
Hide Section - Class Code Coverage

Class Code Coverage

Class Name
Coverage %
BusTicketExtension100

 

mtbclimbermtbclimber
Ok. Are you getting an error when the deployment completes? If so what is it?
BarryPlumBarryPlum

From the Force.com IDE, I:

Select the class and "Deploy to server"

Log in

On the Deployment Plan (step 3 of 4), I see my one class there, with the Add action and checked

I click Validate Deployment

I get a FAILED response... Here is the summary log:

*** Deployment Log ***

Result: FAILED

Date: February 26, 2010 8:26:01 AM PST

 

# Deployed From:

   Project name: Tableau Full Sandbox

   Username: bplum@tableausoftware.com.full

   Endpoint: test.salesforce.com

 

# Deployed To:

   Username: bplum@tableausoftware.com

   Endpoint: www.salesforce.com

 

# Deploy Results:

   File Name:    classes/BusTicketExtension.cls

   Full Name:  BusTicketExtension

   Action:  UPDATED

   Result:  SUCCESS

   Problem: n/a

 

   File Name:    package.xml

   Full Name:  package.xml

   Action:  UPDATED

   Result:  SUCCESS

   Problem: n/a

 

# Test Results:

 

Run Failures:

  KnowledgeController.null line -1, column -1: Dependent class is invalid and needs recompilation:

knowledgecontroller: line 292, column 16: No such column 'permissionsviewknowledge' on entity 'Profile'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

  KnowledgeControllerTest.null line -1, column -1: Previous load of class failed: knowledgecontroller

  makeTAC.null line -1, column -1: Previous load of class failed: knowledgecontroller

  mrPDFhandler.null line -1, column -1: Previous load of class failed: knowledgecontroller

  myContractController.null line -1, column -1: Previous load of class failed: knowledgecontroller

  myContractControllerTest.null line -1, column -1: Previous load of class failed: knowledgecontroller

  nullTaskType.null line -1, column -1: Previous load of class failed: knowledgecontroller

  orderedLineItems.null line -1, column -1: Previous load of class failed: knowledgecontroller

  orderedLintItemsTest.null line -1, column -1: Previous load of class failed: knowledgecontroller

  QuoteControllerExt.null line -1, column -1: Previous load of class failed: knowledgecontroller

  quoteExt.null line -1, column -1: Previous load of class failed: knowledgecontroller

  quoteExtTests.null line -1, column -1: Previous load of class failed: knowledgecontroller

  regOppMatchTest.null line -1, column -1: Previous load of class failed: knowledgecontroller

  SiteLoginController.null line -1, column -1: Previous load of class failed: knowledgecontroller

  SiteRegisterController.null line -1, column -1: Previous load of class failed: knowledgecontroller

  testAccountHierarchy.null line -1, column -1: Previous load of class failed: knowledgecontroller

  regOppMatch Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required

  myTAC Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required

  nullTaskType Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required

  Average test coverage across all Apex Classes and Triggers is 0%, at least 75% test coverage is required 

 

I think, OK, maybe it will work... even though it looks like my package.xml is screwed up...

So, I click Next

Then I get another FAILED response

Summary Log:

*** Deployment Log ***

Result: FAILED

Date: February 26, 2010 8:29:59 AM PST

 

# Deployed From:

   Project name: Tableau Full Sandbox

   Username: bplum@tableausoftware.com.full

   Endpoint: test.salesforce.com

 

# Deployed To:

   Username: bplum@tableausoftware.com

   Endpoint: www.salesforce.com

 

# Deploy Results:

   File Name:    classes/BusTicketExtension.cls

   Full Name:  BusTicketExtension

   Action:  UPDATED

   Result:  SUCCESS

   Problem: n/a

 

   File Name:    package.xml

   Full Name:  package.xml

   Action:  UPDATED

   Result:  SUCCESS

   Problem: n/a

 

# Test Results:

 

Run Failures:

  KnowledgeController.null line -1, column -1: Dependent class is invalid and needs recompilation:

knowledgecontroller: line 292, column 16: No such column 'permissionsviewknowledge' on entity 'Profile'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

  KnowledgeControllerTest.null line -1, column -1: Previous load of class failed: knowledgecontroller

  makeTAC.null line -1, column -1: Previous load of class failed: knowledgecontroller

  mrPDFhandler.null line -1, column -1: Previous load of class failed: knowledgecontroller

  myContractController.null line -1, column -1: Previous load of class failed: knowledgecontroller

  myContractControllerTest.null line -1, column -1: Previous load of class failed: knowledgecontroller

  nullTaskType.null line -1, column -1: Previous load of class failed: knowledgecontroller

  orderedLineItems.null line -1, column -1: Previous load of class failed: knowledgecontroller

  orderedLintItemsTest.null line -1, column -1: Previous load of class failed: knowledgecontroller

  QuoteControllerExt.null line -1, column -1: Previous load of class failed: knowledgecontroller

  quoteExt.null line -1, column -1: Previous load of class failed: knowledgecontroller

  quoteExtTests.null line -1, column -1: Previous load of class failed: knowledgecontroller

  regOppMatchTest.null line -1, column -1: Previous load of class failed: knowledgecontroller

  SiteLoginController.null line -1, column -1: Previous load of class failed: knowledgecontroller

  SiteRegisterController.null line -1, column -1: Previous load of class failed: knowledgecontroller

  testAccountHierarchy.null line -1, column -1: Previous load of class failed: knowledgecontroller

  regOppMatch Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required

  myTAC Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required

  nullTaskType Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required

  Average test coverage across all Apex Classes and Triggers is 0%, at least 75% test coverage is required

 

Even though it says it was successful, I think it rolled back the changes since the package.xml file is messed up... I don't know if I can/should edit that or what? 

mtbclimbermtbclimber

This may be easy to fix ( <fingersCrossed/> ). It looks like your code is dependent on a permission that isn't available in this sandbox - Knowledge Base, perhaps?   Make sure this sandbox is set up correctly for the code you are trying to deploy or that something hasn't changed in your sandbox to make that go away.

 

If that doesn't work and the  "knowledgecontroller" apex class is already *in* your sandbox then you'll probably need to log a case.  Let me know what the case number is if it comes to that.

 

By the way, this has nothing to do with the controller extension class you are trying to deploy. It's fine.

Message Edited by mtbclimber on 02-26-2010 08:40 AM
BarryPlumBarryPlum

Interesting... the knowledge class is in my sandbox, so I'm not sure what the issue would be.  And the object is completely new and has no dependencies outside itself.  It has a lookup field to the Idea object, but nothing to do with knowledge.  I don't think we are even licensed for that anymore.

 

I opened a ticket after I searched the boards and couldn't find anything like this out here and posted this.  I figured I'd work them in parallel, but you've been much faster than my premier support...  ;)

 

Here is the ticket number: 3348457

 

Thanks Andrew! 

mtbclimbermtbclimber

Glad I could help. Sorry about the situation.

 

I think your options are going to be to either wait for salesforce.com to fix the provisioning related issues (not breaking your code because you are no longer licensed) or remove your dependencies.  The latter being both in your control and I suspect faster to resolution.

 

This would involve removing the offending class(es) and any pages that reference artifacts of Salesforce Knowledge that you don't have access to since you've become unlicensed for them.

mtbclimbermtbclimber

One suggestion I was given by the Knowledge team is to uninstall the package containing the classes/pages with references to Salesforce Knowledge.

 

Did you install such a package? Can you uninstall it?

This was selected as the best answer
BarryPlumBarryPlum

It went beyond the Knowledge controller class.  I uninstalled that app and then there was an error about another class.  Luckily, that one wasn't in use either, so I was able to delete them from the sandbox and production and I was finally able to publish the class.

 

I still don't understand WHY though.  The class did not touch any of those other objects or classes, why would it conflict like that? 

mtbclimbermtbclimber

Glad to see you are back in shape. Please close your case if you have a chance.

 

There is a fundamental issue with the way the system behaves when your license to Salesforce Knowledge expires.  We should not have broken your code when that event occurred.  We're working on it.

 

Thanks for your patience.

VishalAscVishalAsc

Hi,

I have run into similar issue.

Getting error "Previous load of class failed: <<classname>>"

This class is from an installed package.

 

Do you suggest me to uninstall this package and try to install again after deployment?

 

Would there be any data loss if I uninstall the package and install it again?

I do see to be a bit risky.

Harika ZillaHarika Zilla

Hi,

 

Iam getting error when i run test class.

 

Error: line -1, column -1: Previous load of class failed: edp1|processor

 

Here "edp1|processor" is an installed package.

Is there any way to prevent this error?

 

Thanks,

Harika