1 / 10

LIGHTNING COMPONENT TESTING WITH JASMINE

Jasmine is a behaviour-driven development framework - that is used for the purpose of testing Javascript code. If Jasmine is adopted for testing of Lightning components, then there are obviously some advantages for this. Let us throw some light on the advantages:<br><br>What are the Advantages ?<br><br>Some advantages that Jasmine offers are:<br><br>It is built easy to set up and it is possible to set up in any scenario<br>It has no requirement for DOM<br>It has no dependency on any other Javascript framework<br>It helps to write tests in easy steps because it comes with clean syntax<br><br>

davidcarter
Download Presentation

LIGHTNING COMPONENT TESTING WITH JASMINE

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Jasmine is a behaviour-driven development framework - that is used for the purpose of testing Javascript code. • Lightning Component Testing with Jasmine cloud.analogy info@cloudanalogy.com +1(415)830-3899

  2. What are the Advantages ? Some advantages that Jasmine offers are: • It is built easy to set up and it is possible to set up in any scenario • It has no requirement for DOM • It has no dependency on any other Javascript framework • It helps to write tests in easy steps because it comes with clean syntax cloud.analogy info@cloudanalogy.com +1(415)830-3899

  3. What is lightning Test Services? Salesforce has come with a new concept Lightning Test Services(LTS). LTS is a set of tools and services- that create test suites for these Lightning components.It helps in the validation of the client-side behaviour of these components. cloud.analogy info@cloudanalogy.com +1(415)830-3899

  4. You can install LTS in your Salesforce org in the following two ways: • As an unmanaged package • Install LTS by using a command in Salesforce Developer Experience(SFDX) cloud.analogy info@cloudanalogy.com +1(415)830-3899

  5. Steps to follow for installing Jasmine We need to follow the following steps for installing Jasmine and use it for further testing the Lightning components 1. Installation of Jasmine with the above SFDX command: sfdx force:lightning:test:install cloud.analogy info@cloudanalogy.com +1(415)830-3899

  6. 2. Once the installation is completed, you can start to navigate in your browser - so as to open the Jasmine test runner page. sfdx force:org:open -p /c/jasmineTests.app 3. Next, Lightning component is to be used by Lightning Test Service (LTS). cloud.analogy info@cloudanalogy.com +1(415)830-3899

  7. 4. Now we need to create a Javascript file containing Jasmine test method and upload it as a static resource. 5. This static resource then gets uploaded in Salesforce named as JasmineTestDatatable. The reference to this app has to be added to the static resource in JasmineTests.app. cloud.analogy info@cloudanalogy.com +1(415)830-3899

  8. 6. Finally, the Jasmine Test Runner is opened with the following URL. https://<YourDomain>.lightning.force.com/c/jasmineTests.app. This will show the output of the testing in the form of which test passed and which of the tests failed. It also displays the pass and fail percentages. cloud.analogy info@cloudanalogy.com +1(415)830-3899

  9. 7. Also the SFDX commands can be used to create a Lightning test with a basic template, by using the following commands: Sfdx:force:lightning:test:create cloud.analogy info@cloudanalogy.com +1(415)830-3899

  10. Thank You cloud.analogy info@cloudanalogy.com +1(415)830-3899

More Related