SlideShare a Scribd company logo
1 of 40
Download to read offline
Implementing Quality
on Java projects
Vincent Massol
Committer XWiki
CTO XWiki SAS
@vmassol
Saturday, April 20, 13
Vincent Massol
• Speaker Bio
•CTO XWiki SAS
• Your Projects
•XWiki (community-driven open source project)
•Past: Maven, Apache Cargo, Apache Cactus, Pattern
Testing
• Other Credentials:
•LesCastCodeurs podcast
•Creator of OSSGTP open source group in Paris
Saturday, April 20, 13
What is Quality?
Saturday, April 20, 13
The XWiki project in summary
• 9 years old
• 28 active
committers
• 7 committers
do 80% of
work
• 700K
NCLOC
• 11 commits/
day
Saturday, April 20, 13
Examples of Quality actions
• Coding rules (Checkstyle, ...)
• Test coverage
• Track bugs
• Don’t use Commons Lang 2.x
• Use SLF4J and don’t draw
Log4J/JCL in dependencies
• Automated build
• Automated unit tests
• Stable automated functional
tests
• Ensure API stability
• Code reviews
• License header checks
• Release with Java 6
• Ensure javadoc exist
• Prevent JAR hell
• Release often (every 2 weeks)
• Collaborative design
• Test on supported
environments (DB & Browsers)
Saturday, April 20, 13
Quality Tip #1
API Stability
Saturday, April 20, 13
The Problem
Class Not Found or Method Not
Found
Saturday, April 20, 13
API Stability - Deprecations
/**
* ...
* @deprecated since 2.4M1 use {@link #transform(
* Block, TransformationContext)}
*/
@Deprecated
void transform(XDOM dom, Syntax syntax)
throws TransformationException;
Saturday, April 20, 13
API Stability - CLIRR (1/2)
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>clirr-maven-plugin</artifactId>
<configuration>
<ignored>
<difference>
<differenceType>7006</differenceType>
<className>org/xwiki/.../MetaDataBlock</className>
<method>org.xwiki....block.Block clone()</method>
<to>org.xwiki.rendering.block.MetaDataBlock</to>
<justification>XDOM#clone() doesn't clone the meta
data</justification>
</difference>
...
Saturday, April 20, 13
API Stability - CLIRR (2/2)
Example from XWiki 5.0M1 Release notes
Saturday, April 20, 13
API Stability - Internal Package
Javadoc
CLIRR
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>clirr-maven-plugin</artifactId>
<excludes>
<exclude>**/internal/**</exclude>
<exclude>**/test/**</exclude>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin
<configuration>
<excludePackageNames>*.internal.*
</excludePackageNames>
Saturday, April 20, 13
API Stability - Legacy Module
Aspect Weaving
+ “Legacy” Profile
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</...>
...
<configuration>
<weaveDependencies>
<weaveDependency>
<groupId>org.xwiki.rendering</...>
<artifactId>xwiki-rendering-api</...>
...
Saturday, April 20, 13
API Stability - Young APIs
/**
* ...
* @since 5.0M1
*/
@Unstable(<optional explanation>)
public EntityReference createEntityReference(String name,...)
{
...
}
+ max duration for keeping the annotation!
Saturday, April 20, 13
API Stability - Next steps
• Annotation or package for SPI?
• Better define when to use the @Unstable
annotation
• Not possible to add a new method to an existing
Interface without breaking compatibility
•Java 8 and Virtual Extension/Defender methods
interface TestInterface {
  public void testMe();
  public void newMethod() default {
    System.out.println("Default from interface"); }
Saturday, April 20, 13
Quality Tip #2
JAR Hell
Saturday, April 20, 13
The Problem
Class Not Found or Method Not
Found or not working feature
Saturday, April 20, 13
No duplicate classes @ runtime
<plugin>
<groupId>com.ning.maven.plugins</groupId>
<artifactId>maven-duplicate-finder-plugin</artifactId>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<failBuildInCaseOfConflict>true</...>
<exceptions>
...
Saturday, April 20, 13
Surprising results...
• Commons Beanutils bundles some classes from Commons
Collections, apparently to avoid drawing a dependency to it...
• Xalan bundles a lot of other projects (org/apache/xml/**, org/
apache/bcel/**, JLex/**, java_cup/**, org/apache/regexp/**). In
addition, it even has these jars in its source tree without any
indication about their versions...
• stax-api, geronimo-stax-api_1.0_spec and xml-apis all draw
javax.xml.stream.* classes
• xmlbeans and xml-apis draw incompatible versions of
org.w3c.dom.* classes
14 exceptions in total!
Saturday, April 20, 13
Maven: dependency version issue
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.9</version>
<!-- Depends on org.slf4j:slf4j-api:1.5.0 -->
</dependency>
</dependencies>
Will run logback 0.9.9
with slf4J-api 1.4.0
instead of 1.5.0!
Saturday, April 20, 13
Maven: ensure correct version
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-version-compatibility</id>
<phase>verify</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireUpperBoundDeps/>
</rules>
Saturday, April 20, 13
Quality Tip #3
Test Coverage
Saturday, April 20, 13
The Problem
More bugs reported, overall
quality goes down and harder to
debug software
Saturday, April 20, 13
Use Jacoco to fail the build
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution><id>jacoco-prepare</id>
<goals><goal>prepare-agent</goal></goals>
</execution>
<execution><id>jacoco-check</id>
<goals><goal>check</goal></goals>
</execution>
</executions>
<configuration>
<check>
<instructionRatio>${xwiki.jacoco.instructionRatio}</...>
</check>}
Saturday, April 20, 13
Strategy
• When devs add code (and thus
tests), increase the TPC percentage
• Put the Jacoco check in “Quality”
Maven Profile
• Have a CI job to execute that
profile regularly
•About 15% overhead compared to build
without checks
• “Cheat mode”: Add easier-to-write
test
Saturday, April 20, 13
Quizz Time!
[INFO] --- jacoco-maven-plugin:0.6.2.201302030002:check (jacoco-check)
[INFO] All coverage checks have been met.
[INFO] --- jacoco-maven-plugin:0.6.2.201302030002:check (jacoco-check)
[WARNING] Insufficient code coverage for INSTRUCTION: 75.52% < 75.53%
Step 1: Building on my local machine gives the following:
Step 2: Building on the CI machine gave:
Non determinism! Why?
Saturday, April 20, 13
Quizz Answer
private Map componentEntries = new ConcurrentHashMap();
...
for (Map.Entry entry : componentEntries.entrySet())
{
if (entry.getValue().instance == component) {
  key = entry.getKey();
    oldDescriptor = entry.getValue().descriptor;
    break;
  }
}
... because the JVM is non deterministic!
Saturday, April 20, 13
Quality Tip #4
Functional Testing
Stability
Saturday, April 20, 13
The Problem
Too many false positives
leading to developers not
paying attention to CI emails
anymore... leading to failing
software
Saturday, April 20, 13
False positives examples
• The JVM has crashed
• VNC is down (we run Selenium tests)
• Browser crash (we run Selenium tests)
• Git connection issue
• Machine slowness (if XWiki cannot start under 2 minutes
then it means the machine has some problems)
• Nexus is down (we deploy our artifacts to a Nexus
repository)
• Connection issue (Read time out)
Saturday, April 20, 13
Step 1: Groovy PostBuild Plugin (1/2)
def messages = [
[".*A fatal error has been detected by the Java Runtime Environment.*",
"JVM Crash", "A JVM crash happened!"],
[".*Error: cannot open display: :1.0.*",
"VNC not running", "VNC connection issue!"],
...
]
def shouldSendEmail = true
messages.each { message ->
if (manager.logContains(message.get(0))) {
manager.addWarningBadge(message.get(1))
manager.createSummary("warning.gif").appendText(...)
manager.buildUnstable()
shouldSendEmail = false
}
}
Saturday, April 20, 13
Step 1: Groovy PostBuild Plugin (2/2)
... continued from previous slide...
if (!shouldSendEmail) {
def pa = new ParametersAction([
new BooleanParameterValue("noEmail", true)
])
manager.build.addAction(pa)
}
Saturday, April 20, 13
Step 2: Mail Ext Plugin
import hudson.model.*
build.actions.each { action ->
if (action instanceof ParametersAction) {
if (action.getParameter("noEmail")) {
cancel = true
}
}
}
Pre-send Script
Saturday, April 20, 13
Results
+ use the Scriptler plugin to automate configuration for all jobs
Saturday, April 20, 13
Quality Tip #5
Bug Fixing Day
Saturday, April 20, 13
The Problem
Bugs increasing, even
simple to fix
ones, devs focusing too much on
new features (i.e. scope creep)
vs fixing what exists
Bugs created vs closed
Saturday, April 20, 13
Bug Fixing Day
• Every Thursday
• Goal is to close the max number of bugs
• Triaging: Can be closed with Won’t fix,
Duplicate, Cannot Reproduce, etc
• Close low hanging fruits in priority
• Started with last 365 days then with last 547
days and currently with last 730 days (we
need to catch up with 6 bugs!)
Saturday, April 20, 13
Results
Saturday, April 20, 13
Conclusion
Saturday, April 20, 13
Parting words
• Slowly add new quality check over time
• Everyone must be on board
• Favor Active Quality (i.e. make the build fail) over
Passive checks
• Be ready to adapt/remove checks if found not useful
enough
• Quality brings some risks:
•Potentially less committers for your project (especially open
source)
Saturday, April 20, 13
Be proud of your Quality!
“I have offended God and
mankind because my work
didn't reach the quality it should
have.”
Leonardo da Vinci, on his death bed
Saturday, April 20, 13

More Related Content

What's hot

Riga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationRiga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationNicolas Fränkel
 
OpenJDK-Zulu talk at JEEConf'14
OpenJDK-Zulu talk at JEEConf'14OpenJDK-Zulu talk at JEEConf'14
OpenJDK-Zulu talk at JEEConf'14Ivan Krylov
 
Take Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainersTake Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainersNaresha K
 
JavaLand - Integration Testing How-to
JavaLand - Integration Testing How-toJavaLand - Integration Testing How-to
JavaLand - Integration Testing How-toNicolas Fränkel
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With SeleniumMarakana Inc.
 
Testing Java EE apps with Arquillian
Testing Java EE apps with ArquillianTesting Java EE apps with Arquillian
Testing Java EE apps with ArquillianIvan Ivanov
 
OSDC 2017 - Julien Pivotto - Automating Jenkins
OSDC 2017 - Julien Pivotto - Automating JenkinsOSDC 2017 - Julien Pivotto - Automating Jenkins
OSDC 2017 - Julien Pivotto - Automating JenkinsNETWAYS
 
Bgoug 2019.11 building free, open-source, plsql products in cloud
Bgoug 2019.11   building free, open-source, plsql products in cloudBgoug 2019.11   building free, open-source, plsql products in cloud
Bgoug 2019.11 building free, open-source, plsql products in cloudJacek Gebal
 
Arquillian : An introduction
Arquillian : An introductionArquillian : An introduction
Arquillian : An introductionVineet Reynolds
 
Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012Anton Arhipov
 
Finally, easy integration testing with Testcontainers
Finally, easy integration testing with TestcontainersFinally, easy integration testing with Testcontainers
Finally, easy integration testing with TestcontainersRudy De Busscher
 
Beginner's guide to Selenium
Beginner's guide to SeleniumBeginner's guide to Selenium
Beginner's guide to SeleniumLim Sim
 
Developers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomonDevelopers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomonIneke Scheffers
 
Real Java EE Testing with Arquillian and ShrinkWrap
Real Java EE Testing with Arquillian and ShrinkWrapReal Java EE Testing with Arquillian and ShrinkWrap
Real Java EE Testing with Arquillian and ShrinkWrapDan Allen
 
Jenkins 101: Continuos Integration with Jenkins
Jenkins 101: Continuos Integration with JenkinsJenkins 101: Continuos Integration with Jenkins
Jenkins 101: Continuos Integration with JenkinsAll Things Open
 

What's hot (20)

Riga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationRiga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous Integration
 
OpenJDK-Zulu talk at JEEConf'14
OpenJDK-Zulu talk at JEEConf'14OpenJDK-Zulu talk at JEEConf'14
OpenJDK-Zulu talk at JEEConf'14
 
Extending NetBeans IDE
Extending NetBeans IDEExtending NetBeans IDE
Extending NetBeans IDE
 
Take Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainersTake Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainers
 
JavaLand - Integration Testing How-to
JavaLand - Integration Testing How-toJavaLand - Integration Testing How-to
JavaLand - Integration Testing How-to
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With Selenium
 
Testing Java EE apps with Arquillian
Testing Java EE apps with ArquillianTesting Java EE apps with Arquillian
Testing Java EE apps with Arquillian
 
Arquillian
ArquillianArquillian
Arquillian
 
L08 Unit Testing
L08 Unit TestingL08 Unit Testing
L08 Unit Testing
 
OSDC 2017 - Julien Pivotto - Automating Jenkins
OSDC 2017 - Julien Pivotto - Automating JenkinsOSDC 2017 - Julien Pivotto - Automating Jenkins
OSDC 2017 - Julien Pivotto - Automating Jenkins
 
Bgoug 2019.11 building free, open-source, plsql products in cloud
Bgoug 2019.11   building free, open-source, plsql products in cloudBgoug 2019.11   building free, open-source, plsql products in cloud
Bgoug 2019.11 building free, open-source, plsql products in cloud
 
Arquillian : An introduction
Arquillian : An introductionArquillian : An introduction
Arquillian : An introduction
 
Test driving QML
Test driving QMLTest driving QML
Test driving QML
 
Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012
 
Finally, easy integration testing with Testcontainers
Finally, easy integration testing with TestcontainersFinally, easy integration testing with Testcontainers
Finally, easy integration testing with Testcontainers
 
Test driving-qml
Test driving-qmlTest driving-qml
Test driving-qml
 
Beginner's guide to Selenium
Beginner's guide to SeleniumBeginner's guide to Selenium
Beginner's guide to Selenium
 
Developers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomonDevelopers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomon
 
Real Java EE Testing with Arquillian and ShrinkWrap
Real Java EE Testing with Arquillian and ShrinkWrapReal Java EE Testing with Arquillian and ShrinkWrap
Real Java EE Testing with Arquillian and ShrinkWrap
 
Jenkins 101: Continuos Integration with Jenkins
Jenkins 101: Continuos Integration with JenkinsJenkins 101: Continuos Integration with Jenkins
Jenkins 101: Continuos Integration with Jenkins
 

Viewers also liked

Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on RailsAvi Kedar
 
Wed Development on Rails
Wed Development on RailsWed Development on Rails
Wed Development on RailsJames Gray
 
Simple Social Networking with Ruby on Rails
Simple Social Networking with Ruby on RailsSimple Social Networking with Ruby on Rails
Simple Social Networking with Ruby on Railsjhenry
 
Rapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsRapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsSimobo
 
Rapid development with Rails
Rapid development with RailsRapid development with Rails
Rapid development with RailsYi-Ting Cheng
 
Be project ppt asp.net
Be project ppt asp.netBe project ppt asp.net
Be project ppt asp.netSanket Jagare
 
Web Design Project Report
Web Design Project ReportWeb Design Project Report
Web Design Project ReportMJ Ferdous
 
47533870 final-project-report
47533870 final-project-report47533870 final-project-report
47533870 final-project-reportMohammed Meraj
 

Viewers also liked (11)

Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on Rails
 
Wed Development on Rails
Wed Development on RailsWed Development on Rails
Wed Development on Rails
 
Simple Social Networking with Ruby on Rails
Simple Social Networking with Ruby on RailsSimple Social Networking with Ruby on Rails
Simple Social Networking with Ruby on Rails
 
Rapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsRapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on Rails
 
Rapid development with Rails
Rapid development with RailsRapid development with Rails
Rapid development with Rails
 
Be project ppt asp.net
Be project ppt asp.netBe project ppt asp.net
Be project ppt asp.net
 
Introduction to Angularjs
Introduction to AngularjsIntroduction to Angularjs
Introduction to Angularjs
 
Web Design Project Report
Web Design Project ReportWeb Design Project Report
Web Design Project Report
 
47533870 final-project-report
47533870 final-project-report47533870 final-project-report
47533870 final-project-report
 
Atm System
Atm SystemAtm System
Atm System
 
SlideShare 101
SlideShare 101SlideShare 101
SlideShare 101
 

Similar to Implementing quality in Java projects

Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinSigma Software
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Fwdays
 
Enterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo JanschEnterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo Janschdpc
 
Automated integration tests for ajax applications (с. карпушин, auriga)
Automated integration tests for ajax applications (с. карпушин, auriga)Automated integration tests for ajax applications (с. карпушин, auriga)
Automated integration tests for ajax applications (с. карпушин, auriga)Mobile Developer Day
 
Improve unit tests with Mutants!
Improve unit tests with Mutants!Improve unit tests with Mutants!
Improve unit tests with Mutants!Paco van Beckhoven
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversingEnrique López Mañas
 
Intro to PHP Testing
Intro to PHP TestingIntro to PHP Testing
Intro to PHP TestingRan Mizrahi
 
Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018Ortus Solutions, Corp
 
Mutation testing Bucharest Tech Week
Mutation testing Bucharest Tech WeekMutation testing Bucharest Tech Week
Mutation testing Bucharest Tech WeekPaco van Beckhoven
 
Testing iOS Apps
Testing iOS AppsTesting iOS Apps
Testing iOS AppsC4Media
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETBen Hall
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1Albert Rosa
 
New types of tests for Java projects
New types of tests for Java projectsNew types of tests for Java projects
New types of tests for Java projectsVincent Massol
 
AOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java PlatformAOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java PlatformPeter Pilgrim
 
Implementing Quality on Java projects (Short version)
Implementing Quality on Java projects (Short version)Implementing Quality on Java projects (Short version)
Implementing Quality on Java projects (Short version)Vincent Massol
 
Testing and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building AndroidDroidcon Berlin
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchMats Bryntse
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsLuís Bastião Silva
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in YiiIlPeach
 

Similar to Implementing quality in Java projects (20)

Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita Galkin
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"
 
Enterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo JanschEnterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo Jansch
 
Automated integration tests for ajax applications (с. карпушин, auriga)
Automated integration tests for ajax applications (с. карпушин, auriga)Automated integration tests for ajax applications (с. карпушин, auriga)
Automated integration tests for ajax applications (с. карпушин, auriga)
 
Improve unit tests with Mutants!
Improve unit tests with Mutants!Improve unit tests with Mutants!
Improve unit tests with Mutants!
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversing
 
Intro to PHP Testing
Intro to PHP TestingIntro to PHP Testing
Intro to PHP Testing
 
Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018
 
Mutation testing Bucharest Tech Week
Mutation testing Bucharest Tech WeekMutation testing Bucharest Tech Week
Mutation testing Bucharest Tech Week
 
Testing iOS Apps
Testing iOS AppsTesting iOS Apps
Testing iOS Apps
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1
 
New types of tests for Java projects
New types of tests for Java projectsNew types of tests for Java projects
New types of tests for Java projects
 
AOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java PlatformAOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java Platform
 
Implementing Quality on Java projects (Short version)
Implementing Quality on Java projects (Short version)Implementing Quality on Java projects (Short version)
Implementing Quality on Java projects (Short version)
 
Testing and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building Android
 
Advanced Java Testing
Advanced Java TestingAdvanced Java Testing
Advanced Java Testing
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in Yii
 

More from Vincent Massol

XWiki Testing with TestContainers
XWiki Testing with TestContainersXWiki Testing with TestContainers
XWiki Testing with TestContainersVincent Massol
 
XWiki: The best wiki for developers
XWiki: The best wiki for developersXWiki: The best wiki for developers
XWiki: The best wiki for developersVincent Massol
 
Advanced Java Testing @ POSS 2019
Advanced Java Testing @ POSS 2019Advanced Java Testing @ POSS 2019
Advanced Java Testing @ POSS 2019Vincent Massol
 
Configuration Testing with Docker & TestContainers
Configuration Testing with Docker & TestContainersConfiguration Testing with Docker & TestContainers
Configuration Testing with Docker & TestContainersVincent Massol
 
New types of tests for Java projects
New types of tests for Java projectsNew types of tests for Java projects
New types of tests for Java projectsVincent Massol
 
What's new in XWiki 9.x and 10.x
What's new in XWiki 9.x and 10.xWhat's new in XWiki 9.x and 10.x
What's new in XWiki 9.x and 10.xVincent Massol
 
Creating your own project's Quality Dashboard
Creating your own project's Quality DashboardCreating your own project's Quality Dashboard
Creating your own project's Quality DashboardVincent Massol
 
XWiki: wiki collaboration as an alternative to Confluence and Sharepoint
XWiki: wiki collaboration as an alternative to Confluence and SharepointXWiki: wiki collaboration as an alternative to Confluence and Sharepoint
XWiki: wiki collaboration as an alternative to Confluence and SharepointVincent Massol
 
Creating your own project's Quality Dashboard
Creating your own project's Quality DashboardCreating your own project's Quality Dashboard
Creating your own project's Quality DashboardVincent Massol
 
XWiki: The web's Swiss Army Knife
XWiki: The web's Swiss Army KnifeXWiki: The web's Swiss Army Knife
XWiki: The web's Swiss Army KnifeVincent Massol
 
Leading a Community-Driven Open Source Project
Leading a Community-Driven Open Source ProjectLeading a Community-Driven Open Source Project
Leading a Community-Driven Open Source ProjectVincent Massol
 
XWiki Status - July 2015
XWiki Status - July 2015XWiki Status - July 2015
XWiki Status - July 2015Vincent Massol
 
XWiki SAS: An open source company
XWiki SAS: An open source companyXWiki SAS: An open source company
XWiki SAS: An open source companyVincent Massol
 
XWiki: A web dev runtime for writing web apps @ FOSDEM 2014
XWiki: A web dev runtime for writing web apps @ FOSDEM 2014XWiki: A web dev runtime for writing web apps @ FOSDEM 2014
XWiki: A web dev runtime for writing web apps @ FOSDEM 2014Vincent Massol
 
XWiki Rendering @ FOSDEM 2014
XWiki Rendering @ FOSDEM 2014XWiki Rendering @ FOSDEM 2014
XWiki Rendering @ FOSDEM 2014Vincent Massol
 
Combining open source ethics with private interests
Combining open source ethics with private interestsCombining open source ethics with private interests
Combining open source ethics with private interestsVincent Massol
 
Evolutions XWiki 2012/2013
Evolutions XWiki 2012/2013Evolutions XWiki 2012/2013
Evolutions XWiki 2012/2013Vincent Massol
 

More from Vincent Massol (20)

XWiki Testing with TestContainers
XWiki Testing with TestContainersXWiki Testing with TestContainers
XWiki Testing with TestContainers
 
XWiki: The best wiki for developers
XWiki: The best wiki for developersXWiki: The best wiki for developers
XWiki: The best wiki for developers
 
Advanced Java Testing @ POSS 2019
Advanced Java Testing @ POSS 2019Advanced Java Testing @ POSS 2019
Advanced Java Testing @ POSS 2019
 
Configuration Testing with Docker & TestContainers
Configuration Testing with Docker & TestContainersConfiguration Testing with Docker & TestContainers
Configuration Testing with Docker & TestContainers
 
New types of tests for Java projects
New types of tests for Java projectsNew types of tests for Java projects
New types of tests for Java projects
 
What's new in XWiki 9.x and 10.x
What's new in XWiki 9.x and 10.xWhat's new in XWiki 9.x and 10.x
What's new in XWiki 9.x and 10.x
 
QDashboard 1.2
QDashboard 1.2QDashboard 1.2
QDashboard 1.2
 
Creating your own project's Quality Dashboard
Creating your own project's Quality DashboardCreating your own project's Quality Dashboard
Creating your own project's Quality Dashboard
 
XWiki: wiki collaboration as an alternative to Confluence and Sharepoint
XWiki: wiki collaboration as an alternative to Confluence and SharepointXWiki: wiki collaboration as an alternative to Confluence and Sharepoint
XWiki: wiki collaboration as an alternative to Confluence and Sharepoint
 
Creating your own project's Quality Dashboard
Creating your own project's Quality DashboardCreating your own project's Quality Dashboard
Creating your own project's Quality Dashboard
 
XWiki: The web's Swiss Army Knife
XWiki: The web's Swiss Army KnifeXWiki: The web's Swiss Army Knife
XWiki: The web's Swiss Army Knife
 
Leading a Community-Driven Open Source Project
Leading a Community-Driven Open Source ProjectLeading a Community-Driven Open Source Project
Leading a Community-Driven Open Source Project
 
Developing XWiki
Developing XWikiDeveloping XWiki
Developing XWiki
 
XWiki Status - July 2015
XWiki Status - July 2015XWiki Status - July 2015
XWiki Status - July 2015
 
XWiki SAS: An open source company
XWiki SAS: An open source companyXWiki SAS: An open source company
XWiki SAS: An open source company
 
XWiki: A web dev runtime for writing web apps @ FOSDEM 2014
XWiki: A web dev runtime for writing web apps @ FOSDEM 2014XWiki: A web dev runtime for writing web apps @ FOSDEM 2014
XWiki: A web dev runtime for writing web apps @ FOSDEM 2014
 
XWiki Rendering @ FOSDEM 2014
XWiki Rendering @ FOSDEM 2014XWiki Rendering @ FOSDEM 2014
XWiki Rendering @ FOSDEM 2014
 
Combining open source ethics with private interests
Combining open source ethics with private interestsCombining open source ethics with private interests
Combining open source ethics with private interests
 
Evolutions XWiki 2012/2013
Evolutions XWiki 2012/2013Evolutions XWiki 2012/2013
Evolutions XWiki 2012/2013
 
Developing XWiki
Developing XWikiDeveloping XWiki
Developing XWiki
 

Recently uploaded

Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNeo4j
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxSatishbabu Gunukula
 
Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTopCSSGallery
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosErol GIRAUDY
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingFrancesco Corti
 
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechProduct School
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdfThe Good Food Institute
 
Graphene Quantum Dots-Based Composites for Biomedical Applications
Graphene Quantum Dots-Based Composites for  Biomedical ApplicationsGraphene Quantum Dots-Based Composites for  Biomedical Applications
Graphene Quantum Dots-Based Composites for Biomedical Applicationsnooralam814309
 
From the origin to the future of Open Source model and business
From the origin to the future of  Open Source model and businessFrom the origin to the future of  Open Source model and business
From the origin to the future of Open Source model and businessFrancesco Corti
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4DianaGray10
 
Introduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its applicationIntroduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its applicationKnoldus Inc.
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfTejal81
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptxHansamali Gamage
 
Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Muhammad Tiham Siddiqui
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxNeo4j
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024Brian Pichman
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxNeo4j
 

Recently uploaded (20)

Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4j
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptx
 
Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development Companies
 
SheDev 2024
SheDev 2024SheDev 2024
SheDev 2024
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenarios
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is going
 
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf
 
Graphene Quantum Dots-Based Composites for Biomedical Applications
Graphene Quantum Dots-Based Composites for  Biomedical ApplicationsGraphene Quantum Dots-Based Composites for  Biomedical Applications
Graphene Quantum Dots-Based Composites for Biomedical Applications
 
From the origin to the future of Open Source model and business
From the origin to the future of  Open Source model and businessFrom the origin to the future of  Open Source model and business
From the origin to the future of Open Source model and business
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4
 
Introduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its applicationIntroduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its application
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx
 
Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
 

Implementing quality in Java projects

  • 1. Implementing Quality on Java projects Vincent Massol Committer XWiki CTO XWiki SAS @vmassol Saturday, April 20, 13
  • 2. Vincent Massol • Speaker Bio •CTO XWiki SAS • Your Projects •XWiki (community-driven open source project) •Past: Maven, Apache Cargo, Apache Cactus, Pattern Testing • Other Credentials: •LesCastCodeurs podcast •Creator of OSSGTP open source group in Paris Saturday, April 20, 13
  • 4. The XWiki project in summary • 9 years old • 28 active committers • 7 committers do 80% of work • 700K NCLOC • 11 commits/ day Saturday, April 20, 13
  • 5. Examples of Quality actions • Coding rules (Checkstyle, ...) • Test coverage • Track bugs • Don’t use Commons Lang 2.x • Use SLF4J and don’t draw Log4J/JCL in dependencies • Automated build • Automated unit tests • Stable automated functional tests • Ensure API stability • Code reviews • License header checks • Release with Java 6 • Ensure javadoc exist • Prevent JAR hell • Release often (every 2 weeks) • Collaborative design • Test on supported environments (DB & Browsers) Saturday, April 20, 13
  • 6. Quality Tip #1 API Stability Saturday, April 20, 13
  • 7. The Problem Class Not Found or Method Not Found Saturday, April 20, 13
  • 8. API Stability - Deprecations /** * ... * @deprecated since 2.4M1 use {@link #transform( * Block, TransformationContext)} */ @Deprecated void transform(XDOM dom, Syntax syntax) throws TransformationException; Saturday, April 20, 13
  • 9. API Stability - CLIRR (1/2) <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>clirr-maven-plugin</artifactId> <configuration> <ignored> <difference> <differenceType>7006</differenceType> <className>org/xwiki/.../MetaDataBlock</className> <method>org.xwiki....block.Block clone()</method> <to>org.xwiki.rendering.block.MetaDataBlock</to> <justification>XDOM#clone() doesn't clone the meta data</justification> </difference> ... Saturday, April 20, 13
  • 10. API Stability - CLIRR (2/2) Example from XWiki 5.0M1 Release notes Saturday, April 20, 13
  • 11. API Stability - Internal Package Javadoc CLIRR <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>clirr-maven-plugin</artifactId> <excludes> <exclude>**/internal/**</exclude> <exclude>**/test/**</exclude> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin <configuration> <excludePackageNames>*.internal.* </excludePackageNames> Saturday, April 20, 13
  • 12. API Stability - Legacy Module Aspect Weaving + “Legacy” Profile <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</...> ... <configuration> <weaveDependencies> <weaveDependency> <groupId>org.xwiki.rendering</...> <artifactId>xwiki-rendering-api</...> ... Saturday, April 20, 13
  • 13. API Stability - Young APIs /** * ... * @since 5.0M1 */ @Unstable(<optional explanation>) public EntityReference createEntityReference(String name,...) { ... } + max duration for keeping the annotation! Saturday, April 20, 13
  • 14. API Stability - Next steps • Annotation or package for SPI? • Better define when to use the @Unstable annotation • Not possible to add a new method to an existing Interface without breaking compatibility •Java 8 and Virtual Extension/Defender methods interface TestInterface {   public void testMe();   public void newMethod() default {     System.out.println("Default from interface"); } Saturday, April 20, 13
  • 15. Quality Tip #2 JAR Hell Saturday, April 20, 13
  • 16. The Problem Class Not Found or Method Not Found or not working feature Saturday, April 20, 13
  • 17. No duplicate classes @ runtime <plugin> <groupId>com.ning.maven.plugins</groupId> <artifactId>maven-duplicate-finder-plugin</artifactId> <executions> <execution> <phase>verify</phase> <goals> <goal>check</goal> </goals> <configuration> <failBuildInCaseOfConflict>true</...> <exceptions> ... Saturday, April 20, 13
  • 18. Surprising results... • Commons Beanutils bundles some classes from Commons Collections, apparently to avoid drawing a dependency to it... • Xalan bundles a lot of other projects (org/apache/xml/**, org/ apache/bcel/**, JLex/**, java_cup/**, org/apache/regexp/**). In addition, it even has these jars in its source tree without any indication about their versions... • stax-api, geronimo-stax-api_1.0_spec and xml-apis all draw javax.xml.stream.* classes • xmlbeans and xml-apis draw incompatible versions of org.w3c.dom.* classes 14 exceptions in total! Saturday, April 20, 13
  • 19. Maven: dependency version issue <dependencies> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.4.0</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>0.9.9</version> <!-- Depends on org.slf4j:slf4j-api:1.5.0 --> </dependency> </dependencies> Will run logback 0.9.9 with slf4J-api 1.4.0 instead of 1.5.0! Saturday, April 20, 13
  • 20. Maven: ensure correct version <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <executions> <execution> <id>enforce-version-compatibility</id> <phase>verify</phase> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <requireUpperBoundDeps/> </rules> Saturday, April 20, 13
  • 21. Quality Tip #3 Test Coverage Saturday, April 20, 13
  • 22. The Problem More bugs reported, overall quality goes down and harder to debug software Saturday, April 20, 13
  • 23. Use Jacoco to fail the build <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <executions> <execution><id>jacoco-prepare</id> <goals><goal>prepare-agent</goal></goals> </execution> <execution><id>jacoco-check</id> <goals><goal>check</goal></goals> </execution> </executions> <configuration> <check> <instructionRatio>${xwiki.jacoco.instructionRatio}</...> </check>} Saturday, April 20, 13
  • 24. Strategy • When devs add code (and thus tests), increase the TPC percentage • Put the Jacoco check in “Quality” Maven Profile • Have a CI job to execute that profile regularly •About 15% overhead compared to build without checks • “Cheat mode”: Add easier-to-write test Saturday, April 20, 13
  • 25. Quizz Time! [INFO] --- jacoco-maven-plugin:0.6.2.201302030002:check (jacoco-check) [INFO] All coverage checks have been met. [INFO] --- jacoco-maven-plugin:0.6.2.201302030002:check (jacoco-check) [WARNING] Insufficient code coverage for INSTRUCTION: 75.52% < 75.53% Step 1: Building on my local machine gives the following: Step 2: Building on the CI machine gave: Non determinism! Why? Saturday, April 20, 13
  • 26. Quizz Answer private Map componentEntries = new ConcurrentHashMap(); ... for (Map.Entry entry : componentEntries.entrySet()) { if (entry.getValue().instance == component) {   key = entry.getKey();     oldDescriptor = entry.getValue().descriptor;     break;   } } ... because the JVM is non deterministic! Saturday, April 20, 13
  • 27. Quality Tip #4 Functional Testing Stability Saturday, April 20, 13
  • 28. The Problem Too many false positives leading to developers not paying attention to CI emails anymore... leading to failing software Saturday, April 20, 13
  • 29. False positives examples • The JVM has crashed • VNC is down (we run Selenium tests) • Browser crash (we run Selenium tests) • Git connection issue • Machine slowness (if XWiki cannot start under 2 minutes then it means the machine has some problems) • Nexus is down (we deploy our artifacts to a Nexus repository) • Connection issue (Read time out) Saturday, April 20, 13
  • 30. Step 1: Groovy PostBuild Plugin (1/2) def messages = [ [".*A fatal error has been detected by the Java Runtime Environment.*", "JVM Crash", "A JVM crash happened!"], [".*Error: cannot open display: :1.0.*", "VNC not running", "VNC connection issue!"], ... ] def shouldSendEmail = true messages.each { message -> if (manager.logContains(message.get(0))) { manager.addWarningBadge(message.get(1)) manager.createSummary("warning.gif").appendText(...) manager.buildUnstable() shouldSendEmail = false } } Saturday, April 20, 13
  • 31. Step 1: Groovy PostBuild Plugin (2/2) ... continued from previous slide... if (!shouldSendEmail) { def pa = new ParametersAction([ new BooleanParameterValue("noEmail", true) ]) manager.build.addAction(pa) } Saturday, April 20, 13
  • 32. Step 2: Mail Ext Plugin import hudson.model.* build.actions.each { action -> if (action instanceof ParametersAction) { if (action.getParameter("noEmail")) { cancel = true } } } Pre-send Script Saturday, April 20, 13
  • 33. Results + use the Scriptler plugin to automate configuration for all jobs Saturday, April 20, 13
  • 34. Quality Tip #5 Bug Fixing Day Saturday, April 20, 13
  • 35. The Problem Bugs increasing, even simple to fix ones, devs focusing too much on new features (i.e. scope creep) vs fixing what exists Bugs created vs closed Saturday, April 20, 13
  • 36. Bug Fixing Day • Every Thursday • Goal is to close the max number of bugs • Triaging: Can be closed with Won’t fix, Duplicate, Cannot Reproduce, etc • Close low hanging fruits in priority • Started with last 365 days then with last 547 days and currently with last 730 days (we need to catch up with 6 bugs!) Saturday, April 20, 13
  • 39. Parting words • Slowly add new quality check over time • Everyone must be on board • Favor Active Quality (i.e. make the build fail) over Passive checks • Be ready to adapt/remove checks if found not useful enough • Quality brings some risks: •Potentially less committers for your project (especially open source) Saturday, April 20, 13
  • 40. Be proud of your Quality! “I have offended God and mankind because my work didn't reach the quality it should have.” Leonardo da Vinci, on his death bed Saturday, April 20, 13