0

I am facing issue in writing test class that has 1 method which only executed when the lightning buttons get clicked.please suggest on this issue. Any help would be appreciated.

  • what is the issue? if you have written code for test method post that along with class code – Manjot Singh Jul 14 '17 at 13:03
3

You test an @AuraEnabled by calling it directly from your test:

public YourClass {
    @AuraEnabled
    public static String doSomething() {
        ...
    }
}

@IsTest
private YourClassTest {
    @IsTest
    static void testDoSomething() {
        System.assertEquals('...', YourClass.doSomething());
        ...
    }
}

The serialization to and from the client parts is handled by the platform and does not need to be tested by you.

Only if your @AuraEnabled method makes its own HTTP callouts would also need to setup a HttpCalloutMock.

  • @auraenabled public void getAllinfo(){ public void getCalloutsMethods(){} public void getButtonClickMethod(){}}@auraenabled public void getButtonClickMethod(){} But I am using this method inside a method.Can you help me on this. – emy Jul 18 '17 at 7:00

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.