SlideShare a Scribd company logo
Joomla! JavaScript Testing
Hello!
I am Ruchiranga
Computer Science and Engineering
undergraduate at University of
Moratuwa, Sri Lanka.
GSoC ‘16 student at Joomla!
You can find me at:
@thanurw
Project mentors
Yves Hoppe Ashan Fernando
1.
What is Software Testing
In a broad sense
“Testing is the process of evaluating
a system or its component(s) with
the intent to find whether it
satisfies the specified requirements
or not.
Source: www.tutorialspoint.com/software_testing
Benefits
▷ Proof of functionality
▷ Confidence
▷ Early fault detection
▷ Reduced rework &
cost
▷ No “works for me,
dunno about you”
Drawbacks
▷ Cannot show
absence of faults
▷ Setup overhead
▷ Need to write
testable code
▷ Covers only the code
2.
Testing in Joomla!
What has been there so far
Code distribution
joomla-cms/tests/unit
https://github.com/joomla/joomla-cms/tree/staging/tests/unit
Travis log
7872 different tests and 10266 assertions so far
3.
JavaScript Testing
Why bother?
A real world example
https://issues.joomla.org/tracker/joomla-cms/10259
Joomla! JavaScript Testing
Commit made in 2014
Issue found in 2016!
“To err is human, to forgive is divine
IF we had JS tests
▷The issue would have been found
in 2014
▷The issue would have been solved
in 2014
▷This issue post will not appear in
2016
▷A lot of time and effort could have
been saved!
4.
Joomla! JavaScript Testing
Project
What have we achieved so far?
Jasmine for the rescue!
Jasmine as the testing framework
The Technology stack
▷Jasmine Framework
▷Karma test runner
▷Travis CI
And some more...
▷jQuery
▷Jasmine jQuery
▷RequireJS
▷RequireJS Text
▷Karma coverage reporter
Our process is easy
JS tests written using
Jasmine
Run with Karma
locally
Run on Travis
Tests written using Jasmine
Tests run locally using Karma
Tests run on Travis
Joomla! JavaScript Testing
Covered 10 libraries so far
Found in joomla-cms/media/system/js/ directory
File hierarchy
karma.conf.js
tests
javascript
caption
package.json
test-main.js
fixtures
spec-setup.js
spec.js
fixture.html
Inside
▷ Fixtures
▷ Spec-setup.js
▷ spec.js
Running the tests locally
▷Clone the repository
▷Open a CMD window
▷Navigate to tests/javascript
▷Execute command npm install
▷Execute command npm test
Need to have NodeJS installed
Joomla! JavaScript Testing
5.
Joomla! JavaScript Testing
The magic inside!
Karma configuration
▷Which files to be served, included in
browser and watched
▷Configurations : plugins, reporters etc.
▷Single run or not
More on what happens inside...
▷Karma loads all specified files,
delegates specific inclusions to
require.js (test-main.js)
▷Require.js dynamically handle
dependencies; both code & fixtures
Require.js configuration
▷test-main.js found in tests/javascript
▷Allow specification of aliases for
different paths and files
▷Allows specification of dependencies
among them
6.
Let’s see a demonstration
How to write JavaScript tests
Joomla! JavaScript Testing
7.
Documentation
https://docs.joomla.org/Running_Automated_Tests_for
_the_Joomla_CMS
7.
Is your code testable?
How to write testable code
Is this testable?
(function ($) {
var testable = false;
if (testable) {
$('#content').html("Go home");
} else {
$('#content').html("You are drunk");
}
})(jQuery)
How about this?
$(document).ready(function ($) {
$('#content').hide();
});
8.
An open invitation
For all of you
Joomla! JavaScript Testing
Thanks!
Any questions?
You can find me at:
@thanurw
truchiranga@gmail.com

More Related Content

What's hot (20)

PDF
vodQA Pune (2019) - Browser automation using dev tools
vodQA
 
PPTX
Codeception @ New Business Dept Adira Finance
Fachrul Choliluddin
 
PPTX
JavaScript Unit Testing
L&T Technology Services Limited
 
PDF
Java Beginners Meetup February 2017: Testing and TDD
Patrick Kostjens
 
PDF
Test your Javascript! v1.1
Eric Wendelin
 
PPTX
TDD in Go with Ginkgo and Gomega
Eddy Reyes
 
PPTX
TDD er død. Lenge leve TDD!
Kjetil Klaussen
 
PPTX
TDD Setup With Jasmine
PeterKha2
 
PPTX
Unit testing for User Interfaces
webmull
 
PDF
Cypress - Best Practices
Brian Mann
 
ZIP
Five Easy Ways to QA Your Drupal Site
Mediacurrent
 
PDF
Testing and symfony2
The Software House
 
PDF
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
Gavin Pickin
 
PPTX
Obejct Oriented SCM - OOSCM
Hernan Wilkinson
 
PDF
Automated testing in Drupal
Artem Berdishev
 
ODP
Neo4j Graph Database, from PHP
Louis-Philippe Huberdeau
 
PDF
Microsoft 98-388 Exam Dumps Questions
Braindumps4IT
 
PPTX
Progressive Web App Testing With Cypress.io
Knoldus Inc.
 
PPTX
Nascenia: Road to Software Industry
Nascenia IT
 
PDF
Drulenium - Testing Made Easy
nyccamp
 
vodQA Pune (2019) - Browser automation using dev tools
vodQA
 
Codeception @ New Business Dept Adira Finance
Fachrul Choliluddin
 
JavaScript Unit Testing
L&T Technology Services Limited
 
Java Beginners Meetup February 2017: Testing and TDD
Patrick Kostjens
 
Test your Javascript! v1.1
Eric Wendelin
 
TDD in Go with Ginkgo and Gomega
Eddy Reyes
 
TDD er død. Lenge leve TDD!
Kjetil Klaussen
 
TDD Setup With Jasmine
PeterKha2
 
Unit testing for User Interfaces
webmull
 
Cypress - Best Practices
Brian Mann
 
Five Easy Ways to QA Your Drupal Site
Mediacurrent
 
Testing and symfony2
The Software House
 
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
Gavin Pickin
 
Obejct Oriented SCM - OOSCM
Hernan Wilkinson
 
Automated testing in Drupal
Artem Berdishev
 
Neo4j Graph Database, from PHP
Louis-Philippe Huberdeau
 
Microsoft 98-388 Exam Dumps Questions
Braindumps4IT
 
Progressive Web App Testing With Cypress.io
Knoldus Inc.
 
Nascenia: Road to Software Industry
Nascenia IT
 
Drulenium - Testing Made Easy
nyccamp
 

Similar to Joomla! JavaScript Testing (20)

PPTX
Joomla! Testing - J!DD Germany 2016
Yves Hoppe
 
PPT
Lessons Learned in a Continuously Developing Service-Oriented Architecture
mdwheele
 
PPTX
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
Cωνσtantίnoς Giannoulis
 
PPTX
Testing Ext JS and Sencha Touch
Mats Bryntse
 
PPTX
Cypress for Testing
PoojaSingh1123
 
PPTX
Java script unit testing
Mats Bryntse
 
PPTX
Containerize your Blackbox tests
Kevin Beeman
 
PDF
TDD for joomla extensions
Roberto Segura
 
PPTX
Autotests introduction - Codeception + PHP Basics
Artur Babyuk
 
PPTX
Unit testing
PiXeL16
 
PPTX
J meter
testhive
 
PPTX
How we tested our code "Google way"
Oleksiy Rezchykov
 
PDF
Efficient JavaScript Unit Testing, May 2012
Hazem Saleh
 
PDF
Testing - How Vital and How Easy to use
Uma Ghotikar
 
PPT
Pragmatic Parallels: Java and JavaScript
davejohnson
 
PDF
JAVASCRIPT Test Driven Development & Jasmine
Anup Singh
 
PDF
JavaOne 2016: Life after Modularity
DanHeidinga
 
PPTX
Dot all 2019 | Testing with Craft | Giel Tettelar
Giel Tettelaar
 
PPTX
Automated Acceptance Tests & Tool choice
toddbr
 
PPTX
Perofrmance testing and apache jmeter
lethibichhoa
 
Joomla! Testing - J!DD Germany 2016
Yves Hoppe
 
Lessons Learned in a Continuously Developing Service-Oriented Architecture
mdwheele
 
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
Cωνσtantίnoς Giannoulis
 
Testing Ext JS and Sencha Touch
Mats Bryntse
 
Cypress for Testing
PoojaSingh1123
 
Java script unit testing
Mats Bryntse
 
Containerize your Blackbox tests
Kevin Beeman
 
TDD for joomla extensions
Roberto Segura
 
Autotests introduction - Codeception + PHP Basics
Artur Babyuk
 
Unit testing
PiXeL16
 
J meter
testhive
 
How we tested our code "Google way"
Oleksiy Rezchykov
 
Efficient JavaScript Unit Testing, May 2012
Hazem Saleh
 
Testing - How Vital and How Easy to use
Uma Ghotikar
 
Pragmatic Parallels: Java and JavaScript
davejohnson
 
JAVASCRIPT Test Driven Development & Jasmine
Anup Singh
 
JavaOne 2016: Life after Modularity
DanHeidinga
 
Dot all 2019 | Testing with Craft | Giel Tettelar
Giel Tettelaar
 
Automated Acceptance Tests & Tool choice
toddbr
 
Perofrmance testing and apache jmeter
lethibichhoa
 
Ad

Recently uploaded (20)

PDF
Our Guide to the July 2025 USPS® Rate Change
Postal Advocate Inc.
 
PPTX
2025 Completing the Pre-SET Plan Form.pptx
mansk2
 
PPTX
How to use grouped() method in Odoo 18 - Odoo Slides
Celine George
 
PDF
The Power of Compound Interest (Stanford Initiative for Financial Decision-Ma...
Stanford IFDM
 
PDF
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
PPTX
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
PDF
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
PDF
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
PDF
Supply Chain Security A Comprehensive Approach 1st Edition Arthur G. Arway
rxgnika452
 
PPTX
Photo chemistry Power Point Presentation
mprpgcwa2024
 
PDF
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
KaryanaTantri21
 
PDF
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
PPTX
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 
PPTX
Comparing Translational and Rotational Motion.pptx
AngeliqueTolentinoDe
 
PPTX
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
DOCX
ANNOTATION on objective 10 on pmes 2022-2025
joviejanesegundo1
 
PDF
Learning Styles Inventory for Senior High School Students
Thelma Villaflores
 
PDF
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
PPTX
Elo the HeroTHIS IS A STORY ABOUT A BOY WHO SAVED A LITTLE GOAT .pptx
JoyIPanos
 
PPTX
JSON, XML and Data Science introduction.pptx
Ramakrishna Reddy Bijjam
 
Our Guide to the July 2025 USPS® Rate Change
Postal Advocate Inc.
 
2025 Completing the Pre-SET Plan Form.pptx
mansk2
 
How to use grouped() method in Odoo 18 - Odoo Slides
Celine George
 
The Power of Compound Interest (Stanford Initiative for Financial Decision-Ma...
Stanford IFDM
 
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
Supply Chain Security A Comprehensive Approach 1st Edition Arthur G. Arway
rxgnika452
 
Photo chemistry Power Point Presentation
mprpgcwa2024
 
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
KaryanaTantri21
 
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 
Comparing Translational and Rotational Motion.pptx
AngeliqueTolentinoDe
 
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
ANNOTATION on objective 10 on pmes 2022-2025
joviejanesegundo1
 
Learning Styles Inventory for Senior High School Students
Thelma Villaflores
 
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
Elo the HeroTHIS IS A STORY ABOUT A BOY WHO SAVED A LITTLE GOAT .pptx
JoyIPanos
 
JSON, XML and Data Science introduction.pptx
Ramakrishna Reddy Bijjam
 
Ad

Joomla! JavaScript Testing

Editor's Notes

  • #8: Can never prove its fault proof. There is always the possibility that we missed a test case Research on suitable testing framework and writing the first test case with the setup and all that takes some time Divided focus. Cannot only focus on business logic. Code should be testable. Code is not the only thing that is responsible for the quality of a product. There is the context and the process as well.
  • #10: Nearly 7% js
  • #13: Take content from the magazine plus general advantages of testing
  • #17: The famous saying.. The forgive part does not really apply here. But the point is it is human nature to make mistakes. Its really hard to make sure the we have considered every possible way our actions can influence something else. Its natural that you break something unknowingly
  • #19: About the setup - show process diagram Show file structure Some archi diag Screenshots if any Run and show the local tests execution Code got merged -- the meme Travis setup Travis sceeen shots
  • #20: The first step of the project - research on the possible candidates
  • #29: Root contains karma.conf.js Rest found in tests/javascript Each folder inside, represents a JS library Package.json and test-main.js on the same level
  • #33: In detail explaination of all the files and how things are put together
  • #37: The demo Clone new repo Write a js code - have something written Write new tests Push and show travis running