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
Sunday, April 21, 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
Sunday, April 21, 13
What is Quality?
Sunday, April 21, 13
The XWiki project in summary
• 9 years old
• 28 active
committers
• 7 committers
do 80% of
work
• 700K
NCLOC
• 11 commits/
day
Sunday, April 21, 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)
Sunday, April 21, 13
Quality Tip #1
API Stability
Sunday, April 21, 13
The Problem
Class Not Found or Method Not
Found
Sunday, April 21, 13
API Stability - Deprecations
/**
* ...
* @deprecated since 2.4M1 use {@link #transform(
* Block, TransformationContext)}
*/
@Deprecated
void transform(XDOM dom, Syntax syntax)
throws TransformationException;
Sunday, April 21, 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>
...
Sunday, April 21, 13
API Stability - CLIRR (2/2)
Example from XWiki 5.0M1 Release notes
Sunday, April 21, 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>
Sunday, April 21, 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</...>
...
Sunday, April 21, 13
API Stability - Young APIs
/**
* ...
* @since 5.0M1
*/
@Unstable(<optional explanation>)
public EntityReference createEntityReference(String name,...)
{
...
}
+ max duration for keeping the annotation!
Sunday, April 21, 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"); }
Sunday, April 21, 13
Quality Tip #2
JAR Hell
Sunday, April 21, 13
The Problem
Class Not Found or Method Not
Found or not working feature
Sunday, April 21, 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>
...
Sunday, April 21, 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!
Sunday, April 21, 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!
Sunday, April 21, 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>
Sunday, April 21, 13
Quality Tip #3
Test Coverage
Sunday, April 21, 13
The Problem
More bugs reported, overall
quality goes down and harder to
debug software
Sunday, April 21, 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>}
Sunday, April 21, 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
Sunday, April 21, 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?
Sunday, April 21, 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!
Sunday, April 21, 13
Quality Tip #4
Functional Testing
Stability
Sunday, April 21, 13
The Problem
Too many false positives
leading to developers not
paying attention to CI emails
anymore... leading to failing
software
Sunday, April 21, 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)
Sunday, April 21, 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
}
}
Sunday, April 21, 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)
}
Sunday, April 21, 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
Sunday, April 21, 13
Results
+ use the Scriptler plugin to automate configuration for all jobs
Sunday, April 21, 13
Quality Tip #5
Bug Fixing Day
Sunday, April 21, 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
Sunday, April 21, 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!)
Sunday, April 21, 13
Results
Sunday, April 21, 13
Conclusion
Sunday, April 21, 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)
Sunday, April 21, 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
Sunday, April 21, 13

More Related Content

What's hot

What's hot (20)

Using java8 for unit testing while being backward compatible
Using java8 for unit testing while being backward compatibleUsing java8 for unit testing while being backward compatible
Using java8 for unit testing while being backward compatible
 
Test driving QML
Test driving QMLTest driving QML
Test driving QML
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and Easyb
 
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
 
Tdd
TddTdd
Tdd
 
Abstraction Layers Test Management Summit Faciliated Session 2014
Abstraction Layers Test Management Summit Faciliated Session 2014Abstraction Layers Test Management Summit Faciliated Session 2014
Abstraction Layers Test Management Summit Faciliated Session 2014
 
Introducing Playwright's New Test Runner
Introducing Playwright's New Test RunnerIntroducing Playwright's New Test Runner
Introducing Playwright's New Test Runner
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
 
0900 learning-react
0900 learning-react0900 learning-react
0900 learning-react
 
react.pdf
react.pdfreact.pdf
react.pdf
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDI
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"
 
Testing w-mocks
Testing w-mocksTesting w-mocks
Testing w-mocks
 
Unit-testing and E2E testing in JS
Unit-testing and E2E testing in JSUnit-testing and E2E testing in JS
Unit-testing and E2E testing in JS
 
How to setup unit testing in Android Studio
How to setup unit testing in Android StudioHow to setup unit testing in Android Studio
How to setup unit testing in Android Studio
 
1 aleksandr gritsevski - attd example using
1   aleksandr gritsevski - attd example using1   aleksandr gritsevski - attd example using
1 aleksandr gritsevski - attd example using
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With Selenium
 
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
 
Secret unit testing tools
Secret unit testing toolsSecret unit testing tools
Secret unit testing tools
 
V-TEST
V-TESTV-TEST
V-TEST
 

Viewers also liked

Iasi codecamp 20 april 2013 it–a career a life sweat smiles and cries –andrei...
Iasi codecamp 20 april 2013 it–a career a life sweat smiles and cries –andrei...Iasi codecamp 20 april 2013 it–a career a life sweat smiles and cries –andrei...
Iasi codecamp 20 april 2013 it–a career a life sweat smiles and cries –andrei...
Codecamp Romania
 
Alex carcea, radu macovei a story of how java script joined the big league
Alex carcea, radu macovei   a story of how java script joined the big leagueAlex carcea, radu macovei   a story of how java script joined the big league
Alex carcea, radu macovei a story of how java script joined the big league
Codecamp Romania
 
Iasi code camp 20 april 2013 windows authentication-spring security -kerberos
Iasi code camp 20 april 2013 windows authentication-spring security -kerberosIasi code camp 20 april 2013 windows authentication-spring security -kerberos
Iasi code camp 20 april 2013 windows authentication-spring security -kerberos
Codecamp Romania
 
Daniel Puiu - What's behind of web maps
Daniel Puiu - What's behind of web mapsDaniel Puiu - What's behind of web maps
Daniel Puiu - What's behind of web maps
Codecamp Romania
 
Iasi codecamp 20 april 2013 sponsors 5 minutes presentations
Iasi codecamp 20 april 2013 sponsors 5 minutes presentationsIasi codecamp 20 april 2013 sponsors 5 minutes presentations
Iasi codecamp 20 april 2013 sponsors 5 minutes presentations
Codecamp Romania
 
Iasi codecamp 20 april 2013 scrum- agile measurements-dan nicola
Iasi codecamp 20 april 2013 scrum- agile measurements-dan nicolaIasi codecamp 20 april 2013 scrum- agile measurements-dan nicola
Iasi codecamp 20 april 2013 scrum- agile measurements-dan nicola
Codecamp Romania
 
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile appGeorges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
Codecamp Romania
 
Frank Mainzer & Silviu Durduc - Developing mobile app using Sencha Touch
Frank Mainzer & Silviu Durduc - Developing mobile app using Sencha TouchFrank Mainzer & Silviu Durduc - Developing mobile app using Sencha Touch
Frank Mainzer & Silviu Durduc - Developing mobile app using Sencha Touch
Codecamp Romania
 
Codecamp Iasi 7 mai 2011 Monte Carlo Simulation
Codecamp Iasi 7 mai 2011 Monte Carlo SimulationCodecamp Iasi 7 mai 2011 Monte Carlo Simulation
Codecamp Iasi 7 mai 2011 Monte Carlo Simulation
Codecamp Romania
 
Iasi code camp 20 april 2013 android apps crashes why how
Iasi code camp 20 april 2013 android apps crashes why howIasi code camp 20 april 2013 android apps crashes why how
Iasi code camp 20 april 2013 android apps crashes why how
Codecamp Romania
 
Daniel Leon - Qt on mobile
Daniel Leon - Qt on mobileDaniel Leon - Qt on mobile
Daniel Leon - Qt on mobile
Codecamp Romania
 
Mihai Nadas - Windows Azure Media Services
Mihai Nadas - Windows Azure Media ServicesMihai Nadas - Windows Azure Media Services
Mihai Nadas - Windows Azure Media Services
Codecamp Romania
 

Viewers also liked (18)

Iasi codecamp 20 april 2013 it–a career a life sweat smiles and cries –andrei...
Iasi codecamp 20 april 2013 it–a career a life sweat smiles and cries –andrei...Iasi codecamp 20 april 2013 it–a career a life sweat smiles and cries –andrei...
Iasi codecamp 20 april 2013 it–a career a life sweat smiles and cries –andrei...
 
Alex carcea, radu macovei a story of how java script joined the big league
Alex carcea, radu macovei   a story of how java script joined the big leagueAlex carcea, radu macovei   a story of how java script joined the big league
Alex carcea, radu macovei a story of how java script joined the big league
 
Iasi code camp 20 april 2013 windows authentication-spring security -kerberos
Iasi code camp 20 april 2013 windows authentication-spring security -kerberosIasi code camp 20 april 2013 windows authentication-spring security -kerberos
Iasi code camp 20 april 2013 windows authentication-spring security -kerberos
 
Ciprian ouatu asertivitate - comportament si comunicare
Ciprian ouatu   asertivitate - comportament si comunicareCiprian ouatu   asertivitate - comportament si comunicare
Ciprian ouatu asertivitate - comportament si comunicare
 
Daniel Puiu - What's behind of web maps
Daniel Puiu - What's behind of web mapsDaniel Puiu - What's behind of web maps
Daniel Puiu - What's behind of web maps
 
Iasi codecamp 20 april 2013 sponsors 5 minutes presentations
Iasi codecamp 20 april 2013 sponsors 5 minutes presentationsIasi codecamp 20 april 2013 sponsors 5 minutes presentations
Iasi codecamp 20 april 2013 sponsors 5 minutes presentations
 
Alex lakatos state of mobile web
Alex lakatos   state of mobile webAlex lakatos   state of mobile web
Alex lakatos state of mobile web
 
Jozua velle + silviu luca dev ops
Jozua velle + silviu luca   dev opsJozua velle + silviu luca   dev ops
Jozua velle + silviu luca dev ops
 
Iasi codecamp 20 april 2013 scrum- agile measurements-dan nicola
Iasi codecamp 20 april 2013 scrum- agile measurements-dan nicolaIasi codecamp 20 april 2013 scrum- agile measurements-dan nicola
Iasi codecamp 20 april 2013 scrum- agile measurements-dan nicola
 
CodeCamp Iasi 7 mai 2011 My Friends Around
CodeCamp Iasi 7 mai 2011 My Friends AroundCodeCamp Iasi 7 mai 2011 My Friends Around
CodeCamp Iasi 7 mai 2011 My Friends Around
 
Radu pintilie + liviu mazilu document db
Radu pintilie + liviu mazilu   document dbRadu pintilie + liviu mazilu   document db
Radu pintilie + liviu mazilu document db
 
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile appGeorges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
 
Frank Mainzer & Silviu Durduc - Developing mobile app using Sencha Touch
Frank Mainzer & Silviu Durduc - Developing mobile app using Sencha TouchFrank Mainzer & Silviu Durduc - Developing mobile app using Sencha Touch
Frank Mainzer & Silviu Durduc - Developing mobile app using Sencha Touch
 
Codecamp Iasi 7 mai 2011 Monte Carlo Simulation
Codecamp Iasi 7 mai 2011 Monte Carlo SimulationCodecamp Iasi 7 mai 2011 Monte Carlo Simulation
Codecamp Iasi 7 mai 2011 Monte Carlo Simulation
 
Iasi code camp 20 april 2013 android apps crashes why how
Iasi code camp 20 april 2013 android apps crashes why howIasi code camp 20 april 2013 android apps crashes why how
Iasi code camp 20 april 2013 android apps crashes why how
 
Game feel why your death animation sucks (nicolae berbece)
Game feel   why your death animation sucks (nicolae berbece)Game feel   why your death animation sucks (nicolae berbece)
Game feel why your death animation sucks (nicolae berbece)
 
Daniel Leon - Qt on mobile
Daniel Leon - Qt on mobileDaniel Leon - Qt on mobile
Daniel Leon - Qt on mobile
 
Mihai Nadas - Windows Azure Media Services
Mihai Nadas - Windows Azure Media ServicesMihai Nadas - Windows Azure Media Services
Mihai Nadas - Windows Azure Media Services
 

Similar to Iasi code camp 20 april 2013 implement-quality-java-massol-codecamp

Enterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo JanschEnterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo Jansch
dpc
 
Intro to PHP Testing
Intro to PHP TestingIntro to PHP Testing
Intro to PHP Testing
Ran Mizrahi
 
Intro to JavaScript Testing
Intro to JavaScript TestingIntro to JavaScript Testing
Intro to JavaScript Testing
Ran Mizrahi
 

Similar to Iasi code camp 20 april 2013 implement-quality-java-massol-codecamp (20)

Implementing quality in Java projects
Implementing quality in Java projectsImplementing quality in Java projects
Implementing quality in Java projects
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on 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
 
Enterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo JanschEnterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo Jansch
 
Improve unit tests with Mutants!
Improve unit tests with Mutants!Improve unit tests with Mutants!
Improve unit tests with Mutants!
 
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
 
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)
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversing
 
Mutation testing Bucharest Tech Week
Mutation testing Bucharest Tech WeekMutation testing Bucharest Tech Week
Mutation testing Bucharest Tech Week
 
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
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
Intro to JavaScript Testing
Intro to JavaScript TestingIntro to JavaScript Testing
Intro to JavaScript Testing
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
Turbocharge Your Automation Framework to Shorten Regression Execution Time
Turbocharge Your Automation Framework to Shorten Regression Execution TimeTurbocharge Your Automation Framework to Shorten Regression Execution Time
Turbocharge Your Automation Framework to Shorten Regression Execution Time
 
HoloLens Unity Build Pipelines on Azure DevOps
HoloLens Unity Build Pipelines on Azure DevOpsHoloLens Unity Build Pipelines on Azure DevOps
HoloLens Unity Build Pipelines on Azure DevOps
 
Testing iOS Apps
Testing iOS AppsTesting iOS Apps
Testing iOS Apps
 
Advanced Java Testing
Advanced Java TestingAdvanced Java Testing
Advanced Java Testing
 
L08 Unit Testing
L08 Unit TestingL08 Unit Testing
L08 Unit Testing
 
We continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellWe continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShell
 

More from Codecamp Romania

More from Codecamp Romania (20)

Cezar chitac the edge of experience
Cezar chitac   the edge of experienceCezar chitac   the edge of experience
Cezar chitac the edge of experience
 
Cloud powered search
Cloud powered searchCloud powered search
Cloud powered search
 
Ccp
CcpCcp
Ccp
 
Business analysis techniques exercise your 6-pack
Business analysis techniques   exercise your 6-packBusiness analysis techniques   exercise your 6-pack
Business analysis techniques exercise your 6-pack
 
Bpm company code camp - configuration or coding with pega
Bpm company   code camp - configuration or coding with pegaBpm company   code camp - configuration or coding with pega
Bpm company code camp - configuration or coding with pega
 
Andrei prisacaru takingtheunitteststothedatabase
Andrei prisacaru takingtheunitteststothedatabaseAndrei prisacaru takingtheunitteststothedatabase
Andrei prisacaru takingtheunitteststothedatabase
 
Agility and life
Agility and lifeAgility and life
Agility and life
 
2015 dan ardelean develop for windows 10
2015 dan ardelean   develop for windows 10 2015 dan ardelean   develop for windows 10
2015 dan ardelean develop for windows 10
 
The bigrewrite
The bigrewriteThe bigrewrite
The bigrewrite
 
The case for continuous delivery
The case for continuous deliveryThe case for continuous delivery
The case for continuous delivery
 
Stefan stolniceanu spritekit, 2 d or not 2d
Stefan stolniceanu   spritekit, 2 d or not 2dStefan stolniceanu   spritekit, 2 d or not 2d
Stefan stolniceanu spritekit, 2 d or not 2d
 
Sizing epics tales from an agile kingdom
Sizing epics   tales from an agile kingdomSizing epics   tales from an agile kingdom
Sizing epics tales from an agile kingdom
 
Scale net apps in aws
Scale net apps in awsScale net apps in aws
Scale net apps in aws
 
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...
Raluca butnaru corina cilibiu   the unknown universe of a product and the cer...Raluca butnaru corina cilibiu   the unknown universe of a product and the cer...
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...
 
Parallel & async processing using tpl dataflow
Parallel & async processing using tpl dataflowParallel & async processing using tpl dataflow
Parallel & async processing using tpl dataflow
 
Material design screen transitions in android
Material design screen transitions in androidMaterial design screen transitions in android
Material design screen transitions in android
 
Kickstart your own freelancing career
Kickstart your own freelancing careerKickstart your own freelancing career
Kickstart your own freelancing career
 
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkit
Ionut grecu   the soft stuff is the hard stuff. the agile soft skills toolkitIonut grecu   the soft stuff is the hard stuff. the agile soft skills toolkit
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkit
 
Ecma6 in the wild
Ecma6 in the wildEcma6 in the wild
Ecma6 in the wild
 
Diana antohi me against myself or how to fail and move forward
Diana antohi   me against myself  or how to fail  and move forwardDiana antohi   me against myself  or how to fail  and move forward
Diana antohi me against myself or how to fail and move forward
 

Recently uploaded

Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
UK Journal
 

Recently uploaded (20)

FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 

Iasi code camp 20 april 2013 implement-quality-java-massol-codecamp

  • 1. Implementing Quality on Java projects Vincent Massol Committer XWiki CTO XWiki SAS @vmassol Sunday, April 21, 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 Sunday, April 21, 13
  • 4. The XWiki project in summary • 9 years old • 28 active committers • 7 committers do 80% of work • 700K NCLOC • 11 commits/ day Sunday, April 21, 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) Sunday, April 21, 13
  • 6. Quality Tip #1 API Stability Sunday, April 21, 13
  • 7. The Problem Class Not Found or Method Not Found Sunday, April 21, 13
  • 8. API Stability - Deprecations /** * ... * @deprecated since 2.4M1 use {@link #transform( * Block, TransformationContext)} */ @Deprecated void transform(XDOM dom, Syntax syntax) throws TransformationException; Sunday, April 21, 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> ... Sunday, April 21, 13
  • 10. API Stability - CLIRR (2/2) Example from XWiki 5.0M1 Release notes Sunday, April 21, 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> Sunday, April 21, 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</...> ... Sunday, April 21, 13
  • 13. API Stability - Young APIs /** * ... * @since 5.0M1 */ @Unstable(<optional explanation>) public EntityReference createEntityReference(String name,...) { ... } + max duration for keeping the annotation! Sunday, April 21, 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"); } Sunday, April 21, 13
  • 15. Quality Tip #2 JAR Hell Sunday, April 21, 13
  • 16. The Problem Class Not Found or Method Not Found or not working feature Sunday, April 21, 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> ... Sunday, April 21, 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! Sunday, April 21, 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! Sunday, April 21, 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> Sunday, April 21, 13
  • 21. Quality Tip #3 Test Coverage Sunday, April 21, 13
  • 22. The Problem More bugs reported, overall quality goes down and harder to debug software Sunday, April 21, 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>} Sunday, April 21, 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 Sunday, April 21, 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? Sunday, April 21, 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! Sunday, April 21, 13
  • 27. Quality Tip #4 Functional Testing Stability Sunday, April 21, 13
  • 28. The Problem Too many false positives leading to developers not paying attention to CI emails anymore... leading to failing software Sunday, April 21, 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) Sunday, April 21, 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 } } Sunday, April 21, 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) } Sunday, April 21, 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 Sunday, April 21, 13
  • 33. Results + use the Scriptler plugin to automate configuration for all jobs Sunday, April 21, 13
  • 34. Quality Tip #5 Bug Fixing Day Sunday, April 21, 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 Sunday, April 21, 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!) Sunday, April 21, 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) Sunday, April 21, 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 Sunday, April 21, 13