Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
#DevoxxFR
Functional Configuration Testing
with Docker & TestContainers
Vincent Massol @vmassol
1
#DevoxxFR
Use Case: XWiki
2
Application with functional tests, e.g. web app & UI tests
Database
Servlet Engine
Webapp (XWi...
#DevoxxFR
DB Type DB Version
JDBC
Driver
Servlet
E.Type
Servlet E.
Version
Browser
Type
Browser
Version
Other
5.7.24 5.1.4...
#DevoxxFR
Docker Container #3Docker Container #2Docker Container #1
Solution: Dockerization
4
Use Docker to represent the ...
#DevoxxFR
Implementation 1: Jenkins
5
Dependency on CI, not able to run & debug locally
pipeline {
agent {
docker {
image ...
#DevoxxFR
Implementation 2: Maven
6
Dependency on Maven, not easy to debug in IDE
<plugin>
 <groupId>io.fabric8</groupId>
...
#DevoxxFR
Implementation 3: TestContainers
7
@Testcontainers

public class MyTestcontainersTests {
@Container

private sta...
#DevoxxFR
XWiki & TestContainers
8
@UITest(

database = Database.MYSQL,

databaseTag = "5",

servletEngine = ServletEngine...
#DevoxxFR 9
Demo Time
#DevoxxFR
TestContainers Features
10
• Several built-in Containers: MySQL, PostgreSQL,
Selenium/WebDriver, ElasticSearch, ...
#DevoxxFR
Conclusion
11
• Very easy to reproduce/debug problems from production
• Supports about everything including Dock...
Prochain SlideShare
Chargement dans…5
×

Configuration Testing with Docker & TestContainers

220 vues

Publié le

Testing different configuration of your software on the developer machine, directly from your IDE.

Presented at Devoxx FR 2019

Video at https://youtu.be/0TvWv4L_IJM

Publié dans : Technologie
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

Configuration Testing with Docker & TestContainers

  1. 1. #DevoxxFR Functional Configuration Testing with Docker & TestContainers Vincent Massol @vmassol 1
  2. 2. #DevoxxFR Use Case: XWiki 2 Application with functional tests, e.g. web app & UI tests Database Servlet Engine Webapp (XWiki) Browser JDBCHTTP
  3. 3. #DevoxxFR DB Type DB Version JDBC Driver Servlet E.Type Servlet E. Version Browser Type Browser Version Other 5.7.24 5.1.45 8.5.35 63.0 N/A 9.6.8 42.1.4 Latest 9.x 70.0.3538. 77 Solr External 2.4.1 2.4.1 9.4.12 60.0.2 Clustering Latest 10.3.x Latest 9.4.8.v201 71121 67.0.3396. 87 LibreOffice Server Problem: Configurations 3 Validate that XWiki works on supported configurations
  4. 4. #DevoxxFR Docker Container #3Docker Container #2Docker Container #1 Solution: Dockerization 4 Use Docker to represent the various configurations Database Servlet Engine Webapp (XWiki) Browser
  5. 5. #DevoxxFR Implementation 1: Jenkins 5 Dependency on CI, not able to run & debug locally pipeline { agent { docker { image 'xwiki-maven-firefox' args '-v $HOME/.m2:/root/.m2' } } stages { stage('Test') { steps { docker.image('mysql:5').withRun('-e "MYSQL_ROOT_PASSWORD=my-secret-pw"') { c -> docker.image('tomcat:8').withRun('-v $XWIKIDIR:/usr/local/tomcat/webapps/ xwiki').inside("--link ${c.id}:db") { [...]
  6. 6. #DevoxxFR Implementation 2: Maven 6 Dependency on Maven, not easy to debug in IDE <plugin>  <groupId>io.fabric8</groupId>  <artifactId>docker-maven-plugin</artifactId>  <configuration>    <imagePullPolicy>IfNotPresent</imagePullPolicy>    <images> […]
  7. 7. #DevoxxFR Implementation 3: TestContainers 7 @Testcontainers
 public class MyTestcontainersTests { @Container
 private static final MySQLContainer MY_SQL_CONTAINER = new MySQLContainer(); @Container
 private PostgreSQLContainer pgsqlContainer = new PostgreSQLContainer()
 .withDatabaseName("foo")
 .withUsername("foo")
 .withPassword("secret"); Best solution so far: Reproduce and debug locally and in IDE testcontainers.org
  8. 8. #DevoxxFR XWiki & TestContainers 8 @UITest(
 database = Database.MYSQL,
 databaseTag = "5",
 servletEngine = ServletEngine.TOMCAT,
 servletEngineTag = "8",
 browser = Browser.CHROME) public class MenuIT Custom JUnit5 Extension, makes it easy to use for XWiki devs Selenium test here
  9. 9. #DevoxxFR 9 Demo Time
  10. 10. #DevoxxFR TestContainers Features 10 • Several built-in Containers: MySQL, PostgreSQL, Selenium/WebDriver, ElasticSearch, Nginx, and a lot more… even a DockerCompose one! • Automatically record videos • Automatic and powerful clean up of containers • Full Docker API available (uses docker-java underneath) • Create Docker images on the fly
  11. 11. #DevoxxFR Conclusion 11 • Very easy to reproduce/debug problems from production • Supports about everything including Docker Outside of Docker (DOOD) • Consistent behavior: didn’t notice many false positives due to the environment Configuration Testing in your IDE testcontainers.org

×