LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2021-03 The Power of Data-Driven Testing A Deep Dive into Jakarta Persistence Specifications and NoSQL Elias Nogueira @eliasnogueira Otávio Santana @otaviojava
LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2020-08 What’s Jakarta NoSQL JNoSQL is an compactible implementation of Jakarta NoSQL and Jakarta Data specification, a Java framework that streamlines the integration of Java applications with NoSQL databases.
LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2020-08 What’s Jakarta Data Jakarta Data defines core APIs for the Jakarta EE platform allowing applications and other Jakarta EE components to explore the benefits of easy access to data technologies such as relational and non-relational databases, cloud-based data services, and so on. Jakarta Data provides an API to allow easy data access technologies. Thus, a Java developer can split the persistence and the model with several features such as a Repository interface with the method by query, where the framework will implement it.
LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2020-08 Early test status • Legacy code from different companies since 2017 • No defined development (testing included) practices • Several Proof of Concepts (PoC) around the projects
increasing the reliability of your software. Steps applied to Jakarta NoSQL and Data COPYRIGHT (C) 2023, ECLIPSE FOUNDATION | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2021-03 9 Testing Guidelines Moden Testing Library Data-Driven Approach Extensive Assertions Coverage Extension Containers for Testing
and approaches that must be followed by all the project contributors. Testing Guidelines A way to guide all the contributors towards quality COPYRIGHT (C) 2023, ECLIPSE FOUNDATION | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2021-03
LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2020-08 Testing Guidelines The Jakarta JNoSQL and Data has the following testing guidelines: • Tools to use (testing and related tools) • Naming conventions (test classes and methods, description and structure) • Specific test creation approach (soft assertions, extensive assertions) • Coverage extension (mutation testing)
decreased the code maintainability and increased coverage, making them more readable. Modern Testing Library The core part of the testing code COPYRIGHT (C) 2023, ECLIPSE FOUNDATION | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2021-03
LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2020-08 Modern Testing Library Features from JUnit 5 used in the project: • Test Description • Environment condition • Data Driven Testing ◦ Value Source ◦ Method Source ◦ Argument Source
the code coverage and decrease the code maintainability. Data-Driven Approach Iterate the same test code with different data COPYRIGHT (C) 2023, ECLIPSE FOUNDATION | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2021-03
LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2020-08 Data-Driven Approach Data-Driven Testing from JUnit 5 (JNoSQL, ValueWriterDecoratorTest) @ParameterizedTest(name = "must be compatible to {0}") @DisplayName("Should be able to verify the test compatibility") @ValueSource(classes = {Enum.class, Optional.class, Temporal.class}) void shouldVerifyCompatibility(Class<?> supportedClass) { assertThat(valueWriter.test(supportedClass)).isTrue(); }
as well features to easy the validation like the soft assertion approach. Extensive Assertions Provide a way to extend the assertions COPYRIGHT (C) 2023, ECLIPSE FOUNDATION | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2021-03
tests by mutating (changing them). Coverage Extension We can let tools mutate our code to find bugs COPYRIGHT (C) 2023, ECLIPSE FOUNDATION | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2021-03
LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2020-08 Coverage Extension PIT is a state of the art mutation testing system, providing gold standard test coverage for Java and the JVM. Mutation testing is conceptually quite simple. Faults (or mutations) are automatically seeded into your code, then your tests are run. If your tests fail then the mutation is killed, if your tests pass then the mutation lived.
APIs for bootstrapping integration tests with real services wrapped in Docker containers. Containers for Testing Don’t depend on manual steps anymore COPYRIGHT (C) 2023, ECLIPSE FOUNDATION | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2021-03
don’t take much time ◦ you can rely on tools like OpenRewrite to ease the changes • Proper tools help to be faster and assertive • Partially rely on tools for a better coverage COPYRIGHT (C) 2023, ECLIPSE FOUNDATION | THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2021-03
IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE (CC BY 4.0) | V2021-03 Elias Nogueira @eliasnogueira Otávio Santana @otaviojava