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
Jordan VasquezJordan Vasquez 

Deployment fails without a trace flag enabled?

Hello everyone,

I am experiencing a very interesting problem that I have never encountered before.

I am trying to deploy a change set to my Production org that contians updated Apex code. When testing the updated code in my sandbox environment everything works. When I attempt to deploy though I am getting Assertion failures in my test class. 

To look a bit more into what is going on I enabled Debug Logs for my user and only ran validation on the test class that was failing and it was now passing! I then disabled my debug logs and reran just that one test and it failed. So it seems like my test classes only pass when there is some type of trace flag enabled?

Does anybody know why this could be happening? This particular test class tests an apex class that makes callouts to a 3rd party system. I use System.assert() to validate information that I expect from a HttpMock class that I wrote. It is just odd to me that it only passes with a trace flag of some kind enabled.

Thanks!
Khan AnasKhan Anas (Salesforce Developers) 
Hi Jordan,

Greetings to you!

Please refer to the below links with a similar discussion which might help you further with the above issue.

https://developer.salesforce.com/forums/?id=9060G000000UUsxQAG

https://developer.salesforce.com/forums/?id=906F00000008zFcIAI

https://salesforce.stackexchange.com/questions/222890/system-assertexception-assertion-failed

https://developer.salesforce.com/forums/?id=906F0000000g32EIAQ

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas