SlideShare a Scribd company logo
1 of 84
Download to read offline
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
Part 2 :: Spring Boot Testing
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
2
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
3
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
4
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
5
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
6
Topics
What types of testing ?
Spring Boot Testing
Why do we testing ?
Demo
Q/A
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
7
https://wingman-sw.com/
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
8
https://wingman-sw.com/
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
9
Software Delivery
https://martinfowler.com/articles/practical-test-pyramid.html
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
10
Technical excellence
https://less.works/less/technical-excellence/index
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
11
https://less.works/less/technical-excellence/index
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
12
"Program testing can be used
to show the presence of bugs,


but never their absence."
Edsger W. Dijkstra, 1970, Notes on Structured Programming
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
13
Start with Why …
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
14
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
15
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
16
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
17
Why we need to test ?
Boosted confidence
Quality code
Help you to catch bugs
Enforce modularity of your project
Develop features faster
Better documentation
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
18
But,


It’s take time to learning and
practice !!
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
19
Why not write automated tests ?
https://slack.engineering/android-ui-automation-part-1-building-trust-de3deb1c5995
Not enough time !!!
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
20
What kind of test should we
write ?
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
21
Key success factors
Whole team solve problems
Whole team thinks about testing
Whole team committed to quality
Everyone collaborates
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
22
Iterative and incremental process
Time
Feature 1
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
23
Iterative and incremental process
Time
Feature 1
Done = coded and tested
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
24
Iterative and incremental process
Time
Feature 1 Feature 1
Feature 2
Done = coded and tested
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
25
Iterative and incremental process
Time
Feature 1 Feature 1
Feature 2
Feature 1
Feature 2
Feature 3
Done = coded and tested
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
26
Iterative and incremental process
Time
Feature 1 Feature 1
Feature 2
Feature 1
Feature 2
Feature 3
Feature 1
Feature 2
Feature 3
Feature 4
Done = coded and tested
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
27
Iterative and incremental process
Time
Feature 1 Feature 1
Feature 2
Feature 1
Feature 2
Feature 3
Feature 1
Feature 2
Feature 3
Feature 4
Done = coded and tested
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
28
We need automation !!
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
29
Iterative and incremental process
Time
Feature 1 Feature 1
Feature 2
Feature 1
Feature 2
Feature 3
Feature 1
Feature 2
Feature 3
Feature 4
Done = coded and tested
Automation


done
Automation


done
Automation


done
Automation


done
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
30
Fast feedback loop
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
31
Continuous testing
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
32
Continuous improvement
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
33
Why should you automate ?
Manual checking take too long
Manual checks are error prone
Free people to do their best work
Provides living document
Repeatable
Save time
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
34
Testing pyramid
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
35
Ice-cream testing
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
36
Testing Pyramid
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
37
Testing Pyramid
Feature
Story
Task
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
38
Testing Pyramid
https://martinfowler.com/bliki/TestPyramid.html
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
39
https://less.works/less/technical-excellence/unit-testing.html
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
40
Find vs Prevent
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
41
Mind-set switch
Instead of
We are here to find bug
We are here to ensure requirement are met
We are here to break the software
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
42
Mind-set switch
Instead of
We are here to find bug
We are here to ensure requirement are met
We are here to break the software
Think
What can I do to help deliver the software
successfully !!
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
43
Understand Why => What and
How to test ?
Discussion is very important
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
44
Remember !!
Test pyramid is a tool
To talk about automation tasks
How to prioritise and help to do automation ?
Way to make visible to the whole team
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
45
Where to start ?
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
46
What are the biggest
obstacles ?




Time/Tools/System/People
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
47
What should be careful ?
Automating end-to-end tests
User Interface are slow
Working with database
Working with external system
Automating every paths
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
48
Test strategies
https://martinfowler.com/articles/microservice-testing/
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
49
Spring Boot
TDD and Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
50
Why ?
Application skeleton generator
Reduce effort to add new technologies
TDD and Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
51
Spring vs Spring Boot
TDD and Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
52
What ?
Embedded application server
Integration with tools/technologies (starter)
Production tools (monitoring, health check)
Configuration management
Dev tools
No source code generation, no XML
TDD and Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
Spring boot
Spring boot
53
How ?
Spring boot
Apache Tomcat
JAR file
$mvn spring-boot:run
$java -jar demo.jar
TDD and Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
Spring boot
Spring boot
54
How ?
Spring boot
WAR
Apache Tomcat
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
55
Basic structure of Spring Boot
Controller
DB
Repository
Service
Gateway
External
system
https://docs.spring.io/spring-boot/docs/current/reference/html/using-spring-boot.html#using-boot-structuring-your-code
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
56
Controller
Request and Response
Validation input
Delegate to others classes such as service and
repository
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
57
Service
Control the flow of main business logics
Manage database transaction
Don’t reuse service
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
58
Repository
Manage data in data store such as RDBMS and
NoSQL
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
59
Gateway
Call external service via network such as
WebServices and RESTful APIs
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
60
Spring Boot Testing
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
61
Hype cycle
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
62
Spring Boot Testing
Unit Tests
Sliced Tests


(unit test + spring)
Integration
https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
63
Spring Boot Testing
Unit Tests
Sliced Tests
Integration
@SpringBootTest
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
64
Spring Boot Testing
Unit Tests
Sliced Tests
Integration
@SpringBootTest
@WebMvcTest
@WebFluxTest
@DataJpaTest
@JDBCTest
@DataMongoTest
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
65
Spring Boot Testing
Unit Tests
Sliced Tests
Integration
@SpringBootTest
@WebMvcTest
@WebFluxTest
@DataJpaTest
@JDBCTest
@DataMongoTest
@Mock
Working with Mockito
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
66
What to test ?
Controller Repository
Service
Gateway
DB
External
system
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
67
@SpringBootTest
Controller Repository
Service
Gateway
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
68
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT
)

class UserControllerTest
{

@Autowire
d

TestRestTemplate restTemplate
;

@Autowire
d

private UserRepository userRepository
;

@Tes
t

void getUserById()
{

}

}
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
69
@SpringBootTest with External system
Controller Repository
Service
Gateway
DB
External
system
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
70
@RunWith(SpringRunner.class
)

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT
)

@AutoCon
fi
gureWireMock(port = 9999
)

public class PostGatewayComponentTest
{

@Autowire
d

private PostGateway postGateway
;

@Tes
t

public void getPostById() throws IOException {
}

}
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
71
@WebMvcTest
Controller Repository
Service
Gateway
DB
External
system
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
72
@WebMvcTest(UserController.class
)

class UserControllerWebMvcTest
{

@Autowire
d

private MockMvc mvc
;

@MockBea
n

private UserService userService
;

@Tes
t

void getUserById() throws Exception {
 

}

}
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
73
@DataJpaTest, @JdbcTest
Controller Repository
Service
Gateway
DB
External
system
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
74
@RunWith(SpringRunner.class
)

@DataJpaTes
t

public class UserRepositoryTest
{

@Autowire
d

private UserRepository userRepository
;

@Tes
t

public void found_user()
{

}

}
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
75
Test with Container
https://www.testcontainers.org/
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
76
Unit test with Mockito
Controller Service Repository
Gateway
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
77
@ExtendWith(MockitoExtension.class
)

class UserServiceTest
{

@Moc
k

private UserRepository userRepository
;

@Tes
t

void found_getData_by_id_1()
{

}

}
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
78
Integration testing with external
Controller Repository
Service
Gateway
DB
External
system
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
79
More tests with Spring
CDC (Consumer Driven contract )
https://spring.io/projects/spring-cloud-contract
Contract Testing
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
80
Contract testing with Pact
https://docs.pact.io/
Java Framework


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
81
Reduce risk with tests
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
82
Demo
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
83
มาเ
ริ่
ม
ฝึ
ก
ฝึ
ก และ
นำ
มาใ
ช้
งาน
กั
น
คิ
ด
ก่
อน
ท
ทำ
ดี
ดี
Spring Boot Testing


© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
84
วั
น
นี้
คุ
ณทดสอบระบบแ
ล้
วห
รื
อ
ยั
ง ?
Q/A

More Related Content

What's hot

Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.boyney123
 
SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design PrinciplesAndreas Enbohm
 
Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2José Paumard
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean ArchitectureBadoo
 
Cryptography 101 for Java Developers - JavaZone2019
Cryptography 101 for Java Developers - JavaZone2019Cryptography 101 for Java Developers - JavaZone2019
Cryptography 101 for Java Developers - JavaZone2019Michel Schudel
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentationVan Huong
 
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...Edureka!
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkHùng Nguyễn Huy
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Gunith Devasurendra
 
Dependency injection in Java, from naive to functional
Dependency injection in Java, from naive to functionalDependency injection in Java, from naive to functional
Dependency injection in Java, from naive to functionalMarian Wamsiedel
 
A Separation of Concerns: Clean Architecture on Android
A Separation of Concerns: Clean Architecture on AndroidA Separation of Concerns: Clean Architecture on Android
A Separation of Concerns: Clean Architecture on AndroidOutware Mobile
 

What's hot (20)

Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.
 
SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design Principles
 
Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
Unit Testing in Java
Unit Testing in JavaUnit Testing in Java
Unit Testing in Java
 
Cryptography 101 for Java Developers - JavaZone2019
Cryptography 101 for Java Developers - JavaZone2019Cryptography 101 for Java Developers - JavaZone2019
Cryptography 101 for Java Developers - JavaZone2019
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Spring boot
Spring bootSpring boot
Spring boot
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentation
 
Page object pattern
Page object patternPage object pattern
Page object pattern
 
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Test NG Framework Complete Walk Through
Test NG Framework Complete Walk ThroughTest NG Framework Complete Walk Through
Test NG Framework Complete Walk Through
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
 
Modern JS with ES6
Modern JS with ES6Modern JS with ES6
Modern JS with ES6
 
Dependency injection in Java, from naive to functional
Dependency injection in Java, from naive to functionalDependency injection in Java, from naive to functional
Dependency injection in Java, from naive to functional
 
Jdbc_ravi_2016
Jdbc_ravi_2016Jdbc_ravi_2016
Jdbc_ravi_2016
 
TypeScript - An Introduction
TypeScript - An IntroductionTypeScript - An Introduction
TypeScript - An Introduction
 
A Separation of Concerns: Clean Architecture on Android
A Separation of Concerns: Clean Architecture on AndroidA Separation of Concerns: Clean Architecture on Android
A Separation of Concerns: Clean Architecture on Android
 
Java OCA teoria 5
Java OCA teoria 5Java OCA teoria 5
Java OCA teoria 5
 

Similar to Part 2 :: Spring Boot testing

Amazon CI/CD Practices for Software Development Teams - SRV320 - Anaheim AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Anaheim AWS ...Amazon CI/CD Practices for Software Development Teams - SRV320 - Anaheim AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Anaheim AWS ...Amazon Web Services
 
Amazon CI/CD Practices for Software Development Teams - SRV320 - Chicago AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Chicago AWS ...Amazon CI/CD Practices for Software Development Teams - SRV320 - Chicago AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Chicago AWS ...Amazon Web Services
 
Amazon CI/CD Practices for Software Development Teams - SRV320 - Atlanta AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Atlanta AWS ...Amazon CI/CD Practices for Software Development Teams - SRV320 - Atlanta AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Atlanta AWS ...Amazon Web Services
 
Transforming Product Development - AWS Transformation Day 2018: Detroit
Transforming Product Development - AWS Transformation Day 2018: DetroitTransforming Product Development - AWS Transformation Day 2018: Detroit
Transforming Product Development - AWS Transformation Day 2018: DetroitAmazon Web Services
 
Transforming Product Development - AWS Transformation Day: Santa Clara 2018
Transforming Product Development - AWS Transformation Day: Santa Clara 2018Transforming Product Development - AWS Transformation Day: Santa Clara 2018
Transforming Product Development - AWS Transformation Day: Santa Clara 2018Amazon Web Services
 
Transforming Product Development- Transformation Day Philadelphia 2018
Transforming Product Development- Transformation Day Philadelphia 2018Transforming Product Development- Transformation Day Philadelphia 2018
Transforming Product Development- Transformation Day Philadelphia 2018Amazon Web Services
 
Transforming Product Development - AWS Transformation Day Boston 2018
Transforming Product Development - AWS Transformation Day Boston 2018Transforming Product Development - AWS Transformation Day Boston 2018
Transforming Product Development - AWS Transformation Day Boston 2018Amazon Web Services
 
ENT206 Product Development in the Cloud
ENT206 Product Development in the CloudENT206 Product Development in the Cloud
ENT206 Product Development in the CloudAmazon Web Services
 
How can metrics help in improving our effectiveness?
How can metrics help in improving our effectiveness?How can metrics help in improving our effectiveness?
How can metrics help in improving our effectiveness?Better Software
 
Transforming Product Development- AWS Transformation Day Raleigh 2018.pdf
Transforming Product Development- AWS Transformation Day Raleigh 2018.pdfTransforming Product Development- AWS Transformation Day Raleigh 2018.pdf
Transforming Product Development- AWS Transformation Day Raleigh 2018.pdfAmazon Web Services
 
vTalk#1 Microservices with Spring Boot
vTalk#1 Microservices with Spring BootvTalk#1 Microservices with Spring Boot
vTalk#1 Microservices with Spring BootSomkiat Puisungnoen
 
Transforming Product Development - Transformation Day Montreal 2018
Transforming Product Development - Transformation Day Montreal 2018Transforming Product Development - Transformation Day Montreal 2018
Transforming Product Development - Transformation Day Montreal 2018Amazon Web Services
 
Product Development in the Cloud
Product Development in the Cloud Product Development in the Cloud
Product Development in the Cloud Amazon Web Services
 
Transforming Product Development in the Cloud (ENT306) - AWS re:Invent 2018
Transforming Product Development in the Cloud (ENT306) - AWS re:Invent 2018Transforming Product Development in the Cloud (ENT306) - AWS re:Invent 2018
Transforming Product Development in the Cloud (ENT306) - AWS re:Invent 2018Amazon Web Services
 
Angular :: basic tuning performance
Angular :: basic tuning performanceAngular :: basic tuning performance
Angular :: basic tuning performanceSomkiat Puisungnoen
 
Developing a Testing Strategy for DevOps Success
Developing a Testing Strategy for DevOps SuccessDeveloping a Testing Strategy for DevOps Success
Developing a Testing Strategy for DevOps SuccessDevOps.com
 
Jennifer Scandariato: Transform Your Team from QA to Test Engineering
Jennifer Scandariato: Transform Your Team from QA to Test EngineeringJennifer Scandariato: Transform Your Team from QA to Test Engineering
Jennifer Scandariato: Transform Your Team from QA to Test EngineeringAnna Royzman
 
Transformation from QA to Test Engineering
Transformation from QA to Test EngineeringTransformation from QA to Test Engineering
Transformation from QA to Test EngineeringJennifer L. Scandariato
 

Similar to Part 2 :: Spring Boot testing (20)

Visual testing
Visual testingVisual testing
Visual testing
 
Amazon CI/CD Practices for Software Development Teams - SRV320 - Anaheim AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Anaheim AWS ...Amazon CI/CD Practices for Software Development Teams - SRV320 - Anaheim AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Anaheim AWS ...
 
Amazon CI/CD Practices for Software Development Teams - SRV320 - Chicago AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Chicago AWS ...Amazon CI/CD Practices for Software Development Teams - SRV320 - Chicago AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Chicago AWS ...
 
Next of Java 2022
Next of Java 2022Next of Java 2022
Next of Java 2022
 
Amazon CI/CD Practices for Software Development Teams - SRV320 - Atlanta AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Atlanta AWS ...Amazon CI/CD Practices for Software Development Teams - SRV320 - Atlanta AWS ...
Amazon CI/CD Practices for Software Development Teams - SRV320 - Atlanta AWS ...
 
Transforming Product Development - AWS Transformation Day 2018: Detroit
Transforming Product Development - AWS Transformation Day 2018: DetroitTransforming Product Development - AWS Transformation Day 2018: Detroit
Transforming Product Development - AWS Transformation Day 2018: Detroit
 
Transforming Product Development - AWS Transformation Day: Santa Clara 2018
Transforming Product Development - AWS Transformation Day: Santa Clara 2018Transforming Product Development - AWS Transformation Day: Santa Clara 2018
Transforming Product Development - AWS Transformation Day: Santa Clara 2018
 
Transforming Product Development- Transformation Day Philadelphia 2018
Transforming Product Development- Transformation Day Philadelphia 2018Transforming Product Development- Transformation Day Philadelphia 2018
Transforming Product Development- Transformation Day Philadelphia 2018
 
Transforming Product Development - AWS Transformation Day Boston 2018
Transforming Product Development - AWS Transformation Day Boston 2018Transforming Product Development - AWS Transformation Day Boston 2018
Transforming Product Development - AWS Transformation Day Boston 2018
 
ENT206 Product Development in the Cloud
ENT206 Product Development in the CloudENT206 Product Development in the Cloud
ENT206 Product Development in the Cloud
 
How can metrics help in improving our effectiveness?
How can metrics help in improving our effectiveness?How can metrics help in improving our effectiveness?
How can metrics help in improving our effectiveness?
 
Transforming Product Development- AWS Transformation Day Raleigh 2018.pdf
Transforming Product Development- AWS Transformation Day Raleigh 2018.pdfTransforming Product Development- AWS Transformation Day Raleigh 2018.pdf
Transforming Product Development- AWS Transformation Day Raleigh 2018.pdf
 
vTalk#1 Microservices with Spring Boot
vTalk#1 Microservices with Spring BootvTalk#1 Microservices with Spring Boot
vTalk#1 Microservices with Spring Boot
 
Transforming Product Development - Transformation Day Montreal 2018
Transforming Product Development - Transformation Day Montreal 2018Transforming Product Development - Transformation Day Montreal 2018
Transforming Product Development - Transformation Day Montreal 2018
 
Product Development in the Cloud
Product Development in the Cloud Product Development in the Cloud
Product Development in the Cloud
 
Transforming Product Development in the Cloud (ENT306) - AWS re:Invent 2018
Transforming Product Development in the Cloud (ENT306) - AWS re:Invent 2018Transforming Product Development in the Cloud (ENT306) - AWS re:Invent 2018
Transforming Product Development in the Cloud (ENT306) - AWS re:Invent 2018
 
Angular :: basic tuning performance
Angular :: basic tuning performanceAngular :: basic tuning performance
Angular :: basic tuning performance
 
Developing a Testing Strategy for DevOps Success
Developing a Testing Strategy for DevOps SuccessDeveloping a Testing Strategy for DevOps Success
Developing a Testing Strategy for DevOps Success
 
Jennifer Scandariato: Transform Your Team from QA to Test Engineering
Jennifer Scandariato: Transform Your Team from QA to Test EngineeringJennifer Scandariato: Transform Your Team from QA to Test Engineering
Jennifer Scandariato: Transform Your Team from QA to Test Engineering
 
Transformation from QA to Test Engineering
Transformation from QA to Test EngineeringTransformation from QA to Test Engineering
Transformation from QA to Test Engineering
 

More from Somkiat Puisungnoen (20)

Sck spring-reactive
Sck spring-reactiveSck spring-reactive
Sck spring-reactive
 
Lesson learned from React native and Flutter
Lesson learned from React native and FlutterLesson learned from React native and Flutter
Lesson learned from React native and Flutter
 
devops
devops devops
devops
 
Shared code between projects
Shared code between projectsShared code between projects
Shared code between projects
 
Distributed Tracing
Distributed Tracing Distributed Tracing
Distributed Tracing
 
Manage data of service
Manage data of serviceManage data of service
Manage data of service
 
RobotFramework Meetup at Thailand #2
RobotFramework Meetup at Thailand #2RobotFramework Meetup at Thailand #2
RobotFramework Meetup at Thailand #2
 
Cloud Native App
Cloud Native AppCloud Native App
Cloud Native App
 
Wordpress for Newbie
Wordpress for NewbieWordpress for Newbie
Wordpress for Newbie
 
Sck Agile in Real World
Sck Agile in Real WorldSck Agile in Real World
Sck Agile in Real World
 
Clean you code
Clean you codeClean you code
Clean you code
 
SCK Firestore at CNX
SCK Firestore at CNXSCK Firestore at CNX
SCK Firestore at CNX
 
Unhappiness Developer
Unhappiness DeveloperUnhappiness Developer
Unhappiness Developer
 
The Beauty of BAD code
The Beauty of  BAD codeThe Beauty of  BAD code
The Beauty of BAD code
 
React in the right way
React in the right wayReact in the right way
React in the right way
 
Rise of Container (RoC)
Rise of Container (RoC)Rise of Container (RoC)
Rise of Container (RoC)
 
SCK :: Scrum is NOT Enough
SCK :: Scrum is NOT EnoughSCK :: Scrum is NOT Enough
SCK :: Scrum is NOT Enough
 
Software Development Trends 2017 at IMC
Software Development Trends 2017 at IMCSoftware Development Trends 2017 at IMC
Software Development Trends 2017 at IMC
 
Design pattern with Java 8
Design pattern with Java 8Design pattern with Java 8
Design pattern with Java 8
 
Meetup :: Update Elastic Stack 5.0
Meetup :: Update Elastic Stack 5.0Meetup :: Update Elastic Stack 5.0
Meetup :: Update Elastic Stack 5.0
 

Recently uploaded

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 

Recently uploaded (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 

Part 2 :: Spring Boot testing

  • 1. © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. Part 2 :: Spring Boot Testing
  • 2. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 2
  • 3. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 3
  • 4. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 4
  • 5. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 5
  • 6. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 6 Topics What types of testing ? Spring Boot Testing Why do we testing ? Demo Q/A
  • 7. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 7 https://wingman-sw.com/
  • 8. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 8 https://wingman-sw.com/
  • 9. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 9 Software Delivery https://martinfowler.com/articles/practical-test-pyramid.html
  • 10. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 10 Technical excellence https://less.works/less/technical-excellence/index
  • 11. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 11 https://less.works/less/technical-excellence/index
  • 12. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 12 "Program testing can be used to show the presence of bugs, but never their absence." Edsger W. Dijkstra, 1970, Notes on Structured Programming
  • 13. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 13 Start with Why …
  • 14. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 14
  • 15. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 15
  • 16. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 16
  • 17. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 17 Why we need to test ? Boosted confidence Quality code Help you to catch bugs Enforce modularity of your project Develop features faster Better documentation
  • 18. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 18 But, It’s take time to learning and practice !!
  • 19. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 19 Why not write automated tests ? https://slack.engineering/android-ui-automation-part-1-building-trust-de3deb1c5995 Not enough time !!!
  • 20. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 20 What kind of test should we write ?
  • 21. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 21 Key success factors Whole team solve problems Whole team thinks about testing Whole team committed to quality Everyone collaborates
  • 22. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 22 Iterative and incremental process Time Feature 1
  • 23. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 23 Iterative and incremental process Time Feature 1 Done = coded and tested
  • 24. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 24 Iterative and incremental process Time Feature 1 Feature 1 Feature 2 Done = coded and tested
  • 25. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 25 Iterative and incremental process Time Feature 1 Feature 1 Feature 2 Feature 1 Feature 2 Feature 3 Done = coded and tested
  • 26. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 26 Iterative and incremental process Time Feature 1 Feature 1 Feature 2 Feature 1 Feature 2 Feature 3 Feature 1 Feature 2 Feature 3 Feature 4 Done = coded and tested
  • 27. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 27 Iterative and incremental process Time Feature 1 Feature 1 Feature 2 Feature 1 Feature 2 Feature 3 Feature 1 Feature 2 Feature 3 Feature 4 Done = coded and tested
  • 28. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 28 We need automation !!
  • 29. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 29 Iterative and incremental process Time Feature 1 Feature 1 Feature 2 Feature 1 Feature 2 Feature 3 Feature 1 Feature 2 Feature 3 Feature 4 Done = coded and tested Automation done Automation done Automation done Automation done
  • 30. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 30 Fast feedback loop
  • 31. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 31 Continuous testing
  • 32. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 32 Continuous improvement
  • 33. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 33 Why should you automate ? Manual checking take too long Manual checks are error prone Free people to do their best work Provides living document Repeatable Save time
  • 34. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 34 Testing pyramid
  • 35. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 35 Ice-cream testing
  • 36. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 36 Testing Pyramid
  • 37. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 37 Testing Pyramid Feature Story Task
  • 38. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 38 Testing Pyramid https://martinfowler.com/bliki/TestPyramid.html
  • 39. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 39 https://less.works/less/technical-excellence/unit-testing.html
  • 40. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 40 Find vs Prevent
  • 41. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 41 Mind-set switch Instead of We are here to find bug We are here to ensure requirement are met We are here to break the software
  • 42. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 42 Mind-set switch Instead of We are here to find bug We are here to ensure requirement are met We are here to break the software Think What can I do to help deliver the software successfully !!
  • 43. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 43 Understand Why => What and How to test ? Discussion is very important
  • 44. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 44 Remember !! Test pyramid is a tool To talk about automation tasks How to prioritise and help to do automation ? Way to make visible to the whole team
  • 45. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 45 Where to start ?
  • 46. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 46 What are the biggest obstacles ? Time/Tools/System/People
  • 47. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 47 What should be careful ? Automating end-to-end tests User Interface are slow Working with database Working with external system Automating every paths
  • 48. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 48 Test strategies https://martinfowler.com/articles/microservice-testing/
  • 49. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 49 Spring Boot
  • 50. TDD and Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 50 Why ? Application skeleton generator Reduce effort to add new technologies
  • 51. TDD and Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 51 Spring vs Spring Boot
  • 52. TDD and Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 52 What ? Embedded application server Integration with tools/technologies (starter) Production tools (monitoring, health check) Configuration management Dev tools No source code generation, no XML
  • 53. TDD and Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. Spring boot Spring boot 53 How ? Spring boot Apache Tomcat JAR file $mvn spring-boot:run $java -jar demo.jar
  • 54. TDD and Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. Spring boot Spring boot 54 How ? Spring boot WAR Apache Tomcat
  • 55. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 55 Basic structure of Spring Boot Controller DB Repository Service Gateway External system https://docs.spring.io/spring-boot/docs/current/reference/html/using-spring-boot.html#using-boot-structuring-your-code
  • 56. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 56 Controller Request and Response Validation input Delegate to others classes such as service and repository
  • 57. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 57 Service Control the flow of main business logics Manage database transaction Don’t reuse service
  • 58. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 58 Repository Manage data in data store such as RDBMS and NoSQL
  • 59. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 59 Gateway Call external service via network such as WebServices and RESTful APIs
  • 60. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 60 Spring Boot Testing
  • 61. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 61 Hype cycle
  • 62. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 62 Spring Boot Testing Unit Tests Sliced Tests (unit test + spring) Integration https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing
  • 63. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 63 Spring Boot Testing Unit Tests Sliced Tests Integration @SpringBootTest
  • 64. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 64 Spring Boot Testing Unit Tests Sliced Tests Integration @SpringBootTest @WebMvcTest @WebFluxTest @DataJpaTest @JDBCTest @DataMongoTest
  • 65. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 65 Spring Boot Testing Unit Tests Sliced Tests Integration @SpringBootTest @WebMvcTest @WebFluxTest @DataJpaTest @JDBCTest @DataMongoTest @Mock Working with Mockito
  • 66. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 66 What to test ? Controller Repository Service Gateway DB External system
  • 67. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 67 @SpringBootTest Controller Repository Service Gateway
  • 68. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 68 @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT ) class UserControllerTest { @Autowire d TestRestTemplate restTemplate ; @Autowire d private UserRepository userRepository ; @Tes t void getUserById() { } }
  • 69. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 69 @SpringBootTest with External system Controller Repository Service Gateway DB External system
  • 70. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 70 @RunWith(SpringRunner.class ) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT ) @AutoCon fi gureWireMock(port = 9999 ) public class PostGatewayComponentTest { @Autowire d private PostGateway postGateway ; @Tes t public void getPostById() throws IOException { } }
  • 71. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 71 @WebMvcTest Controller Repository Service Gateway DB External system
  • 72. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 72 @WebMvcTest(UserController.class ) class UserControllerWebMvcTest { @Autowire d private MockMvc mvc ; @MockBea n private UserService userService ; @Tes t void getUserById() throws Exception { } }
  • 73. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 73 @DataJpaTest, @JdbcTest Controller Repository Service Gateway DB External system
  • 74. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 74 @RunWith(SpringRunner.class ) @DataJpaTes t public class UserRepositoryTest { @Autowire d private UserRepository userRepository ; @Tes t public void found_user() { } }
  • 75. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 75 Test with Container https://www.testcontainers.org/
  • 76. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 76 Unit test with Mockito Controller Service Repository Gateway
  • 77. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 77 @ExtendWith(MockitoExtension.class ) class UserServiceTest { @Moc k private UserRepository userRepository ; @Tes t void found_getData_by_id_1() { } }
  • 78. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 78 Integration testing with external Controller Repository Service Gateway DB External system
  • 79. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 79 More tests with Spring CDC (Consumer Driven contract ) https://spring.io/projects/spring-cloud-contract Contract Testing
  • 80. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 80 Contract testing with Pact https://docs.pact.io/
  • 81. Java Framework © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 81 Reduce risk with tests
  • 82. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 82 Demo
  • 83. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 83 มาเ ริ่ ม ฝึ ก ฝึ ก และ นำ มาใ ช้ งาน กั น คิ ด ก่ อน ท ทำ ดี ดี
  • 84. Spring Boot Testing © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. 84 วั น นี้ คุ ณทดสอบระบบแ ล้ วห รื อ ยั ง ? Q/A