I'm trying to deploy a change set with one updated class to production. When I run Deploy it fails because an assertion failure in some other class in my org. When I run Validation only it passes with no errors and when I run all tests in my production org I get no errors as well.

Any idea why I get the failure only on deployment?

  • What causes the deploy to fail? You can click the "View Results" next to the deployed change set to see what goes wrong. – pjcarly May 12 '13 at 9:50
  • @PJC3 as I wrote some assertion failure in some other class in my org. – Dedo May 12 '13 at 13:24
  • If you run the existing test class independently (the one that has the assertion failure during deployment), does it still have the same assertion failure? If so, it could be a case where there's a problem with that class which needs fixed and SF is "forcing" you to fix it with this deployment. IAC, you need to explore what the source of the assertion failure is. – crmprogdev May 12 '13 at 13:39
  • When I run the test independently of the deployment it passes. Only during full deployment it fails. – Dedo May 13 '13 at 8:04

It's probably because when the failing test class was written it was done using the properties of the person that wrote it (probably something off his user record or something he has access to and you don't). Now that you're deploying your code, that class is being tested as you, and you didn't match his test class for whatever reason.

If this is the case, change that test class to use the RunAs method. Here is some documentation that should help. http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_tools_runas.htm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.