+ Start a Discussion
Stuart Miles 25Stuart Miles 25 

test class for lightning component that displays a simple banner

Hi, can anyone please help me with creating a test class and js controller to display a simple banner on a lightning page? Complete novice here :-)

component:
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
    <img src="{!$Resource.Discussion_Banner}"/>
</aura:component>

thanks everyone
 
Best Answer chosen by Stuart Miles 25
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi Stuart,
No need to write test classes for lightning components.In salesforce we need to write test classes for apex classes and triggers  to test your business logic  and to ensure that your Apex classes and triggers work as expected.

Pleas  refer below link which might help you further
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_test.htm
https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards

All Answers

Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi Stuart,
No need to write test classes for lightning components.In salesforce we need to write test classes for apex classes and triggers  to test your business logic  and to ensure that your Apex classes and triggers work as expected.

Pleas  refer below link which might help you further
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_test.htm
https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards
This was selected as the best answer
linda wilson 8linda wilson 8
I don't know the proper answer but if you need any help you will contact to geek squad tech support (https://www.geektech.support/)
Stuart Miles 25Stuart Miles 25
Thanks Devi, i might have got confused here as i created a change set and pushed through changes to my partial sandbox for further testing - this required validating and it failed on code coverage. Having looked at the errors more closely these were due to missing test classes on existing triggers and classes. 
Deepali KulshresthaDeepali Kulshrestha
Hi Stuart,


Greetings to you!

I have gone through your query and I realized no need to write a test class for the lightning component, you can write a test class for related controller means apex class.


Please visit link for detailed explanation:

1. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_test.htm

2. https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro

     
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
 
Victor ZenVictor Zen

Devi Chandrika  
Hi Stuart,
No need to write test classes for lightning components.In salesforce we need to write test classes for apex classes and triggers  to test your business logic  and to ensure that your Apex classes and triggers work zen as expected.

Pleas  refer below link which might help you further
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_test.htmzen (https://onlinecasinozen.com/)
https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.





Thank you! This option is really works for me well.
Tempobet GirisTempobet Giris
Oww sorry i wrote false, u know about tempobet giris (https://tempobetgiris.linkbox.agency) ? can u tell me somethings ? becouse i need to learn this