2

The standard test class Milestone1_Email_Handler_Tst is causing problems when I attempt to deploy new code to our production system.

System.AssertException: Assertion Failed 
Stack Trace: Class.Milestone1_Email_Handler_Tst.testEmailWithAttachments: line 104, column 1

System.AssertException: Assertion Failed 
Stack Trace: Class.Milestone1_Email_Handler_Tst.testNoAliasWithDefaultMilestoneAlias: line 310, column 1

I've tried resolving the code errors but cannot seem to do so due to this same error. I've also attempted just deleting it to re-add it at a later time.

I cannot do either of these things as it runs the test as part of the deployment process and fails the whole process.

How can I make changes, or remove a malfunctioning test class in production?

Cody Beaner
  • 617
  • 3
  • 12
  • 29
  • 1
    Did you try commenting out the entire class (all but first and last lines), then deploying that file with your changes? – sfdcfox Mar 20 '15 at 19:23
  • This might help. http://salesforce.stackexchange.com/questions/23229/best-way-to-delete-unused-apex-classes-and-triggers-in-production – San Mar 20 '15 at 19:25
  • @San I had already seen that, and I'd like to stick to Force.com IDE, or just Salesforce if at all possible. While I'm not opposed to command line, I just do not have the time nor resources at the moment. – Cody Beaner Mar 20 '15 at 19:33
  • @sfdcfox Just did that now. Thanks for the suggestion. Now if only I knew why I was getting this error. – Cody Beaner Mar 20 '15 at 19:38

1 Answers1

3

There is a system.asset statement somewhere in your testclass that is failing. Meaning your expected and incoming test data is not matching. Debug it in Sandbox and find why there is a mismatch and you can easily change your test data to fix it.

Since i see there is a couple of assertion exceptions I feel this should be the ideal way to fix a test class issue.

Jaguar
  • 330
  • 1
  • 8
  • I understood that much, but knowing what the expected data is, and why it's not getting that is beyond my time frame right now. – Cody Beaner Mar 20 '15 at 19:40
  • Comment only the assert statements rerun; I mean comment the assert statements in the sandbox and deploy to production. So your production will consider the updated testclass and it should not fail. Hopefully your test coverage stays enough though. – Jaguar Mar 20 '15 at 19:43
  • We are seeing a case where when we deploy it seems to run the "old" test class, can you think of any reason this would be happening? – Joelio Feb 20 '20 at 00:24