0

I have the following class which I put into a Contact trigger and in sandbox it gets 100% coverage. However, I can't deploy to prod with the Contact Test class. (0% code coverage) I wrote a test class for it but I get an error. Trigger:

@isTest  
public class RecursiveTests {

    @isTest
    static void testRecursive() {

        system.assert(CheckRecursive.runOnce());

        system.assert(!CheckRecursive.runOnce());
        system.assert(!CheckRecursive.runOnce());
        system.assert(!CheckRecursive.runOnce());
    }
}'
1

It means you should be using CheckRecursive.runOnce instead of cr.runOnce.

system.assert(CheckRecursive.runOnce());
system.assert(!CheckRecursive.runOnce());
8
  • Thanks, sfdcfox! I'm now getting the following error: Compile Error: Illegal variable declaration: system.assert at line 8 column 9 I have updated the code in my original question.
    – SarahO
    Oct 4 '16 at 19:12
  • I didn't realize he answered this one. Why did you add that first line in your test? Of course it won't compile. Just remove that line entirely.
    – Adrian Larson
    Oct 4 '16 at 19:19
  • Now I can't see his comment, sorry. Ok, I think I've redone this so many times, I'm confused. I have updated my code again.
    – SarahO
    Oct 4 '16 at 19:24
  • I'm telling you, remove that first line that contains only CheckRecursive.runOnce. It's nonsense.
    – Adrian Larson
    Oct 4 '16 at 19:25
  • Got it, I pasted that junk in, thank you so much @Adrian Larson! No I have 0 test methods and my once 100% class shows 0%. Ugh.
    – SarahO
    Oct 4 '16 at 19:26

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.