SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
TDD in CQ5/AEM
Sagar Sane
What’s on the plate?
● What is Test driven development (TDD)?
● Why TDD / BDD?
● CQ backend and Spock testing framework
● Live code
Not on the plate
● Advanced testing techniques
○ Features of Spock Framework
● Much about testing your UI / JS
● Software Consultant II / Tech lead
● WEM Consultant
○ Backend development
○ Comfortable with Java (/JSP) and Groovy
● I don’t dislike front-end development :-)
About me
I became a programmer because of the
‘science’ in programming,
but, I remained a programmer because of the
‘art’ in programming.
I believe..
Some people have very strong opinions about this...
No, REALLY!
Test Driven Development
● Write Test First (extreme programming)
○ Technical meaning
○ Design your code around the tests
● Write a lot of tests
○ Milder approach
What is a Unit Test in CQ/AEM?
Benefits of Testing
● Find bugs early
● Make it easy for a new person on your
project
○ Read the tests if you don’t understand the code
● Improve code quality
Benefits of Testing
● Helps during code re-factoring
● A good test is worth a thousand comments
● Executable documentation
BDD
● Behavior Driven Development
● Writing tests from the customer’s /
stakeholder’s point of view
● It really is TDD done well!
● More expressive than TDD
//Variables
expected, v1, v2, ..
//Execute feature
actual = System.executeFeature(v1, v2, ..)
//The system gives output as expected
assert actual == expected
CQ/AEM and Spock
● What is Spock Framework? [ link ]
● Why is it awesome? [ link ] [ link ]
○ Is beautiful
● It can be used to test your CQ/AEM
backend!
A basic Spock Feature
//Spock ‘feature’
def "My component should just work"() {
given:
final variables = [ //initial conditions ]
final expected = new MyComponent(...)
when:
final actual = MyComponent.create(variables)
then:
actual == expected
}
Time for some real code...
What ‘new’ will we see?
● Mocks in spock
● setupSpec(), cleanupSpec()
● @Ignore(), @Shared
What all can you do?
● Unit tests for servlets, services
● Integration tests
● Functional tests for your rest APIs
● Even UI tests! (with Geb)
What all can you do?
Test Automation
Where to go from here?
● Don’t have to start big
● Add tests to the code that is important,
needs change
● Start new implementations with TDD
The art of programming!
Thank you!

Contenu connexe

Tendances

Tendances (20)

Test Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and CucumberTest Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and Cucumber
 
Integration Testing in AEM
Integration Testing in AEMIntegration Testing in AEM
Integration Testing in AEM
 
Polyglot engineering
Polyglot engineeringPolyglot engineering
Polyglot engineering
 
Getting Started With Cypress
Getting Started With CypressGetting Started With Cypress
Getting Started With Cypress
 
Test Automation With Cucumber JVM, Selenium, and Mocha
Test Automation With Cucumber JVM, Selenium, and MochaTest Automation With Cucumber JVM, Selenium, and Mocha
Test Automation With Cucumber JVM, Selenium, and Mocha
 
Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
 
Cucumber BDD
Cucumber BDDCucumber BDD
Cucumber BDD
 
Bdd – with cucumber and gherkin
Bdd – with cucumber and gherkinBdd – with cucumber and gherkin
Bdd – with cucumber and gherkin
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Lean Quality & Engineering
Lean Quality & EngineeringLean Quality & Engineering
Lean Quality & Engineering
 
Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)
 
Bdd with Cucumber and Mocha
Bdd with Cucumber and MochaBdd with Cucumber and Mocha
Bdd with Cucumber and Mocha
 
Role of Automation in Testing
Role of Automation in TestingRole of Automation in Testing
Role of Automation in Testing
 
Automation test framework with cucumber – BDD
Automation test framework with cucumber – BDDAutomation test framework with cucumber – BDD
Automation test framework with cucumber – BDD
 
Refactoring page objects The Screenplay Pattern
Refactoring page objects   The Screenplay Pattern Refactoring page objects   The Screenplay Pattern
Refactoring page objects The Screenplay Pattern
 
Bulletproof design systems using storybook
Bulletproof design systems using storybookBulletproof design systems using storybook
Bulletproof design systems using storybook
 
Contributing to open source
Contributing to open sourceContributing to open source
Contributing to open source
 
What’s new in Visual Studio 2012 & .NET 4.5
What’s new in Visual Studio 2012 & .NET 4.5What’s new in Visual Studio 2012 & .NET 4.5
What’s new in Visual Studio 2012 & .NET 4.5
 
Behavior Driven Testing - A paradigm shift
Behavior Driven Testing - A paradigm shiftBehavior Driven Testing - A paradigm shift
Behavior Driven Testing - A paradigm shift
 
HotelQuickly Product & Engineering
HotelQuickly Product & EngineeringHotelQuickly Product & Engineering
HotelQuickly Product & Engineering
 

Similaire à Test Driven Development in AEM/CQ5

Effective TDD - Less is more
Effective TDD - Less is moreEffective TDD - Less is more
Effective TDD - Less is more
Ben Lau
 

Similaire à Test Driven Development in AEM/CQ5 (20)

Keeping code clean
Keeping code cleanKeeping code clean
Keeping code clean
 
UPC Plone Testing Talk
UPC Plone Testing TalkUPC Plone Testing Talk
UPC Plone Testing Talk
 
Effective TDD - Less is more
Effective TDD - Less is moreEffective TDD - Less is more
Effective TDD - Less is more
 
Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)
 
Reliable mobile test automation
Reliable mobile test automationReliable mobile test automation
Reliable mobile test automation
 
Test Driven Development with PHP
Test Driven Development with PHPTest Driven Development with PHP
Test Driven Development with PHP
 
Unit Testing and TDD 2017
Unit Testing and TDD 2017Unit Testing and TDD 2017
Unit Testing and TDD 2017
 
May 2021 Spark Testing ... or how to farm reputation on StackOverflow
May 2021 Spark Testing ... or how to farm reputation on StackOverflowMay 2021 Spark Testing ... or how to farm reputation on StackOverflow
May 2021 Spark Testing ... or how to farm reputation on StackOverflow
 
Software Testing Basic Concepts
Software Testing Basic ConceptsSoftware Testing Basic Concepts
Software Testing Basic Concepts
 
Spock pres
Spock presSpock pres
Spock pres
 
TDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and GomegaTDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and Gomega
 
How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...
 
Test driven development_continuous_integration
Test driven development_continuous_integrationTest driven development_continuous_integration
Test driven development_continuous_integration
 
Test-Driven Development.pptx
Test-Driven Development.pptxTest-Driven Development.pptx
Test-Driven Development.pptx
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
 
Getting started with karate dsl
Getting started with karate dslGetting started with karate dsl
Getting started with karate dsl
 
Test driven development - Zombie proof your code
Test driven development - Zombie proof your codeTest driven development - Zombie proof your code
Test driven development - Zombie proof your code
 
Testing of React JS app
Testing of React JS appTesting of React JS app
Testing of React JS app
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
 
Getting started with unit and functional testing
Getting started with unit and functional testingGetting started with unit and functional testing
Getting started with unit and functional testing
 

Dernier

Dernier (20)

A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 

Test Driven Development in AEM/CQ5

  • 2. What’s on the plate? ● What is Test driven development (TDD)? ● Why TDD / BDD? ● CQ backend and Spock testing framework ● Live code
  • 3. Not on the plate ● Advanced testing techniques ○ Features of Spock Framework ● Much about testing your UI / JS
  • 4. ● Software Consultant II / Tech lead ● WEM Consultant ○ Backend development ○ Comfortable with Java (/JSP) and Groovy ● I don’t dislike front-end development :-) About me
  • 5. I became a programmer because of the ‘science’ in programming, but, I remained a programmer because of the ‘art’ in programming. I believe..
  • 6. Some people have very strong opinions about this...
  • 8. Test Driven Development ● Write Test First (extreme programming) ○ Technical meaning ○ Design your code around the tests ● Write a lot of tests ○ Milder approach
  • 9. What is a Unit Test in CQ/AEM?
  • 10. Benefits of Testing ● Find bugs early ● Make it easy for a new person on your project ○ Read the tests if you don’t understand the code ● Improve code quality
  • 11. Benefits of Testing ● Helps during code re-factoring ● A good test is worth a thousand comments ● Executable documentation
  • 12. BDD ● Behavior Driven Development ● Writing tests from the customer’s / stakeholder’s point of view ● It really is TDD done well! ● More expressive than TDD
  • 13. //Variables expected, v1, v2, .. //Execute feature actual = System.executeFeature(v1, v2, ..) //The system gives output as expected assert actual == expected
  • 14.
  • 15. CQ/AEM and Spock ● What is Spock Framework? [ link ] ● Why is it awesome? [ link ] [ link ] ○ Is beautiful ● It can be used to test your CQ/AEM backend!
  • 16. A basic Spock Feature //Spock ‘feature’ def "My component should just work"() { given: final variables = [ //initial conditions ] final expected = new MyComponent(...) when: final actual = MyComponent.create(variables) then: actual == expected }
  • 17. Time for some real code... What ‘new’ will we see? ● Mocks in spock ● setupSpec(), cleanupSpec() ● @Ignore(), @Shared
  • 18. What all can you do? ● Unit tests for servlets, services ● Integration tests ● Functional tests for your rest APIs ● Even UI tests! (with Geb)
  • 19. What all can you do? Test Automation
  • 20. Where to go from here? ● Don’t have to start big ● Add tests to the code that is important, needs change ● Start new implementations with TDD
  • 21. The art of programming!