© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Integration Testing in AEM
Lydia Balazs | Senior QE Developer
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Who am I?
2
§  > 10 years CQ / AEM experience
§  Senior Quality Engineer Developer, located in Basel
§  Service Manager Germany
§  Training
§  Senior Consultant
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Testing successfully integrated!
3
§  Responsibility of Developers and Quality Engineers
§  Part of AEM build
§  Releases are depending on the status of the test results
§  Code Coverage
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
How did we do that?
4
§  Main responsibility: Quality Assurance team in Basel (Core team)
§  Different AEM teams work closely together
§  Core
§  Digital Asset Management (DAM)
§  Social Collaboration (SoCo)
§  Marketing Campaign Management (MCM)
§  AEM teams stick to the same process
§  AEM teams use the same infrastructure incl. Integration Testing Framework
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Integration Testing in AEM – The Process!
5
WRITE
PRODUCT
CODE
DEV
WRITE
IT
QA
DEV
COLLECT
IT
MODULES
QA
EXECUTE
IT
QA
PUBLISH
RESULTS
QA
IT = Integration Tests DEV = Developer
QA = Quality Assurance
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
WRITE [PRODUCT CODE]
§  New features
§  Optimization
§  Bug fixing
§  Refactoring
6
WRITE
PRODUCT
CODE
DEV
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
WRITE [IT]
§  DEV writes IT
§  In a module which is close to his code
§  QA writes IT
§  In separate projects / modules
§  JUnit tests
§  è A JAR artifact with an “integrationtest” classifier is built
7
WRITE IT
DEV
QA
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
COLLECT ALL [IT]
§  Maven Dependency Plugin
§  Copies or unpacks dependencies or artifacts
§  Artifacts are fetched from local or remote Maven repositories
8
COLLECT
IT
MODULES
QA
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
EXECUTE ALL [IT]
§  Maven Failsafe Plugin
§  Executes integration tests in their own VM
§  Quickstart Maven Plugin
§  Designed by Adobe to generate Quickstart products
§  Has other interesting goals (wait for it)
§  Test Runner
§  A POM file specialized in fetching IT modules, filtering and
running ITs
9
EXECUTE
IT
QA
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Quickstart Maven Plugin
§  Available in Adobe Public Maven Repository
§  Group id: com.adobe.granite.maven
§  Artifact id: quickstart-maven-plugin
§  The interesting goals I was talking about
§  Install, start and stop multiple quickstart instances (author / publish)
§  Use random port
§  Use custom context root
§  Install bundles
10
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Test Runner
§  Provides different profiles to
§  Select which IT modules to collect
§  Filter ITs (by supported Java version, package name, category)
§  Select the right AEM version to install
§  Enable code coverage analysis
11
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Test Runner - Categories
§  Non-Failing
§  Failing
§  SmokeTest
§  All [IT] marked with category “SmokeTest” are executed during each build of AEM
è Make sure that the basic functionality of the system is not broken
§  A good smoke test is fast, simple and reliable!
12
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Test Runner
§  Execution
§  Supports AEM versions > 5.5
§  Collect the right IT modules for each supported AEM version
è Combination of different profiles allows Jenkins Matrix Jobs (a.k.a. Multiple
Configuration Projects)
13
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Test Runner
14
• Author URL
• Publish URL
• Context Root
TEST
RUNNER
• Configure HTTP Clients
• Provides simple access to
AEM HTTP API
• Other testing utilities
(Custom Assertion, JSON,
…)
IT
FRAMEWORK • Run IT via HTTP against a
Sling instance
• Scriptable tests
• Run JUnit tests
contributed by OSGi
bundles
Sling Testing
Tools
Sling Testing Tools:
http://sling.apache.org/documentation/development/sling-testing-tools.html
AEM is RESTful!
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
PUBLISH RESULTS [IT]
§  Continuous Integration (Jenkins)
§  Code Coverage (Maven JaCoCo Plugin + Sonar)
§  JaCoCo is a code coverage library for Java, which has been
created by the EclEmma team
15
PUBLISH
RESULTS
QA
© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Integration Testing in AEM

  • 1.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Integration Testing in AEM Lydia Balazs | Senior QE Developer
  • 2.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Who am I? 2 §  > 10 years CQ / AEM experience §  Senior Quality Engineer Developer, located in Basel §  Service Manager Germany §  Training §  Senior Consultant
  • 3.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Testing successfully integrated! 3 §  Responsibility of Developers and Quality Engineers §  Part of AEM build §  Releases are depending on the status of the test results §  Code Coverage
  • 4.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. How did we do that? 4 §  Main responsibility: Quality Assurance team in Basel (Core team) §  Different AEM teams work closely together §  Core §  Digital Asset Management (DAM) §  Social Collaboration (SoCo) §  Marketing Campaign Management (MCM) §  AEM teams stick to the same process §  AEM teams use the same infrastructure incl. Integration Testing Framework
  • 5.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Integration Testing in AEM – The Process! 5 WRITE PRODUCT CODE DEV WRITE IT QA DEV COLLECT IT MODULES QA EXECUTE IT QA PUBLISH RESULTS QA IT = Integration Tests DEV = Developer QA = Quality Assurance
  • 6.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. WRITE [PRODUCT CODE] §  New features §  Optimization §  Bug fixing §  Refactoring 6 WRITE PRODUCT CODE DEV
  • 7.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. WRITE [IT] §  DEV writes IT §  In a module which is close to his code §  QA writes IT §  In separate projects / modules §  JUnit tests §  è A JAR artifact with an “integrationtest” classifier is built 7 WRITE IT DEV QA
  • 8.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. COLLECT ALL [IT] §  Maven Dependency Plugin §  Copies or unpacks dependencies or artifacts §  Artifacts are fetched from local or remote Maven repositories 8 COLLECT IT MODULES QA
  • 9.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. EXECUTE ALL [IT] §  Maven Failsafe Plugin §  Executes integration tests in their own VM §  Quickstart Maven Plugin §  Designed by Adobe to generate Quickstart products §  Has other interesting goals (wait for it) §  Test Runner §  A POM file specialized in fetching IT modules, filtering and running ITs 9 EXECUTE IT QA
  • 10.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Quickstart Maven Plugin §  Available in Adobe Public Maven Repository §  Group id: com.adobe.granite.maven §  Artifact id: quickstart-maven-plugin §  The interesting goals I was talking about §  Install, start and stop multiple quickstart instances (author / publish) §  Use random port §  Use custom context root §  Install bundles 10
  • 11.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Test Runner §  Provides different profiles to §  Select which IT modules to collect §  Filter ITs (by supported Java version, package name, category) §  Select the right AEM version to install §  Enable code coverage analysis 11
  • 12.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Test Runner - Categories §  Non-Failing §  Failing §  SmokeTest §  All [IT] marked with category “SmokeTest” are executed during each build of AEM è Make sure that the basic functionality of the system is not broken §  A good smoke test is fast, simple and reliable! 12
  • 13.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Test Runner §  Execution §  Supports AEM versions > 5.5 §  Collect the right IT modules for each supported AEM version è Combination of different profiles allows Jenkins Matrix Jobs (a.k.a. Multiple Configuration Projects) 13
  • 14.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Test Runner 14 • Author URL • Publish URL • Context Root TEST RUNNER • Configure HTTP Clients • Provides simple access to AEM HTTP API • Other testing utilities (Custom Assertion, JSON, …) IT FRAMEWORK • Run IT via HTTP against a Sling instance • Scriptable tests • Run JUnit tests contributed by OSGi bundles Sling Testing Tools Sling Testing Tools: http://sling.apache.org/documentation/development/sling-testing-tools.html AEM is RESTful!
  • 15.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. PUBLISH RESULTS [IT] §  Continuous Integration (Jenkins) §  Code Coverage (Maven JaCoCo Plugin + Sonar) §  JaCoCo is a code coverage library for Java, which has been created by the EclEmma team 15 PUBLISH RESULTS QA
  • 16.
    © 2013 AdobeSystems Incorporated. All Rights Reserved. Adobe Confidential.© 2013 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.