SlideShare a Scribd company logo
JUnit5 – Custom TestEngines
How to create your own TDD universe
Who is speaking?
• Sven Ruppert
• Developer Advocate – DevSecOps
• JFrog Inc
• Twitter: @SvenRuppert
• eMail: svenr@jfrog.com
THE AGENDA
The Junit5 Intro
JUnit5 – test your TestEngine
How to start your TestEngine
The basic structure of a TestEngine
How to define a Test
How to execute a TestPlan
Custom TestEngines – Ideas
The Junit5 Intro
Subject to test
Preparations
Clean Up
Subject to test
Preparations
Clean Up
Global Preparations
Global Clean Up
The Junit5 Intro
Subject to test
Preparations
Clean Up
Subject to test
Preparations
Clean Up
Global Preparations
Global Clean Up
context
context
Context
Preparations / Clean up must be fast
Easy if this is symmetric
How to deal with exceptions?
Different Tests -> different preparations / context
The Junit5 Intro
Subject to test
Preparations
Clean Up
Subject to test
Preparations
Clean Up
Global Preparations
Global Clean Up
context
context
Context
TestGroupI
TestGroupII
TestGroupIII
The Junit5 Intro
Subjecttotest
Preparations
CleanUp
Subjecttotest
Preparations
CleanUp
GlobalPreparations
GlobalCleanUp
context
context
Context
Test Group I
Subjecttotest
Preparations
CleanUp
Subjecttotest
Preparations
CleanUp
GlobalPreparations
GlobalCleanUp
context
context
Context
Test Group II
TestengineI
The Junit5 Intro
The Junit5 Intro
@Test
@ExtendWith
ExtensionContext
LifeCycle - Management
Subject to test
Preparations
Clean Up
Global Preparations
Global Clean Up
context
Context
TestGroupI
}
The Junit5 Intro
The Junit5 Intro
The Junit5 Intro
The Junit5 Intro
The Junit5 Intro
BeforeEach - ABeforeEach - B
BeforeAll - B BeforeAll - A
AfterEach - BAfterEach - A
AfterAll - A AfterAll - B
The Junit5 Intro
The Junit5 Intro
@Test
void test001(Demo demo){
Assertions.assertEquals("Hello World",
demo.value());
}
The Junit5 Intro
public static class DemoParameterResolver implements ParameterResolver {
@Override
public boolean supportsParameter(ParameterContext parameterContext,
ExtensionContext extensionContext)
throws ParameterResolutionException {
final Class<?> type = parameterContext.getParameter().getType();
return Demo.class.isAssignableFrom(type);
}
@Override
public Object resolveParameter(ParameterContext parameterContext,
ExtensionContext extensionContext)
throws ParameterResolutionException {
return new Demo(1, "Hello World");
}
}
The Junit5 Intro
@Test
@ExtendWith(DemoParameterResolver.class)
void test001(Demo demo){
Assertions.assertEquals("Hello World", demo.value());
}
The Junit5 Intro
JUnit5 – test your TestEngine
How to test a TestEngine?
We need a way to test a new TestEngine
As first exercise we will test an existing TestEngine
JUnit5 – test your TestEngine
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-testkit</artifactId>
<version>${junit5.version}</version>
<scope>test</scope>
</dependency>
JUnit5 – test your TestEngine
Two tests are started / one test is disabled
One test is failing
JUnit5 – test your TestEngine
Two tests started
One Test positive
One Test skipped
One Test failed
JUnit5 – test your TestEngine
How to start your TestEngine
Discovery the Tests
prepare the Launcher
create the TestPlan
register Listeners
execute Launcher
consume the Result
How to start your TestEngine
The basic structure of a Testengine
Basic Structure to build a Custom TestEngine
No real Test-Discovery in the first run
Production code - the Test-Engine
Test code - the Test-Engine-Tests
Test the custom Test-Engine with the Jupiter-Engine
The basic structure of a TestEngine
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-engine</artifactId>
<version>${junit.platform.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>${junit.platform.version}</version>
<scope>compile</scope>
</dependency>
The basic structure of a TestEngine
<!-- needed for writing integration tests-->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>${junit.platform.version}</version>
<scope>compile</scope>
</dependency>
The basic structure of a TestEngine
[ 1 containers found ]
[ 0 containers skipped ]
[ 1 containers started ]
[ 0 containers aborted ]
[ 1 containers successful ]
[ 0 containers failed ]
[ 0 tests found ]
[ 0 tests skipped ]
[ 0 tests started ]
[ 0 tests aborted ]
[ 0 tests successful ]
[ 0 tests failed ]
The basic structure of a TestEngine
How to define a Test
Find all tests with the Annotation @NanoTest
Execute all discovered tests
IDE should be able to execute the test
Maven should be able to execute the test
How to define a Test
How to define a Test
How to define a Test
How to define a Test
How to define a Test
How to define a Test
How to define a TestPlan
How to define a TestPlan
How to define a TestPlan
How to define a TestPlan
A TestDescriptor is a Node inside the TestPlan
A Node can be a Container or a Test
A Test is a leaf from this tree
A Descriptor can be a Container and a Test at the same time
A good start is the AbstractTestDescriptor
How to define a TestPlan
How to define a TestPlan
How to execute a TestPlan
How to execute a TestPlan
How to execute a TestPlan
How to execute a TestPlan
How to execute a TestPlan
How to execute a TestPlan
@NanoTestClass
public class FirstNanoTest {
@NanoTest
void test001_A() { }
}
Custom TestEngines - Ideas
Add a Lic Check for your commercial product
Store runtime metrics
Authentication / Authorisation
Domain – Specific – Testdefinition
Complex Infrastructure Lifecycle Management
Dynamic Testinput from external sources
Testtechniques – like MutationTesting
Persistent Immutable Testplans
Testexecution Priorities
Distributed TestPlan-Execution
IDE or maven
Testplan
TestClass
TestMethod
Execution-Nodes
JFrog - Artifactory
SecurityPayload Generator Injection
Store a TestPlan with the BuildInfo
Load binary data from Artifactory – Generic Repo
SecurityPayload Generator Injection
Store a TestResults with the BuildInfo
Repo
Testplan
Repo
SecurityPayload
TestResultRepo
Artifactory / XRay and how to use it
Internet
REST API / WebUI
RulePolicyWatch
Repo
Try it : OnPrem and/or Cloud
https://jfrog.com/platform/free-trial/
Just try it
THANK YOU!
• Sven Ruppert
• Developer Advocate – DevSecOps
• Jfrog Inc
• Twitter: @SvenRuppert
• eMail: svenr@jfrog.com

More Related Content

What's hot

C++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing FrameworkC++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing Framework
Humberto Marchezi
 
Google mock for dummies
Google mock for dummiesGoogle mock for dummies
Google mock for dummies
Harry Potter
 
Automated testing in Python and beyond
Automated testing in Python and beyondAutomated testing in Python and beyond
Automated testing in Python and beyond
dn
 
Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++
Hong Le Van
 
TestNG introduction
TestNG introductionTestNG introduction
TestNG introduction
Denis Bazhin
 
Python unit testing
Python unit testingPython unit testing
Python unit testing
Darryl Sherman
 
Junit
JunitJunit
Clean Unit Test Patterns
Clean Unit Test PatternsClean Unit Test Patterns
Clean Unit Test Patterns
Frank Appel
 
Unit Testing with Python
Unit Testing with PythonUnit Testing with Python
Unit Testing with Python
MicroPyramid .
 
Test driven development - JUnit basics and best practices
Test driven development - JUnit basics and best practicesTest driven development - JUnit basics and best practices
Test driven development - JUnit basics and best practices
Narendra Pathai
 
Workshop unit test
Workshop   unit testWorkshop   unit test
Workshop unit test
Francesco Garavaglia
 
OSGi Applications Testing - André Elia Assad, System Engineer, Cesar
OSGi Applications Testing - André Elia Assad, System Engineer, CesarOSGi Applications Testing - André Elia Assad, System Engineer, Cesar
OSGi Applications Testing - André Elia Assad, System Engineer, Cesar
mfrancis
 
TestNG
TestNGTestNG
Unit test
Unit testUnit test
Test NG Framework Complete Walk Through
Test NG Framework Complete Walk ThroughTest NG Framework Complete Walk Through
Test NG Framework Complete Walk Through
Narendran Solai Sridharan
 
TestNG Framework
TestNG Framework TestNG Framework
TestNG Framework
Levon Apreyan
 
Writing good unit test
Writing good unit testWriting good unit test
Writing good unit test
Lucy Lu
 
Unit testing with JUnit
Unit testing with JUnitUnit testing with JUnit
Unit testing with JUnit
Thomas Zimmermann
 
Junit and testNG
Junit and testNGJunit and testNG
Junit and testNG
Марія Русин
 
Unit test
Unit testUnit test
Unit test
Tran Duc
 

What's hot (20)

C++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing FrameworkC++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing Framework
 
Google mock for dummies
Google mock for dummiesGoogle mock for dummies
Google mock for dummies
 
Automated testing in Python and beyond
Automated testing in Python and beyondAutomated testing in Python and beyond
Automated testing in Python and beyond
 
Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++
 
TestNG introduction
TestNG introductionTestNG introduction
TestNG introduction
 
Python unit testing
Python unit testingPython unit testing
Python unit testing
 
Junit
JunitJunit
Junit
 
Clean Unit Test Patterns
Clean Unit Test PatternsClean Unit Test Patterns
Clean Unit Test Patterns
 
Unit Testing with Python
Unit Testing with PythonUnit Testing with Python
Unit Testing with Python
 
Test driven development - JUnit basics and best practices
Test driven development - JUnit basics and best practicesTest driven development - JUnit basics and best practices
Test driven development - JUnit basics and best practices
 
Workshop unit test
Workshop   unit testWorkshop   unit test
Workshop unit test
 
OSGi Applications Testing - André Elia Assad, System Engineer, Cesar
OSGi Applications Testing - André Elia Assad, System Engineer, CesarOSGi Applications Testing - André Elia Assad, System Engineer, Cesar
OSGi Applications Testing - André Elia Assad, System Engineer, Cesar
 
TestNG
TestNGTestNG
TestNG
 
Unit test
Unit testUnit test
Unit test
 
Test NG Framework Complete Walk Through
Test NG Framework Complete Walk ThroughTest NG Framework Complete Walk Through
Test NG Framework Complete Walk Through
 
TestNG Framework
TestNG Framework TestNG Framework
TestNG Framework
 
Writing good unit test
Writing good unit testWriting good unit test
Writing good unit test
 
Unit testing with JUnit
Unit testing with JUnitUnit testing with JUnit
Unit testing with JUnit
 
Junit and testNG
Junit and testNGJunit and testNG
Junit and testNG
 
Unit test
Unit testUnit test
Unit test
 

Similar to JUnit5 Custom TestEngines intro - version 2020-06

Test automation principles, terminologies and implementations
Test automation principles, terminologies and implementationsTest automation principles, terminologies and implementations
Test automation principles, terminologies and implementations
Steven Li
 
Test Driven Development with Sql Server
Test Driven Development with Sql ServerTest Driven Development with Sql Server
Test Driven Development with Sql Server
David P. Moore
 
Unit Testing in .NET Core 7.0 with XUnit.pptx
Unit Testing in .NET Core 7.0 with XUnit.pptxUnit Testing in .NET Core 7.0 with XUnit.pptx
Unit Testing in .NET Core 7.0 with XUnit.pptx
Knoldus Inc.
 
Testing 2: Advanced Test Management
Testing 2: Advanced Test Management Testing 2: Advanced Test Management
Testing 2: Advanced Test Management
Inflectra
 
Unit testing php-unit - phing - selenium_v2
Unit testing   php-unit - phing - selenium_v2Unit testing   php-unit - phing - selenium_v2
Unit testing php-unit - phing - selenium_v2
Tricode (part of Dept)
 
utPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQLutPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQL
Steven Feuerstein
 
Tdd dev session
Tdd dev sessionTdd dev session
Tdd dev session
Danyllo Albuquerque
 
Test ng for testers
Test ng for testersTest ng for testers
Test ng for testers
Colombo Selenium Meetup
 
Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023
Scott Keck-Warren
 
JUnit- A Unit Testing Framework
JUnit- A Unit Testing FrameworkJUnit- A Unit Testing Framework
JUnit- A Unit Testing Framework
Onkar Deshpande
 
ISTQB / ISEB Foundation Exam Practice - 2
ISTQB / ISEB Foundation Exam Practice - 2ISTQB / ISEB Foundation Exam Practice - 2
ISTQB / ISEB Foundation Exam Practice - 2
Yogindernath Gupta
 
Application Testing
Application TestingApplication Testing
Application Testing
Reggie Niccolo Santos
 
2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier
Christian Hujer
 
Unit testing in Unity
Unit testing in UnityUnit testing in Unity
Unit testing in Unity
Mikko McMenamin
 
ISTQB, ISEB Lecture Notes- 2
ISTQB, ISEB Lecture Notes- 2ISTQB, ISEB Lecture Notes- 2
ISTQB, ISEB Lecture Notes- 2
onsoftwaretest
 
ISTQB Foundation - Chapter 2
ISTQB Foundation - Chapter 2ISTQB Foundation - Chapter 2
ISTQB Foundation - Chapter 2
Chandukar
 
Testing Django Applications
Testing Django ApplicationsTesting Django Applications
Testing Django Applications
Gareth Rushgrove
 
Into The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applications
Ortus Solutions, Corp
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
Baskar K
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Sergey Aganezov
 

Similar to JUnit5 Custom TestEngines intro - version 2020-06 (20)

Test automation principles, terminologies and implementations
Test automation principles, terminologies and implementationsTest automation principles, terminologies and implementations
Test automation principles, terminologies and implementations
 
Test Driven Development with Sql Server
Test Driven Development with Sql ServerTest Driven Development with Sql Server
Test Driven Development with Sql Server
 
Unit Testing in .NET Core 7.0 with XUnit.pptx
Unit Testing in .NET Core 7.0 with XUnit.pptxUnit Testing in .NET Core 7.0 with XUnit.pptx
Unit Testing in .NET Core 7.0 with XUnit.pptx
 
Testing 2: Advanced Test Management
Testing 2: Advanced Test Management Testing 2: Advanced Test Management
Testing 2: Advanced Test Management
 
Unit testing php-unit - phing - selenium_v2
Unit testing   php-unit - phing - selenium_v2Unit testing   php-unit - phing - selenium_v2
Unit testing php-unit - phing - selenium_v2
 
utPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQLutPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQL
 
Tdd dev session
Tdd dev sessionTdd dev session
Tdd dev session
 
Test ng for testers
Test ng for testersTest ng for testers
Test ng for testers
 
Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023
 
JUnit- A Unit Testing Framework
JUnit- A Unit Testing FrameworkJUnit- A Unit Testing Framework
JUnit- A Unit Testing Framework
 
ISTQB / ISEB Foundation Exam Practice - 2
ISTQB / ISEB Foundation Exam Practice - 2ISTQB / ISEB Foundation Exam Practice - 2
ISTQB / ISEB Foundation Exam Practice - 2
 
Application Testing
Application TestingApplication Testing
Application Testing
 
2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier
 
Unit testing in Unity
Unit testing in UnityUnit testing in Unity
Unit testing in Unity
 
ISTQB, ISEB Lecture Notes- 2
ISTQB, ISEB Lecture Notes- 2ISTQB, ISEB Lecture Notes- 2
ISTQB, ISEB Lecture Notes- 2
 
ISTQB Foundation - Chapter 2
ISTQB Foundation - Chapter 2ISTQB Foundation - Chapter 2
ISTQB Foundation - Chapter 2
 
Testing Django Applications
Testing Django ApplicationsTesting Django Applications
Testing Django Applications
 
Into The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applications
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 

More from Sven Ruppert

Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-Persistence
Sven Ruppert
 
Vaadin Flow - How to start - a short intro for Java Devs
Vaadin Flow - How to start - a short intro for Java DevsVaadin Flow - How to start - a short intro for Java Devs
Vaadin Flow - How to start - a short intro for Java Devs
Sven Ruppert
 
Functional Reactive With Core Java - Voxxed Melbourne
Functional Reactive With Core Java - Voxxed MelbourneFunctional Reactive With Core Java - Voxxed Melbourne
Functional Reactive With Core Java - Voxxed Melbourne
Sven Ruppert
 
Functional Reactive with Core Java - Workshop - Slides
Functional Reactive with Core Java - Workshop - SlidesFunctional Reactive with Core Java - Workshop - Slides
Functional Reactive with Core Java - Workshop - Slides
Sven Ruppert
 
Functional reactive-talk 20170301-001
Functional reactive-talk 20170301-001Functional reactive-talk 20170301-001
Functional reactive-talk 20170301-001
Sven Ruppert
 
From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017
Sven Ruppert
 
From Jurassic Park to Microservices
From Jurassic Park to MicroservicesFrom Jurassic Park to Microservices
From Jurassic Park to Microservices
Sven Ruppert
 
From jUnit to Mutationtesting
From jUnit to MutationtestingFrom jUnit to Mutationtesting
From jUnit to Mutationtesting
Sven Ruppert
 
DI Frameworks - hidden pearls
DI Frameworks - hidden pearlsDI Frameworks - hidden pearls
DI Frameworks - hidden pearls
Sven Ruppert
 
Warum ich so auf das c von cdi stehe
Warum ich so auf das c von cdi steheWarum ich so auf das c von cdi stehe
Warum ich so auf das c von cdi stehe
Sven Ruppert
 
Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001
Sven Ruppert
 
Java8 ready for the future
Java8 ready for the futureJava8 ready for the future
Java8 ready for the future
Sven Ruppert
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDI
Sven Ruppert
 
Java FX8 JumpStart - JUG ch - zürich
Java FX8   JumpStart - JUG ch - zürichJava FX8   JumpStart - JUG ch - zürich
Java FX8 JumpStart - JUG ch - zürich
Sven Ruppert
 
Proxy Deep Dive JUG Saxony Day 2015-10-02
Proxy Deep Dive JUG Saxony Day 2015-10-02Proxy Deep Dive JUG Saxony Day 2015-10-02
Proxy Deep Dive JUG Saxony Day 2015-10-02
Sven Ruppert
 
Proxy Deep Dive Voxxed Belgrad 2015
Proxy Deep Dive Voxxed Belgrad 2015Proxy Deep Dive Voxxed Belgrad 2015
Proxy Deep Dive Voxxed Belgrad 2015
Sven Ruppert
 

More from Sven Ruppert (16)

Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-Persistence
 
Vaadin Flow - How to start - a short intro for Java Devs
Vaadin Flow - How to start - a short intro for Java DevsVaadin Flow - How to start - a short intro for Java Devs
Vaadin Flow - How to start - a short intro for Java Devs
 
Functional Reactive With Core Java - Voxxed Melbourne
Functional Reactive With Core Java - Voxxed MelbourneFunctional Reactive With Core Java - Voxxed Melbourne
Functional Reactive With Core Java - Voxxed Melbourne
 
Functional Reactive with Core Java - Workshop - Slides
Functional Reactive with Core Java - Workshop - SlidesFunctional Reactive with Core Java - Workshop - Slides
Functional Reactive with Core Java - Workshop - Slides
 
Functional reactive-talk 20170301-001
Functional reactive-talk 20170301-001Functional reactive-talk 20170301-001
Functional reactive-talk 20170301-001
 
From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017
 
From Jurassic Park to Microservices
From Jurassic Park to MicroservicesFrom Jurassic Park to Microservices
From Jurassic Park to Microservices
 
From jUnit to Mutationtesting
From jUnit to MutationtestingFrom jUnit to Mutationtesting
From jUnit to Mutationtesting
 
DI Frameworks - hidden pearls
DI Frameworks - hidden pearlsDI Frameworks - hidden pearls
DI Frameworks - hidden pearls
 
Warum ich so auf das c von cdi stehe
Warum ich so auf das c von cdi steheWarum ich so auf das c von cdi stehe
Warum ich so auf das c von cdi stehe
 
Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001
 
Java8 ready for the future
Java8 ready for the futureJava8 ready for the future
Java8 ready for the future
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDI
 
Java FX8 JumpStart - JUG ch - zürich
Java FX8   JumpStart - JUG ch - zürichJava FX8   JumpStart - JUG ch - zürich
Java FX8 JumpStart - JUG ch - zürich
 
Proxy Deep Dive JUG Saxony Day 2015-10-02
Proxy Deep Dive JUG Saxony Day 2015-10-02Proxy Deep Dive JUG Saxony Day 2015-10-02
Proxy Deep Dive JUG Saxony Day 2015-10-02
 
Proxy Deep Dive Voxxed Belgrad 2015
Proxy Deep Dive Voxxed Belgrad 2015Proxy Deep Dive Voxxed Belgrad 2015
Proxy Deep Dive Voxxed Belgrad 2015
 

Recently uploaded

E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 

Recently uploaded (20)

E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 

JUnit5 Custom TestEngines intro - version 2020-06

  • 1. JUnit5 – Custom TestEngines How to create your own TDD universe
  • 2. Who is speaking? • Sven Ruppert • Developer Advocate – DevSecOps • JFrog Inc • Twitter: @SvenRuppert • eMail: svenr@jfrog.com
  • 3. THE AGENDA The Junit5 Intro JUnit5 – test your TestEngine How to start your TestEngine The basic structure of a TestEngine How to define a Test How to execute a TestPlan Custom TestEngines – Ideas
  • 4. The Junit5 Intro Subject to test Preparations Clean Up Subject to test Preparations Clean Up Global Preparations Global Clean Up
  • 5. The Junit5 Intro Subject to test Preparations Clean Up Subject to test Preparations Clean Up Global Preparations Global Clean Up context context Context Preparations / Clean up must be fast Easy if this is symmetric How to deal with exceptions? Different Tests -> different preparations / context
  • 6. The Junit5 Intro Subject to test Preparations Clean Up Subject to test Preparations Clean Up Global Preparations Global Clean Up context context Context TestGroupI TestGroupII TestGroupIII
  • 7. The Junit5 Intro Subjecttotest Preparations CleanUp Subjecttotest Preparations CleanUp GlobalPreparations GlobalCleanUp context context Context Test Group I Subjecttotest Preparations CleanUp Subjecttotest Preparations CleanUp GlobalPreparations GlobalCleanUp context context Context Test Group II TestengineI
  • 9. The Junit5 Intro @Test @ExtendWith ExtensionContext LifeCycle - Management Subject to test Preparations Clean Up Global Preparations Global Clean Up context Context TestGroupI }
  • 14. The Junit5 Intro BeforeEach - ABeforeEach - B BeforeAll - B BeforeAll - A AfterEach - BAfterEach - A AfterAll - A AfterAll - B
  • 17. @Test void test001(Demo demo){ Assertions.assertEquals("Hello World", demo.value()); } The Junit5 Intro
  • 18. public static class DemoParameterResolver implements ParameterResolver { @Override public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { final Class<?> type = parameterContext.getParameter().getType(); return Demo.class.isAssignableFrom(type); } @Override public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { return new Demo(1, "Hello World"); } } The Junit5 Intro
  • 20. JUnit5 – test your TestEngine How to test a TestEngine? We need a way to test a new TestEngine As first exercise we will test an existing TestEngine
  • 21. JUnit5 – test your TestEngine <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-testkit</artifactId> <version>${junit5.version}</version> <scope>test</scope> </dependency>
  • 22. JUnit5 – test your TestEngine Two tests are started / one test is disabled One test is failing
  • 23. JUnit5 – test your TestEngine Two tests started One Test positive One Test skipped One Test failed
  • 24. JUnit5 – test your TestEngine
  • 25. How to start your TestEngine Discovery the Tests prepare the Launcher create the TestPlan register Listeners execute Launcher consume the Result
  • 26. How to start your TestEngine
  • 27. The basic structure of a Testengine Basic Structure to build a Custom TestEngine No real Test-Discovery in the first run Production code - the Test-Engine Test code - the Test-Engine-Tests Test the custom Test-Engine with the Jupiter-Engine
  • 28. The basic structure of a TestEngine <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-engine</artifactId> <version>${junit.platform.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-commons</artifactId> <version>${junit.platform.version}</version> <scope>compile</scope> </dependency>
  • 29. The basic structure of a TestEngine <!-- needed for writing integration tests--> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-launcher</artifactId> <version>${junit.platform.version}</version> <scope>compile</scope> </dependency>
  • 30. The basic structure of a TestEngine
  • 31. [ 1 containers found ] [ 0 containers skipped ] [ 1 containers started ] [ 0 containers aborted ] [ 1 containers successful ] [ 0 containers failed ] [ 0 tests found ] [ 0 tests skipped ] [ 0 tests started ] [ 0 tests aborted ] [ 0 tests successful ] [ 0 tests failed ] The basic structure of a TestEngine
  • 32. How to define a Test Find all tests with the Annotation @NanoTest Execute all discovered tests IDE should be able to execute the test Maven should be able to execute the test
  • 33. How to define a Test
  • 34. How to define a Test
  • 35. How to define a Test
  • 36. How to define a Test
  • 37. How to define a Test
  • 38. How to define a Test
  • 39. How to define a TestPlan
  • 40. How to define a TestPlan
  • 41. How to define a TestPlan
  • 42. How to define a TestPlan A TestDescriptor is a Node inside the TestPlan A Node can be a Container or a Test A Test is a leaf from this tree A Descriptor can be a Container and a Test at the same time A good start is the AbstractTestDescriptor
  • 43. How to define a TestPlan
  • 44. How to define a TestPlan
  • 45. How to execute a TestPlan
  • 46. How to execute a TestPlan
  • 47. How to execute a TestPlan
  • 48. How to execute a TestPlan
  • 49. How to execute a TestPlan
  • 50. How to execute a TestPlan @NanoTestClass public class FirstNanoTest { @NanoTest void test001_A() { } }
  • 51. Custom TestEngines - Ideas Add a Lic Check for your commercial product Store runtime metrics Authentication / Authorisation Domain – Specific – Testdefinition Complex Infrastructure Lifecycle Management Dynamic Testinput from external sources Testtechniques – like MutationTesting Persistent Immutable Testplans Testexecution Priorities
  • 52. Distributed TestPlan-Execution IDE or maven Testplan TestClass TestMethod Execution-Nodes JFrog - Artifactory
  • 53. SecurityPayload Generator Injection Store a TestPlan with the BuildInfo Load binary data from Artifactory – Generic Repo SecurityPayload Generator Injection Store a TestResults with the BuildInfo Repo Testplan Repo SecurityPayload TestResultRepo
  • 54. Artifactory / XRay and how to use it Internet REST API / WebUI RulePolicyWatch Repo
  • 55. Try it : OnPrem and/or Cloud https://jfrog.com/platform/free-trial/ Just try it
  • 56. THANK YOU! • Sven Ruppert • Developer Advocate – DevSecOps • Jfrog Inc • Twitter: @SvenRuppert • eMail: svenr@jfrog.com