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
Jessica Miller 27Jessica Miller 27 

apex test class error when deploying changeset

Unfortuantely, I have an apex test class failure on a class that is from an appexchnage app that is unmanaged and so they wont be able to help. Does anyone know what this means?

System.Exception: Assertion Failed 
Stack Trace: Class.test_updatecontactrolecount.testcreateopptywithconditionandrole: line 38, column 1 

I went to line 38 of that class and it says: System.assert(false);
Best Answer chosen by Jessica Miller 27
Dilip_VDilip_V
38     //System.assert(false);
39     //System.assert();
40   }        

Make it as best answer if it helps.
Thanks!

All Answers

Dilip_VDilip_V
Jessica,

Comment your assertion statement if you got required coverage and try to deploy.

//System.assert();

Thanks.
Jessica Miller 27Jessica Miller 27
Hey Thermo,
Thanks for your reply. Sorry I'm not a developer so I want to make sure I know what I'm doing before I edit in sandbox. I edit the class in sandbox. Do you mean add this as a new line under line 38? Does it matter if there is a space under this new line/comment? There isn't one now. The next line right now is just }

Then I deply into production and it will replace what it's production? 

Thanks
Dilip_VDilip_V
Jesica,

Before commentting assertion statement(line no 4).
integer i = 0;
integer j = 1;
//this would throw an error  and cause your test to fail because i value not equel to j
System.assertEquals(i,j); 
//this would pass.because i value  equel to 1
System.assertNotEquals(1,i);
After Commenting assertion statement(line no 4).
 
integer i = 0;
integer j = 1;
//this would throw an error  and cause your test to fail 
//System.assertEquals(i,j);//No problem now
System.assertNotEquals(1,i);

Assertion statemens are used to cross check the results.
 
Here richi explained it well(Look at best answer).
https://developer.salesforce.com/forums/?id=906F00000008x42IAA
Thanks.



 
Jessica Miller 27Jessica Miller 27

Thanks for your help. Unfortunately my lack of experience in apex and code makes this difficult for me to understand and how I can make it relevant to the apex class I'm looking at. 

Below is what it was currently. Is your proposed fix the 2nd one? 

38    System.assert(false);
39   }

38     System.assert(false);
39     //System.assert();
40   }        

Thanks!
Dilip_VDilip_V
38     //System.assert(false);
39     //System.assert();
40   }        

Make it as best answer if it helps.
Thanks!
This was selected as the best answer
Jessica Miller 27Jessica Miller 27

Thank you so much. That fixed it!