SlideShare a Scribd company logo
Agile TESTING 
Practices ON THE Java 
Platform 
Creative development in principle 
Peter Pilgrim 
Scala and Java EE 
Independent contractor 
@peter_pilgrim 
uk.linkedin.com/in/peterpilgrim2000/
Creative Commons 2.0 
Attribution-NonCommercial-ShareAlike 2.0 UK: 
England & Wales (CC BY-NC-SA 2.0 UK) 
https://creativecommons.org/licenses/by-nc-sa/2.0/uk/ 
• Share — copy and redistribute the material in 
any medium or format 
• Adapt — remix, transform, and build upon the 
material 
• The licensor cannot revoke these freedoms as 
long as you follow the license terms. 
Xenonique 
2
Xenonique 
About Me 
• Scala and Java EE developer independent 
contractor 
• Digital transformation GOV.UK 
• Java Champion 
• Working on the JVM since 1998 
3
Xenonique 
Java EE 7 
Developer 
Handbook 
September 
2013 
Packt 
Publishing 
Digital 
Java EE 7 
Web APPS 
December 
2014 
4
Xenonique 
5 
• TDD 
• Java Technology 
• Creative 
Development in 
Principle 
• Scala Technology
Xenonique 
6
Xenonique 
7
Xenonique 
Is TDD Dead? 
• TDD is Dead, Long Live Testing 
Blog article by David Heinemeier Hanson 
http://david.heinemeierhansson.com/2014/tdd-is-dead-long-live- 
testing.html 
• Series of 5 Google Hangout Videos 
@dhh, @kentbeck and @martinfowler 
http://martinfowler.com/articles/is-tdd-dead/ 
8
Xenonique 
9 
“I rarely unit test in the traditional sense 
of the word, where all dependencies are 
mocked out, and thousands of tests can 
close in seconds. It just hasn't been a 
useful way of dealing with the testing of 
Rails applications.” D.H.H
Xenonique 
10
Xenonique 
11 
JUnit 
the 
mother 
of 
all 
unit 
tesFng 
frameworks
Xenonique 
12 
#1 Java unit testing framework on 
the JVM. Other alternate languages have 
variants or interoperability.
Xenonique 
13 
2007 JUnit 4.4 
XMLUnit, DBTest, HTMLUnit, PerfTest, 
EasyMock, Test NG, Cactus, SoapUI
Xenonique 
14 
2014 - JUnit 4.12? 
Mockito, Concordion, Spring, JMock, Arquillian, 
Fit/Fitnesse, JBehave, ScalaTest, Spock
JUnit Test Example #1 
import org.junit.*; 
import static org.junit.Assert.assertThat; 
import static org.hamcrest.CoreMatchers.*; 
public class ForexTradingDeskTest { 
TradingDesk desk = 
Xenonique 
new ForexTradingDesk(); 
/* ... */ 
} 
15
JUnit Test Example #2 
public class ForexTradingDeskTest { 
@Before public void setUp() { 
Xenonique 
desk.acquire(); 
} 
@After public void tearDown() { 
desk.release(); 
} 
/* ... */ 
} 
16
Java Test Example #3 
@Test 
public void shouldExecuteTrade() { 
Trade trade = 
ForexTrade("GBP","EUR", 10000); 
desk.execute(trade); 
assertThat( trade.getStatus(), 
Xenonique 
is(Executed)); 
} 
17
Xenonique 
18
Xenonique 
19
Xenonique 
20 
These tools were built for the mother 
language of the Java Virtual Machine.
Xenonique 
21 
Sadly, these tools do not work too with:
Xenonique 
22
Three development concepts 
for agile digital applications 
Xenonique 
23 
Efficiency 
Design 
Human 
Nature
Xenonique 
24 
#1 
Understanding the 
Efficiency of our 
Java application 
development
30.7% Github projects* 
have a dependency on JUnit. 
Yet we, Java developers, still write 
too much boilerplate, 
over-engineer design patterns. 
We forget about directing 
the future. 
*http://www.takipiblog.com/we-analyzed-30000-github-projects-here-are-the-top-100-libraries-in-java-js-and-ruby/ 
Xenonique 
25
Xenonique 
26 
Hard-­‐coded 
dependencies 
and 
unassailable 
fixtures 
are 
the 
issues. 
It 
does 
not 
maNer 
which 
technology.
Java is a programming language. 
Java is a virtual machine. 
Java is a platform. 
Xenonique 
27 
Technology is not the problem. 
How much do we understand design and 
architecture?
Xenonique 
28 
#1 Completeness: 
As digital transformation engineers, what would happen to 
admitted: we can never have 100% coverage 
complete with just unit-tests? 
What are we measuring? How are we measuring? 
Impossible to prove all branches in a program
Xenonique 
29 
#1 Efficiency: 
Prefer to write tests than none at all 
Prefer to mock out dependencies 
Prefer to test the simplest thing possible 
Avoid duplication (cut and paste tests) 
Reduce fixtures and preconditions
#1 Efficiency: 
Prefer integration tests over unit tests. 
Remove unit tests that over time are always ”green”. 
Rely on functional and acceptance tests as well. 
Xenonique 
30 
Hire a developer-in-test into your team 
Avoid being a unit-test automaton.
Xenonique 
31 
#2 The age-old 
issue of how do we 
Design? 
Time, space and cost are 
constants
Xenonique 
32 
“TEX would have been a complete failure if I 
had merely specified it and not participated 
fully in its initial implementation. The process 
of implementation constantly led me to 
unanticipated questions and to new insights 
about how the original specifications could be 
improved.” Donald Knuth
Xenonique 
33 
#2 
Design 
Test-­‐First 
may 
be 
harmful 
True 
design 
presupposes 
we 
have 
ability 
to 
escape 
restric@ons. 
It 
requires 
to 
innovate 
around 
the 
architectural 
boundaries. 
Edit 
-­‐> 
Compile 
-­‐> 
Test 
-­‐> 
Refactor
Xenonique 
34 
#2 
Design 
Our 
problem 
is 
abstrac@on 
“Debugging 
is 
not 
what 
you 
do 
when 
you 
fire 
up 
the 
debugger. 
It 
is 
when 
you 
lie 
back 
in 
the 
chair 
and 
look 
at 
the 
ceiling.” 
Crea@vity 
is 
a 
thought 
process
Xenonique 
35 
#2 
Design 
– 
Problem 
solving 
versus 
art 
Balance 
crea@vity 
whilst 
respecFng 
produc@vity 
and 
testability
Xenonique 
36 
#2 
Design 
– 
search 
the 
Internet 
for 
a 
video 
Bret 
Victor, 
Inven@ng 
on 
Principle
Xenonique 
37 
#3 Human Nature 
It’s always about the folk. 
How long did it take to learn this simple truth in computer science?
Xenonique 
38 
#3 Human Nature 
Now it is about everyone on the planet 
We are serving the digital customers for all the screens of our lives
Xenonique 
39 
#3 Human Nature 
Developers require UX education. 
We cannot afford to not invest in learning. 
Digital transformation is open for all people.
Xenonique 
40 
#3 Human Nature 
“He said it was more important that the 
company avoid the appearance of having 
done something wrong than that we stop 
before producing an incorrect result. I left 
the company.“ 
Jim Coplien, Why Unit Testing is a Waste 
hNp://www.rbcs-­‐us.com/documents/Why-­‐Most-­‐Unit-­‐TesFng-­‐is-­‐Waste.pdf
#3 Human Nature 
Good developers are generally good writers. 
Great developers can create 
AM #1: “Interactions and individuals over processes and tools” 
Xenonique 
41
Xenonique 
42
Xenonique 
Scala Test #1 
import collection.mutable.Stack 
import org.scalatest._ 
class StackSpec extends 
FlatSpec with Matchers { 
/* ... */ 
} 
43
Xenonique 
Scala Test #2 
class StackSpec extends FlatSpec with Matchers { 
"A Stack" should 
"pop values in last-in-first-out order" in 
{ 
val stack = new Stack[Int] 
stack.push(1) 
stack.push(2) 
stack.pop() should be (2) 
stack.pop() should be (1) 
} 
/* ... */ 
} 
44
Xenonique 
Scala Test #3 
class StackSpec extends FlatSpec with Matchers { 
/* ... */ 
it should 
"throw NoSuchElementException if an empty 
stack is popped" 
in { 
val emptyStack = new Stack[Int] 
a [NoSuchElementException] 
should be thrownBy { 
emptyStack.pop() 
} 
} 
} 
45
How to avoid null pointers in 
Xenonique 
Scala Programming? 
val greeting1: Option[String] = 
Some("AOTB14") 
val greeting2: Option[String] = None 
46
Xenonique 
Pattern Matching 
def checker(p : Option[String]): String = { 
p match { 
case Some(v) => v 
case _ => "Unexpected" 
} 
} 
checker(greeting1) // "Hello AOTB14" 
checker(greeting2) // "Unspecified" 
47
Scala’s generic immutable list 
Xenonique 
collection type 
val list: List[Int] = List(1,2,3,4) 
list.foreach { x => println(x) } 
// 1,2,3,4 
48
Scala’s option behaves like 
Xenonique 
collection type #2 
greeting1.foreach { x => 
println(s"Work: ${x}" ) } 
// Work: Hello AOTB14 
greeting2.foreach { x => 
println(s"Work: ${x}" ) } 
// *** nothing happens *** 
49
Read, Evaluate, Print, Loop 
• Scala, Clojure, Groovy, Kotlin, Ceylon, Fantom 
All have a interpretative mode 
• Java JDK does not (yet) have an official REPL 
(However try out javarepl.com online) 
• Fingers crossed Project Kulla in JDK 9 
http://blog.gmane.org/gmane.comp.java.openjdk.general 
Xenonique 
50
Xenonique 
51 
#DailyWork2014 GOV.UK 
• Develop Scala applications 
• Play Framework, RESTful Services, MongoDB 
• Cucumber testing: acceptance & functional 
• Collaborative design, pairing and reviews 
• SCRUM, Sometimes Kanban 
• Physical storyboards, retros, planning 
• Heavy dose of UX / User Centric 
• Government Digital Service
Xenonique 
52 
• TDD 
• Java Technology 
• Creative 
Development in 
Principle 
• Scala Technology
Xenonique 
53
Xenonique 
Recipe for Success 
• Be creative and artistic again 
• Leave a digital legacy of achievement 
• Be efficient, evolve design and aware of 
human nature 
• Invent your own principles 
54
Xenonique 
55 
@peter_pilgrim 
uk.linkedin.com/in/peterpilgrim2000/
List of Creative Commons (2.0) 
photography attributions 
https://flic.kr/p/ayqvZp 
https://www.flickr.com/photos/throughpaintedeyes/ 
Ryan Seyeau Follow 
1000 Faces of Canada # 0084 - Zombie Walk - Explore! 
Shot during the annual Zombie Walk in Ottawa. 
https://flic.kr/p/Pp93n 
https://www.flickr.com/photos/spacesuitcatalyst/ 
William A. Clark Follow 
Measurement 
Measure twice, cut once. 
https://flic.kr/p/81dXuT 
https://www.flickr.com/photos/froboy/ 
Avi Schwab Follow 
Equipment used for measuring planes of crystals 
https://flic.kr/p/2QHt7Q 
https://www.flickr.com/photos/rosefirerising/ 
rosefirerising Follow 
Pierre Curie, Piezo-Electroscope 
Xenonique 
56
List of Creative Commons (2.0) 
photography attributions 
https://www.flickr.com/photos/code_martial/ 
https://flic.kr/p/7jmU5n 
Tahir Hashmi Follow 
Developer Death 
10 Programmers and a UX Designer died all of a sudden in a war room situation. They were 
apparently working too hard. 
https://www.flickr.com/photos/8268882@N06/ 
https://flic.kr/p/duwd1M 
Peter Pilgrim 
IMG_1481 
European JUG leaders meeting in Devoxx 2013 
https://www.flickr.com/photos/unicefethiopia/ 
https://flic.kr/p/dv4ooi 
UNICEF Ethiopia Follow 
Hamer mother and child South Omo Zone, SNNPR 
Hamer mother and child South Omo Zone, SNNPR. 
©UNICEF Ethiopia/2005/Getachew 
Xenonique 
57
List of Creative Commons (2.0) 
photography attributions 
https://www.flickr.com/photos/15216811@N06/ 
https://flic.kr/p/baULpM 
N i c o l a Follow 
Tree - IMG_1242 
https://flic.kr/p/dwCQ7t 
https://www.flickr.com/photos/90585146@N08/ 
marsmetn tallahassee Follow 
IDA .. Integro-Differential Analyzer (Sept., 1952) ...item 2.. Richard Dreyfuss: Technology Has 'Killed Time' -- "In geopolitics, the removal of time is fatal." -- "And 
you will give up, the protection of Republican Democracy." (July 19 2010) ... 
https://flic.kr/p/6ZDbiZ 
https://www.flickr.com/photos/ingmar/ 
Ingmar Zahorsky Follow 
Traffic Jam 
Accidents are common on the narrow streets going through the mountains of Nepal. When such an accident occurs, traffic is often halted for up to 3-4 hours. 
https://flic.kr/p/opvVsg 
https://www.flickr.com/photos/gregbeatty/ 
Greg Beatty Follow 
Three Pillars 
Nikon D800 16-35MM F4.0 
https://flic.kr/p/FAskC 
https://www.flickr.com/photos/mari1008/ 
mari_1008 Follow 
traffic jam -B 
Date: April,2th 
Address: Jiangshu Rd,Shanghai,China. 
Around 8:30 AM today, A little accident on YuYuan Rd and JiangSu Rd caused traffic jam. 
Xenonique 
58
List of Creative Commons (2.0) 
photography attributions 
https://flic.kr/p/bpss6D 
https://www.flickr.com/photos/76029035@N02/ 
Victor1558 Follow 
Creative_Photoshop_HD_Wallpapers_laba.ws 
https://flic.kr/p/4SHJzX 
https://www.flickr.com/photos/20745656@N00/ 
Maryellen McFadden Follow 
Japanese Graphic Design 
Poster designed for a Charles Renee Macintosh exhibit by Shinnoske, Inc. and I don't 
have the date. 
https://flic.kr/p/gLPhEk 
https://www.flickr.com/photos/stevecorey/ 
Steve Corey Follow 
Treasure Hunt, a short story (5 images) 
Xenonique 
59
List of Creative Commons (2.0) 
photography attributions 
https://flic.kr/p/4JcerK 
https://www.flickr.com/photos/16949884@N00/ 
Bömmel Follow 
Ice Crystal 
Ice is nice 
https://flic.kr/p/dSsXiZ 
https://www.flickr.com/photos/jeremyhall/ 
Jeremy Hall Follow 
Called to Serve (suit and tie) 
https://flic.kr/p/3enERy 
https://www.flickr.com/photos/paolocampioni/ 
Paolo Campioni Follow 
scala 
Scendo (stair case spiral) 
Xenonique 
60
List of Creative Commons (2.0) 
photography attributions 
https://flic.kr/p/m62gmK 
https://www.flickr.com/photos/lata/ 
-p Follow 
Abstraction I. 
From my platycerium. (Guide: Voronoi diagram) 
https://flic.kr/p/6WSFR4 
https://www.flickr.com/photos/62337512@N00/ 
anthony kelly Follow 
big ben 
big ben and underground sign 
https://flic.kr/p/4riATM 
https://www.flickr.com/photos/stevecadman/ 
Steve Cadman Follow 
Marsham Street 
Marsham Street (The Home Office), Westminster, London (2000-5) by Terry Farrell and Partners 
Xenonique 
61

More Related Content

PPTX
JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...
PDF
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
PDF
How to code to code less
PPTX
Clean Pragmatic Architecture - Avoiding a Monolith
PDF
CDI 2.0 is coming
PDF
Hybrid Apps (Native + Web) via QtWebKit
PDF
Introduction to cdi given at java one 2014
PDF
Functional Reactive Programming in the Netflix API
JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
How to code to code less
Clean Pragmatic Architecture - Avoiding a Monolith
CDI 2.0 is coming
Hybrid Apps (Native + Web) via QtWebKit
Introduction to cdi given at java one 2014
Functional Reactive Programming in the Netflix API

What's hot (20)

PDF
Extending Java EE with CDI and JBoss Forge
PPT
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
PDF
Java11 New Features
PDF
Asynchronous Programming at Netflix
PDF
Gradle plugin, take control of the build
PDF
OpenDaylight Developers Experience 1.5: Eclipse Setup, HOT reload, future plans
PDF
Gradle plugins, take it to the next level
PDF
Java 9 New Features
PDF
BMO - Intelligent Projects with Maven
PDF
Multiplatform Apps with Spring, Kotlin, and RSocket
PDF
The Proxy Fairy and the Magic of Spring @JAX Mainz 2021
PDF
Front End Development for Backend Developers - GIDS 2019
PDF
Guice tutorial
PDF
EJB Part-1
PDF
Bootiful Development with Spring Boot and React - UberConf 2018
PDF
Hyper-pragmatic Pure FP testing with distage-testkit
PDF
Hibernate and Spring - Unleash the Magic
PDF
Desiging for Modularity with Java 9
PDF
Java 10 New Features
PDF
Scala, Functional Programming and Team Productivity
Extending Java EE with CDI and JBoss Forge
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
Java11 New Features
Asynchronous Programming at Netflix
Gradle plugin, take control of the build
OpenDaylight Developers Experience 1.5: Eclipse Setup, HOT reload, future plans
Gradle plugins, take it to the next level
Java 9 New Features
BMO - Intelligent Projects with Maven
Multiplatform Apps with Spring, Kotlin, and RSocket
The Proxy Fairy and the Magic of Spring @JAX Mainz 2021
Front End Development for Backend Developers - GIDS 2019
Guice tutorial
EJB Part-1
Bootiful Development with Spring Boot and React - UberConf 2018
Hyper-pragmatic Pure FP testing with distage-testkit
Hibernate and Spring - Unleash the Magic
Desiging for Modularity with Java 9
Java 10 New Features
Scala, Functional Programming and Team Productivity
Ad

Similar to AOTB2014: Agile Testing on the Java Platform (20)

PDF
QCon 2015 Scala for the Enterprise: Get FuNkEd Up on the JVM
PDF
Lean Engineering: How to make Engineering a full Lean UX partner
PPTX
Ensuring Software Quality in the cloud
PPTX
Test parallelization using Jenkins
PDF
Implementing Quality on a Java Project
PPTX
DefCore: The Interoperability Standard for OpenStack
PDF
Enabling Lean at Enterprise Scale: Lean Engineering in Action
PDF
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
PDF
Level Up Your Integration Testing With Testcontainers
PDF
Testing in FrontEnd World by Nikita Galkin
PDF
Turbocharge Your Automation Framework to Shorten Regression Execution Time
PDF
In cluster open source testing framework - Microservices Meetup
PDF
DockerCon SF 2015: Keynote Day 1
PDF
AQA_You are_Soaking_In_It_DevNexus2020
PDF
Никита Галкин "Testing in Frontend World"
PDF
Continuous Testing
PDF
ConSol_IBM_webcast_quarkus_the_blue_hedgehog_of_java_web_frameworks
PDF
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
PDF
XWiki Testing with TestContainers
PDF
Iasi code camp 20 april 2013 implement-quality-java-massol-codecamp
QCon 2015 Scala for the Enterprise: Get FuNkEd Up on the JVM
Lean Engineering: How to make Engineering a full Lean UX partner
Ensuring Software Quality in the cloud
Test parallelization using Jenkins
Implementing Quality on a Java Project
DefCore: The Interoperability Standard for OpenStack
Enabling Lean at Enterprise Scale: Lean Engineering in Action
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
Level Up Your Integration Testing With Testcontainers
Testing in FrontEnd World by Nikita Galkin
Turbocharge Your Automation Framework to Shorten Regression Execution Time
In cluster open source testing framework - Microservices Meetup
DockerCon SF 2015: Keynote Day 1
AQA_You are_Soaking_In_It_DevNexus2020
Никита Галкин "Testing in Frontend World"
Continuous Testing
ConSol_IBM_webcast_quarkus_the_blue_hedgehog_of_java_web_frameworks
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
XWiki Testing with TestContainers
Iasi code camp 20 april 2013 implement-quality-java-massol-codecamp
Ad

More from Peter Pilgrim (12)

PDF
Devoxx 2019 - Why we pair?
PDF
Cloud native java are we there yet go tech world 2019
PDF
LJC 2018 - PEAT UK - Java EE - Ah, ah, ah! Staying Alive!
PDF
CON6148 - You Are Not Cut Out To Be A Java Contractor - JavaOne 2017
PDF
Java EE & Glass Fish User Group: Digital JavaEE 7 - New and Noteworthy
PDF
BOF2644 Developing Java EE 7 Scala apps
PDF
JavaCro 2014 Scala and Java EE 7 Development Experiences
PDF
JavaCro 2014 Digital Development with Java EE and Java Platform
PDF
ACCU 2013 Taking Scala into the Enterpise
PDF
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
PDF
JavaOne 2011 Progressive JavaFX 2.0 Custom Components
PDF
ACCU 2011 Introduction to Scala: An Object Functional Programming Language
Devoxx 2019 - Why we pair?
Cloud native java are we there yet go tech world 2019
LJC 2018 - PEAT UK - Java EE - Ah, ah, ah! Staying Alive!
CON6148 - You Are Not Cut Out To Be A Java Contractor - JavaOne 2017
Java EE & Glass Fish User Group: Digital JavaEE 7 - New and Noteworthy
BOF2644 Developing Java EE 7 Scala apps
JavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Digital Development with Java EE and Java Platform
ACCU 2013 Taking Scala into the Enterpise
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
JavaOne 2011 Progressive JavaFX 2.0 Custom Components
ACCU 2011 Introduction to Scala: An Object Functional Programming Language

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
KodekX | Application Modernization Development
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
Approach and Philosophy of On baking technology
Advanced methodologies resolving dimensionality complications for autism neur...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Programs and apps: productivity, graphics, security and other tools
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KodekX | Application Modernization Development
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Electronic commerce courselecture one. Pdf
Empathic Computing: Creating Shared Understanding
sap open course for s4hana steps from ECC to s4
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Unlocking AI with Model Context Protocol (MCP)
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
NewMind AI Weekly Chronicles - August'25 Week I
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Understanding_Digital_Forensics_Presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...

AOTB2014: Agile Testing on the Java Platform

  • 1. Agile TESTING Practices ON THE Java Platform Creative development in principle Peter Pilgrim Scala and Java EE Independent contractor @peter_pilgrim uk.linkedin.com/in/peterpilgrim2000/
  • 2. Creative Commons 2.0 Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales (CC BY-NC-SA 2.0 UK) https://creativecommons.org/licenses/by-nc-sa/2.0/uk/ • Share — copy and redistribute the material in any medium or format • Adapt — remix, transform, and build upon the material • The licensor cannot revoke these freedoms as long as you follow the license terms. Xenonique 2
  • 3. Xenonique About Me • Scala and Java EE developer independent contractor • Digital transformation GOV.UK • Java Champion • Working on the JVM since 1998 3
  • 4. Xenonique Java EE 7 Developer Handbook September 2013 Packt Publishing Digital Java EE 7 Web APPS December 2014 4
  • 5. Xenonique 5 • TDD • Java Technology • Creative Development in Principle • Scala Technology
  • 8. Xenonique Is TDD Dead? • TDD is Dead, Long Live Testing Blog article by David Heinemeier Hanson http://david.heinemeierhansson.com/2014/tdd-is-dead-long-live- testing.html • Series of 5 Google Hangout Videos @dhh, @kentbeck and @martinfowler http://martinfowler.com/articles/is-tdd-dead/ 8
  • 9. Xenonique 9 “I rarely unit test in the traditional sense of the word, where all dependencies are mocked out, and thousands of tests can close in seconds. It just hasn't been a useful way of dealing with the testing of Rails applications.” D.H.H
  • 11. Xenonique 11 JUnit the mother of all unit tesFng frameworks
  • 12. Xenonique 12 #1 Java unit testing framework on the JVM. Other alternate languages have variants or interoperability.
  • 13. Xenonique 13 2007 JUnit 4.4 XMLUnit, DBTest, HTMLUnit, PerfTest, EasyMock, Test NG, Cactus, SoapUI
  • 14. Xenonique 14 2014 - JUnit 4.12? Mockito, Concordion, Spring, JMock, Arquillian, Fit/Fitnesse, JBehave, ScalaTest, Spock
  • 15. JUnit Test Example #1 import org.junit.*; import static org.junit.Assert.assertThat; import static org.hamcrest.CoreMatchers.*; public class ForexTradingDeskTest { TradingDesk desk = Xenonique new ForexTradingDesk(); /* ... */ } 15
  • 16. JUnit Test Example #2 public class ForexTradingDeskTest { @Before public void setUp() { Xenonique desk.acquire(); } @After public void tearDown() { desk.release(); } /* ... */ } 16
  • 17. Java Test Example #3 @Test public void shouldExecuteTrade() { Trade trade = ForexTrade("GBP","EUR", 10000); desk.execute(trade); assertThat( trade.getStatus(), Xenonique is(Executed)); } 17
  • 20. Xenonique 20 These tools were built for the mother language of the Java Virtual Machine.
  • 21. Xenonique 21 Sadly, these tools do not work too with:
  • 23. Three development concepts for agile digital applications Xenonique 23 Efficiency Design Human Nature
  • 24. Xenonique 24 #1 Understanding the Efficiency of our Java application development
  • 25. 30.7% Github projects* have a dependency on JUnit. Yet we, Java developers, still write too much boilerplate, over-engineer design patterns. We forget about directing the future. *http://www.takipiblog.com/we-analyzed-30000-github-projects-here-are-the-top-100-libraries-in-java-js-and-ruby/ Xenonique 25
  • 26. Xenonique 26 Hard-­‐coded dependencies and unassailable fixtures are the issues. It does not maNer which technology.
  • 27. Java is a programming language. Java is a virtual machine. Java is a platform. Xenonique 27 Technology is not the problem. How much do we understand design and architecture?
  • 28. Xenonique 28 #1 Completeness: As digital transformation engineers, what would happen to admitted: we can never have 100% coverage complete with just unit-tests? What are we measuring? How are we measuring? Impossible to prove all branches in a program
  • 29. Xenonique 29 #1 Efficiency: Prefer to write tests than none at all Prefer to mock out dependencies Prefer to test the simplest thing possible Avoid duplication (cut and paste tests) Reduce fixtures and preconditions
  • 30. #1 Efficiency: Prefer integration tests over unit tests. Remove unit tests that over time are always ”green”. Rely on functional and acceptance tests as well. Xenonique 30 Hire a developer-in-test into your team Avoid being a unit-test automaton.
  • 31. Xenonique 31 #2 The age-old issue of how do we Design? Time, space and cost are constants
  • 32. Xenonique 32 “TEX would have been a complete failure if I had merely specified it and not participated fully in its initial implementation. The process of implementation constantly led me to unanticipated questions and to new insights about how the original specifications could be improved.” Donald Knuth
  • 33. Xenonique 33 #2 Design Test-­‐First may be harmful True design presupposes we have ability to escape restric@ons. It requires to innovate around the architectural boundaries. Edit -­‐> Compile -­‐> Test -­‐> Refactor
  • 34. Xenonique 34 #2 Design Our problem is abstrac@on “Debugging is not what you do when you fire up the debugger. It is when you lie back in the chair and look at the ceiling.” Crea@vity is a thought process
  • 35. Xenonique 35 #2 Design – Problem solving versus art Balance crea@vity whilst respecFng produc@vity and testability
  • 36. Xenonique 36 #2 Design – search the Internet for a video Bret Victor, Inven@ng on Principle
  • 37. Xenonique 37 #3 Human Nature It’s always about the folk. How long did it take to learn this simple truth in computer science?
  • 38. Xenonique 38 #3 Human Nature Now it is about everyone on the planet We are serving the digital customers for all the screens of our lives
  • 39. Xenonique 39 #3 Human Nature Developers require UX education. We cannot afford to not invest in learning. Digital transformation is open for all people.
  • 40. Xenonique 40 #3 Human Nature “He said it was more important that the company avoid the appearance of having done something wrong than that we stop before producing an incorrect result. I left the company.“ Jim Coplien, Why Unit Testing is a Waste hNp://www.rbcs-­‐us.com/documents/Why-­‐Most-­‐Unit-­‐TesFng-­‐is-­‐Waste.pdf
  • 41. #3 Human Nature Good developers are generally good writers. Great developers can create AM #1: “Interactions and individuals over processes and tools” Xenonique 41
  • 43. Xenonique Scala Test #1 import collection.mutable.Stack import org.scalatest._ class StackSpec extends FlatSpec with Matchers { /* ... */ } 43
  • 44. Xenonique Scala Test #2 class StackSpec extends FlatSpec with Matchers { "A Stack" should "pop values in last-in-first-out order" in { val stack = new Stack[Int] stack.push(1) stack.push(2) stack.pop() should be (2) stack.pop() should be (1) } /* ... */ } 44
  • 45. Xenonique Scala Test #3 class StackSpec extends FlatSpec with Matchers { /* ... */ it should "throw NoSuchElementException if an empty stack is popped" in { val emptyStack = new Stack[Int] a [NoSuchElementException] should be thrownBy { emptyStack.pop() } } } 45
  • 46. How to avoid null pointers in Xenonique Scala Programming? val greeting1: Option[String] = Some("AOTB14") val greeting2: Option[String] = None 46
  • 47. Xenonique Pattern Matching def checker(p : Option[String]): String = { p match { case Some(v) => v case _ => "Unexpected" } } checker(greeting1) // "Hello AOTB14" checker(greeting2) // "Unspecified" 47
  • 48. Scala’s generic immutable list Xenonique collection type val list: List[Int] = List(1,2,3,4) list.foreach { x => println(x) } // 1,2,3,4 48
  • 49. Scala’s option behaves like Xenonique collection type #2 greeting1.foreach { x => println(s"Work: ${x}" ) } // Work: Hello AOTB14 greeting2.foreach { x => println(s"Work: ${x}" ) } // *** nothing happens *** 49
  • 50. Read, Evaluate, Print, Loop • Scala, Clojure, Groovy, Kotlin, Ceylon, Fantom All have a interpretative mode • Java JDK does not (yet) have an official REPL (However try out javarepl.com online) • Fingers crossed Project Kulla in JDK 9 http://blog.gmane.org/gmane.comp.java.openjdk.general Xenonique 50
  • 51. Xenonique 51 #DailyWork2014 GOV.UK • Develop Scala applications • Play Framework, RESTful Services, MongoDB • Cucumber testing: acceptance & functional • Collaborative design, pairing and reviews • SCRUM, Sometimes Kanban • Physical storyboards, retros, planning • Heavy dose of UX / User Centric • Government Digital Service
  • 52. Xenonique 52 • TDD • Java Technology • Creative Development in Principle • Scala Technology
  • 54. Xenonique Recipe for Success • Be creative and artistic again • Leave a digital legacy of achievement • Be efficient, evolve design and aware of human nature • Invent your own principles 54
  • 55. Xenonique 55 @peter_pilgrim uk.linkedin.com/in/peterpilgrim2000/
  • 56. List of Creative Commons (2.0) photography attributions https://flic.kr/p/ayqvZp https://www.flickr.com/photos/throughpaintedeyes/ Ryan Seyeau Follow 1000 Faces of Canada # 0084 - Zombie Walk - Explore! Shot during the annual Zombie Walk in Ottawa. https://flic.kr/p/Pp93n https://www.flickr.com/photos/spacesuitcatalyst/ William A. Clark Follow Measurement Measure twice, cut once. https://flic.kr/p/81dXuT https://www.flickr.com/photos/froboy/ Avi Schwab Follow Equipment used for measuring planes of crystals https://flic.kr/p/2QHt7Q https://www.flickr.com/photos/rosefirerising/ rosefirerising Follow Pierre Curie, Piezo-Electroscope Xenonique 56
  • 57. List of Creative Commons (2.0) photography attributions https://www.flickr.com/photos/code_martial/ https://flic.kr/p/7jmU5n Tahir Hashmi Follow Developer Death 10 Programmers and a UX Designer died all of a sudden in a war room situation. They were apparently working too hard. https://www.flickr.com/photos/8268882@N06/ https://flic.kr/p/duwd1M Peter Pilgrim IMG_1481 European JUG leaders meeting in Devoxx 2013 https://www.flickr.com/photos/unicefethiopia/ https://flic.kr/p/dv4ooi UNICEF Ethiopia Follow Hamer mother and child South Omo Zone, SNNPR Hamer mother and child South Omo Zone, SNNPR. ©UNICEF Ethiopia/2005/Getachew Xenonique 57
  • 58. List of Creative Commons (2.0) photography attributions https://www.flickr.com/photos/15216811@N06/ https://flic.kr/p/baULpM N i c o l a Follow Tree - IMG_1242 https://flic.kr/p/dwCQ7t https://www.flickr.com/photos/90585146@N08/ marsmetn tallahassee Follow IDA .. Integro-Differential Analyzer (Sept., 1952) ...item 2.. Richard Dreyfuss: Technology Has 'Killed Time' -- "In geopolitics, the removal of time is fatal." -- "And you will give up, the protection of Republican Democracy." (July 19 2010) ... https://flic.kr/p/6ZDbiZ https://www.flickr.com/photos/ingmar/ Ingmar Zahorsky Follow Traffic Jam Accidents are common on the narrow streets going through the mountains of Nepal. When such an accident occurs, traffic is often halted for up to 3-4 hours. https://flic.kr/p/opvVsg https://www.flickr.com/photos/gregbeatty/ Greg Beatty Follow Three Pillars Nikon D800 16-35MM F4.0 https://flic.kr/p/FAskC https://www.flickr.com/photos/mari1008/ mari_1008 Follow traffic jam -B Date: April,2th Address: Jiangshu Rd,Shanghai,China. Around 8:30 AM today, A little accident on YuYuan Rd and JiangSu Rd caused traffic jam. Xenonique 58
  • 59. List of Creative Commons (2.0) photography attributions https://flic.kr/p/bpss6D https://www.flickr.com/photos/76029035@N02/ Victor1558 Follow Creative_Photoshop_HD_Wallpapers_laba.ws https://flic.kr/p/4SHJzX https://www.flickr.com/photos/20745656@N00/ Maryellen McFadden Follow Japanese Graphic Design Poster designed for a Charles Renee Macintosh exhibit by Shinnoske, Inc. and I don't have the date. https://flic.kr/p/gLPhEk https://www.flickr.com/photos/stevecorey/ Steve Corey Follow Treasure Hunt, a short story (5 images) Xenonique 59
  • 60. List of Creative Commons (2.0) photography attributions https://flic.kr/p/4JcerK https://www.flickr.com/photos/16949884@N00/ Bömmel Follow Ice Crystal Ice is nice https://flic.kr/p/dSsXiZ https://www.flickr.com/photos/jeremyhall/ Jeremy Hall Follow Called to Serve (suit and tie) https://flic.kr/p/3enERy https://www.flickr.com/photos/paolocampioni/ Paolo Campioni Follow scala Scendo (stair case spiral) Xenonique 60
  • 61. List of Creative Commons (2.0) photography attributions https://flic.kr/p/m62gmK https://www.flickr.com/photos/lata/ -p Follow Abstraction I. From my platycerium. (Guide: Voronoi diagram) https://flic.kr/p/6WSFR4 https://www.flickr.com/photos/62337512@N00/ anthony kelly Follow big ben big ben and underground sign https://flic.kr/p/4riATM https://www.flickr.com/photos/stevecadman/ Steve Cadman Follow Marsham Street Marsham Street (The Home Office), Westminster, London (2000-5) by Terry Farrell and Partners Xenonique 61