diff --git a/README.md b/README.md index 00aec548..9da46aed 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,10 @@ The extension consists of: - Call activity stubbing for isolated testing - see [test](integration-tests/advanced/src/test/java/org/example/it/CallActivityWithMappingTest.java) - [Fluent API](impl/src/main/java/org/camunda/community/bpmndt/api) to override default behavior - Multi instance (activity/embedded subprocess) support - see [integration tests](integration-tests/advanced-multi-instance/src/test/java/org/example/it) -- Spring test support - see [integration tests](integration-tests/advanced-spring/) -- Spring Boot test support - see [integration tests](integration-tests/advanced-spring-boot/) +- Spring/Spring Boot test support - see `advanced-spring*` under [integration tests](integration-tests/) - Testing of arbitrary paths through a BPMN process - Test case validation and migration, when a BPMN process was changed - see [docs](docs/test-case-validation-and-migration.md) +- [camunda-process-test-coverage](https://github.com/camunda-community-hub/camunda-process-test-coverage) extension support - see `coverage-*` under [integration tests](integration-tests/) ## How does it work? diff --git a/integration-tests/coverage-junit5/pom.xml b/integration-tests/coverage-junit5/pom.xml new file mode 100644 index 00000000..7c797d1b --- /dev/null +++ b/integration-tests/coverage-junit5/pom.xml @@ -0,0 +1,127 @@ + + + 4.0.0 + + org.example.it + bpmndt-coverage-junit5 + 1 + + + UTF-8 + + + 3.24.2 + 7.19.0 + 15.0.0 + 2.3.0 + 2.2.220 + 5.9.3 + 1.7.36 + + 0.9.0-SNAPSHOT + + + + + camunda-bpm-nexus + camunda-bpm-nexus + https://artifacts.camunda.com/artifactory/public/ + + + + + + + org.camunda.bpm + camunda-bom + ${camunda.bpm.version} + pom + import + + + + + + + org.camunda.bpm + camunda-engine + + + + + org.slf4j + slf4j-log4j12 + ${slf4j.version} + test + + + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + + + com.h2database + h2 + ${h2.version} + test + + + + org.camunda.bpm.assert + camunda-bpm-assert + ${camunda.bpm.assert.version} + test + + + org.assertj + assertj-core + ${assertj.version} + test + + + + org.camunda.community.process_test_coverage + camunda-process-test-coverage-junit5-platform-7 + ${camunda.process.test.coverage.version} + test + + + + + org.camunda.bpm + camunda-bpm-junit5 + test + + + + + + + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + + org.camunda.community + bpmn-driven-testing-maven-plugin + ${plugin.version} + + + + generator + + + + + true + + + + + diff --git a/integration-tests/coverage-junit5/src/main/resources/example.bpmn b/integration-tests/coverage-junit5/src/main/resources/example.bpmn new file mode 100644 index 00000000..c061fb03 --- /dev/null +++ b/integration-tests/coverage-junit5/src/main/resources/example.bpmn @@ -0,0 +1,142 @@ + + + + + + + A + + startEvent + fork + eventA + join + endEvent + + + + B + + startEvent + fork + eventB + join + endEvent + + + + C + + startEvent + fork + eventC + join + endEvent + + + + + + Flow_050eadf + + + Flow_050eadf + Flow_04buioh + Flow_0kju9wf + Flow_187cunb + + + + Flow_04buioh + Flow_0adbv0z + + + + Flow_0adbv0z + Flow_1cg8y7u + Flow_1cw2vtv + Flow_1a9zsda + + + + Flow_0kju9wf + Flow_1cg8y7u + + + ${branch == 'b'} + + + + Flow_1a9zsda + + + + Flow_187cunb + Flow_1cw2vtv + + + ${branch == 'c'} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/integration-tests/coverage-junit5/src/test/java/org/example/it/CoverageBranchABTest.java b/integration-tests/coverage-junit5/src/test/java/org/example/it/CoverageBranchABTest.java new file mode 100644 index 00000000..6c57e09d --- /dev/null +++ b/integration-tests/coverage-junit5/src/test/java/org/example/it/CoverageBranchABTest.java @@ -0,0 +1,32 @@ +package org.example.it; + +import org.camunda.bpm.engine.test.Deployment; +import org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert; +import org.camunda.community.process_test_coverage.junit5.platform7.ProcessEngineCoverageExtension; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import generated.example.TC_A; +import generated.example.TC_B; + +@Deployment(resources = "example.bpmn") // needed for some reason +public class CoverageBranchABTest { + + @RegisterExtension + public static ProcessEngineCoverageExtension coverage = CoverageExtensionProvider.get(); // must be static + + @RegisterExtension + public TC_A tcA = new TC_A(); + @RegisterExtension + public TC_B tcB = new TC_B(); + + @Test + public void testA() { + tcA.createExecutor().withVariable("branch", "a").verify(ProcessInstanceAssert::isEnded).execute(); + } + + @Test + public void testB() { + tcB.createExecutor().withVariable("branch", "b").verify(ProcessInstanceAssert::isEnded).execute(); + } +} diff --git a/integration-tests/coverage-junit5/src/test/java/org/example/it/CoverageBranchCTest.java b/integration-tests/coverage-junit5/src/test/java/org/example/it/CoverageBranchCTest.java new file mode 100644 index 00000000..045bf42b --- /dev/null +++ b/integration-tests/coverage-junit5/src/test/java/org/example/it/CoverageBranchCTest.java @@ -0,0 +1,24 @@ +package org.example.it; + +import org.camunda.bpm.engine.test.Deployment; +import org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert; +import org.camunda.community.process_test_coverage.junit5.platform7.ProcessEngineCoverageExtension; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import generated.example.TC_C; + +@Deployment(resources = "example.bpmn") // needed for some reason +public class CoverageBranchCTest { + + @RegisterExtension + public static ProcessEngineCoverageExtension coverage = CoverageExtensionProvider.get(); // must be static + + @RegisterExtension + public TC_C tcC = new TC_C(); + + @Test + public void testC() { + tcC.createExecutor().withVariable("branch", "c").verify(ProcessInstanceAssert::isEnded).execute(); + } +} diff --git a/integration-tests/coverage-junit5/src/test/java/org/example/it/CoverageExtensionProvider.java b/integration-tests/coverage-junit5/src/test/java/org/example/it/CoverageExtensionProvider.java new file mode 100644 index 00000000..3361ef0d --- /dev/null +++ b/integration-tests/coverage-junit5/src/test/java/org/example/it/CoverageExtensionProvider.java @@ -0,0 +1,42 @@ +package org.example.it; + +import java.util.LinkedList; +import java.util.List; + +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin; +import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; +import org.camunda.community.bpmndt.api.cfg.BpmndtProcessEnginePlugin; +import org.camunda.community.process_test_coverage.engine.platform7.ProcessCoverageConfigurator; +import org.camunda.community.process_test_coverage.junit5.platform7.ProcessEngineCoverageExtension; + +public class CoverageExtensionProvider { + + private static final ProcessEngineCoverageExtension extension; + + static { + // configure engine for running generated test cases + List processEnginePlugins = new LinkedList<>(); + processEnginePlugins.add(new BpmndtProcessEnginePlugin()); + + ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneInMemProcessEngineConfiguration(); + processEngineConfiguration.setProcessEnginePlugins(processEnginePlugins); + + // configure engine for collecting process test coverage + ProcessCoverageConfigurator.initializeProcessCoverageExtensions(processEngineConfiguration); + + extension = ProcessEngineCoverageExtension.builder(processEngineConfiguration) + .assertClassCoverageAtLeast(0.75) + .build(); + } + + /** + * Provides a cached instance of the JUnit5 coverage extension, so that the same process engine is + * used for all tests. + * + * @return The cached coverage extension. + */ + public static ProcessEngineCoverageExtension get() { + return extension; + } +} diff --git a/integration-tests/coverage-junit5/src/test/resources/log4j.properties b/integration-tests/coverage-junit5/src/test/resources/log4j.properties new file mode 100644 index 00000000..d57a54d5 --- /dev/null +++ b/integration-tests/coverage-junit5/src/test/resources/log4j.properties @@ -0,0 +1,9 @@ +log4j.rootLogger=INFO, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n + +log4j.logger.org.camunda=INFO +log4j.logger.org.springframework=WARN diff --git a/integration-tests/coverage-spring-boot-junit5/pom.xml b/integration-tests/coverage-spring-boot-junit5/pom.xml new file mode 100644 index 00000000..8f51bed2 --- /dev/null +++ b/integration-tests/coverage-spring-boot-junit5/pom.xml @@ -0,0 +1,131 @@ + + + 4.0.0 + + org.example.it + bpmndt-coverage-spring-boot-junit5 + 1 + + + UTF-8 + + + 3.24.2 + 7.19.0 + 15.0.0 + 2.3.0 + 2.2.220 + 2.7.15 + + 0.9.0-SNAPSHOT + + + + + camunda-bpm-nexus + camunda-bpm-nexus + https://artifacts.camunda.com/artifactory/public/ + + + + + + + org.camunda.bpm + camunda-bom + ${camunda.bpm.version} + pom + import + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + + + + + org.camunda.bpm.springboot + camunda-bpm-spring-boot-starter + + + + org.camunda.bpm + camunda-engine-plugin-spin + + + org.camunda.spin + camunda-spin-dataformat-json-jackson + + + + + com.h2database + h2 + ${h2.version} + test + + + + org.camunda.bpm.assert + camunda-bpm-assert + ${camunda.bpm.assert.version} + test + + + org.assertj + assertj-core + ${assertj.version} + test + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.camunda.community.process_test_coverage + camunda-process-test-coverage-starter-platform-7 + ${camunda.process.test.coverage.version} + test + + + + + + + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + + org.camunda.community + bpmn-driven-testing-maven-plugin + ${plugin.version} + + + + generator + + + + + true + + false + + + + + diff --git a/integration-tests/coverage-spring-boot-junit5/src/main/java/org/example/ExampleApp.java b/integration-tests/coverage-spring-boot-junit5/src/main/java/org/example/ExampleApp.java new file mode 100644 index 00000000..da5854e5 --- /dev/null +++ b/integration-tests/coverage-spring-boot-junit5/src/main/java/org/example/ExampleApp.java @@ -0,0 +1,14 @@ +package org.example; + +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@EnableProcessApplication +public class ExampleApp { + + public static void main(String[] args) { + SpringApplication.run(ExampleApp.class, args); + } +} diff --git a/integration-tests/coverage-spring-boot-junit5/src/main/resources/example.bpmn b/integration-tests/coverage-spring-boot-junit5/src/main/resources/example.bpmn new file mode 100644 index 00000000..c061fb03 --- /dev/null +++ b/integration-tests/coverage-spring-boot-junit5/src/main/resources/example.bpmn @@ -0,0 +1,142 @@ + + + + + + + A + + startEvent + fork + eventA + join + endEvent + + + + B + + startEvent + fork + eventB + join + endEvent + + + + C + + startEvent + fork + eventC + join + endEvent + + + + + + Flow_050eadf + + + Flow_050eadf + Flow_04buioh + Flow_0kju9wf + Flow_187cunb + + + + Flow_04buioh + Flow_0adbv0z + + + + Flow_0adbv0z + Flow_1cg8y7u + Flow_1cw2vtv + Flow_1a9zsda + + + + Flow_0kju9wf + Flow_1cg8y7u + + + ${branch == 'b'} + + + + Flow_1a9zsda + + + + Flow_187cunb + Flow_1cw2vtv + + + ${branch == 'c'} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/integration-tests/coverage-spring-boot-junit5/src/test/java/org/example/it/BpmndtConfiguration.java b/integration-tests/coverage-spring-boot-junit5/src/test/java/org/example/it/BpmndtConfiguration.java new file mode 100644 index 00000000..6dccdcb2 --- /dev/null +++ b/integration-tests/coverage-spring-boot-junit5/src/test/java/org/example/it/BpmndtConfiguration.java @@ -0,0 +1,23 @@ +package org.example.it; + +import org.camunda.community.bpmndt.api.cfg.BpmndtProcessEnginePlugin; +import org.camunda.community.process_test_coverage.spring_test.platform7.ProcessEngineCoverageProperties; +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.context.annotation.Bean; + +@TestConfiguration +public class BpmndtConfiguration { + + @Bean + public BpmndtProcessEnginePlugin bpmndtProcessEnginePlugin() { + return new BpmndtProcessEnginePlugin(); + } + + // override default coverage properties, if needed + @Bean + public ProcessEngineCoverageProperties processEngineCoverageProperties() { + return ProcessEngineCoverageProperties.builder() + .assertClassCoverageAtLeast(0.75) + .build(); + } +} diff --git a/integration-tests/coverage-spring-boot-junit5/src/test/java/org/example/it/CoverageBranchABTest.java b/integration-tests/coverage-spring-boot-junit5/src/test/java/org/example/it/CoverageBranchABTest.java new file mode 100644 index 00000000..0e378327 --- /dev/null +++ b/integration-tests/coverage-spring-boot-junit5/src/test/java/org/example/it/CoverageBranchABTest.java @@ -0,0 +1,30 @@ +package org.example.it; + +import org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert; +import org.example.ExampleApp; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; + +import generated.example.TC_A; +import generated.example.TC_B; + +@SpringBootTest(classes = {ExampleApp.class, BpmndtConfiguration.class}, webEnvironment = WebEnvironment.NONE) +public class CoverageBranchABTest { + + @RegisterExtension + public TC_A tcA = new TC_A(); + @RegisterExtension + public TC_B tcB = new TC_B(); + + @Test + public void testA() { + tcA.createExecutor().withVariable("branch", "a").verify(ProcessInstanceAssert::isEnded).execute(); + } + + @Test + public void testB() { + tcB.createExecutor().withVariable("branch", "b").verify(ProcessInstanceAssert::isEnded).execute(); + } +} diff --git a/integration-tests/coverage-spring-boot-junit5/src/test/java/org/example/it/CoverageBranchCTest.java b/integration-tests/coverage-spring-boot-junit5/src/test/java/org/example/it/CoverageBranchCTest.java new file mode 100644 index 00000000..a9c743cb --- /dev/null +++ b/integration-tests/coverage-spring-boot-junit5/src/test/java/org/example/it/CoverageBranchCTest.java @@ -0,0 +1,22 @@ +package org.example.it; + +import org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert; +import org.example.ExampleApp; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; + +import generated.example.TC_C; + +@SpringBootTest(classes = {ExampleApp.class, BpmndtConfiguration.class}, webEnvironment = WebEnvironment.NONE) +public class CoverageBranchCTest { + + @RegisterExtension + public TC_C tcC = new TC_C(); + + @Test + public void testC() { + tcC.createExecutor().withVariable("branch", "c").verify(ProcessInstanceAssert::isEnded).execute(); + } +} diff --git a/integration-tests/coverage-spring-boot-junit5/src/test/resources/application.yaml b/integration-tests/coverage-spring-boot-junit5/src/test/resources/application.yaml new file mode 100644 index 00000000..773960b2 --- /dev/null +++ b/integration-tests/coverage-spring-boot-junit5/src/test/resources/application.yaml @@ -0,0 +1,3 @@ +spring: + main: + banner-mode: off diff --git a/integration-tests/coverage-spring-junit5/pom.xml b/integration-tests/coverage-spring-junit5/pom.xml new file mode 100644 index 00000000..7ad11223 --- /dev/null +++ b/integration-tests/coverage-spring-junit5/pom.xml @@ -0,0 +1,156 @@ + + + 4.0.0 + + org.example.it + bpmndt-coverage-spring-junit5 + 1 + + + UTF-8 + + + 3.24.2 + 7.19.0 + 15.0.0 + 2.3.0 + 2.2.220 + 5.9.3 + 1.7.36 + 5.3.29 + + 0.9.0-SNAPSHOT + + + + + camunda-bpm-nexus + camunda-bpm-nexus + https://artifacts.camunda.com/artifactory/public/ + + + + + + + org.camunda.bpm + camunda-bom + ${camunda.bpm.version} + pom + import + + + + + + + org.camunda.bpm + camunda-engine + + + org.camunda.bpm + camunda-engine-plugin-spin + + + org.camunda.bpm + camunda-engine-spring + + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + + + org.slf4j + slf4j-log4j12 + ${slf4j.version} + test + + + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + + + com.h2database + h2 + ${h2.version} + test + + + + org.camunda.bpm.assert + camunda-bpm-assert + ${camunda.bpm.assert.version} + test + + + org.assertj + assertj-core + ${assertj.version} + test + + + + org.springframework + spring-test + ${spring.version} + test + + + + org.camunda.community.process_test_coverage + camunda-process-test-coverage-spring-test-platform-7 + ${camunda.process.test.coverage.version} + test + + + + + + + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + + org.camunda.community + bpmn-driven-testing-maven-plugin + ${plugin.version} + + + + generator + + + + + true + + org.camunda.spin.plugin.impl.SpinProcessEnginePlugin + + true + + + + + diff --git a/integration-tests/coverage-spring-junit5/src/main/resources/example.bpmn b/integration-tests/coverage-spring-junit5/src/main/resources/example.bpmn new file mode 100644 index 00000000..c061fb03 --- /dev/null +++ b/integration-tests/coverage-spring-junit5/src/main/resources/example.bpmn @@ -0,0 +1,142 @@ + + + + + + + A + + startEvent + fork + eventA + join + endEvent + + + + B + + startEvent + fork + eventB + join + endEvent + + + + C + + startEvent + fork + eventC + join + endEvent + + + + + + Flow_050eadf + + + Flow_050eadf + Flow_04buioh + Flow_0kju9wf + Flow_187cunb + + + + Flow_04buioh + Flow_0adbv0z + + + + Flow_0adbv0z + Flow_1cg8y7u + Flow_1cw2vtv + Flow_1a9zsda + + + + Flow_0kju9wf + Flow_1cg8y7u + + + ${branch == 'b'} + + + + Flow_1a9zsda + + + + Flow_187cunb + Flow_1cw2vtv + + + ${branch == 'c'} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/integration-tests/coverage-spring-junit5/src/test/java/org/example/it/CoverageBranchABTest.java b/integration-tests/coverage-spring-junit5/src/test/java/org/example/it/CoverageBranchABTest.java new file mode 100644 index 00000000..2c689232 --- /dev/null +++ b/integration-tests/coverage-spring-junit5/src/test/java/org/example/it/CoverageBranchABTest.java @@ -0,0 +1,31 @@ +package org.example.it; + +import org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +import generated.example.TC_A; +import generated.example.TC_B; + +@ExtendWith(SpringExtension.class) +@ContextConfiguration(classes = {CoverageConfiguration.class}) +public class CoverageBranchABTest { + + @RegisterExtension + public TC_A tcA = new TC_A(); + @RegisterExtension + public TC_B tcB = new TC_B(); + + @Test + public void testA() { + tcA.createExecutor().withVariable("branch", "a").verify(ProcessInstanceAssert::isEnded).execute(); + } + + @Test + public void testB() { + tcB.createExecutor().withVariable("branch", "b").verify(ProcessInstanceAssert::isEnded).execute(); + } +} diff --git a/integration-tests/coverage-spring-junit5/src/test/java/org/example/it/CoverageBranchCTest.java b/integration-tests/coverage-spring-junit5/src/test/java/org/example/it/CoverageBranchCTest.java new file mode 100644 index 00000000..3ef205dd --- /dev/null +++ b/integration-tests/coverage-spring-junit5/src/test/java/org/example/it/CoverageBranchCTest.java @@ -0,0 +1,23 @@ +package org.example.it; + +import org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +import generated.example.TC_C; + +@ExtendWith(SpringExtension.class) +@ContextConfiguration(classes = {CoverageConfiguration.class}) +public class CoverageBranchCTest { + + @RegisterExtension + public TC_C tcC = new TC_C(); + + @Test + public void testC() { + tcC.createExecutor().withVariable("branch", "c").verify(ProcessInstanceAssert::isEnded).execute(); + } +} diff --git a/integration-tests/coverage-spring-junit5/src/test/java/org/example/it/CoverageConfiguration.java b/integration-tests/coverage-spring-junit5/src/test/java/org/example/it/CoverageConfiguration.java new file mode 100644 index 00000000..393d3453 --- /dev/null +++ b/integration-tests/coverage-spring-junit5/src/test/java/org/example/it/CoverageConfiguration.java @@ -0,0 +1,44 @@ +package org.example.it; + +import java.util.List; + +import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin; +import org.camunda.community.process_test_coverage.engine.platform7.ProcessCoverageConfigurator; +import org.camunda.community.process_test_coverage.spring_test.platform7.ProcessEngineCoverageProperties; +import org.springframework.context.annotation.Bean; + +import generated.BpmndtConfiguration; + +/** + * Extends to generated configuration by adding another process engine plugin that configures the + * engine for collecting process test coverage and provides a + * {@code ProcessEngineCoverageProperties} bean that is required for the automatically registered + * {@code ProcessEngineCoverageTestExecutionListener}. + */ +public class CoverageConfiguration extends BpmndtConfiguration { + + @Override + protected List getProcessEnginePlugins() { + List processEnginePlugins = super.getProcessEnginePlugins(); + processEnginePlugins.add(new CoveragePlugin()); + + return processEnginePlugins; + } + + @Bean + public ProcessEngineCoverageProperties processEngineCoverageProperties() { + return ProcessEngineCoverageProperties.builder() + .assertClassCoverageAtLeast(0.75) + .build(); + } + + private static class CoveragePlugin extends AbstractProcessEnginePlugin { + + @Override + public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { + ProcessCoverageConfigurator.initializeProcessCoverageExtensions(processEngineConfiguration); + } + } +} diff --git a/integration-tests/coverage-spring-junit5/src/test/resources/log4j.properties b/integration-tests/coverage-spring-junit5/src/test/resources/log4j.properties new file mode 100644 index 00000000..d57a54d5 --- /dev/null +++ b/integration-tests/coverage-spring-junit5/src/test/resources/log4j.properties @@ -0,0 +1,9 @@ +log4j.rootLogger=INFO, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n + +log4j.logger.org.camunda=INFO +log4j.logger.org.springframework=WARN