From bd1606fa83d238355c29d2fe6c26d0cf50e9507d Mon Sep 17 00:00:00 2001 From: Micha Schweizer Date: Thu, 24 Feb 2022 13:25:23 +0100 Subject: [PATCH 1/5] move from specific maven version to minimal required version --- pom.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 21bf2f0..b2658e4 100644 --- a/pom.xml +++ b/pom.xml @@ -11,10 +11,6 @@ flaky-test-extractor Maven Plugin - - ${maven.version} - - org.camunda camunda-release-parent @@ -180,6 +176,9 @@ + + ${maven.version} + From 4470e69c828823a06992be1836e1020f4fc642f6 Mon Sep 17 00:00:00 2001 From: Micha Schweizer Date: Thu, 24 Feb 2022 14:35:24 +0100 Subject: [PATCH 2/5] use fullClassName in summary file --- .../java/io/zeebe/flakytestextractor/XmlReporterWriter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/zeebe/flakytestextractor/XmlReporterWriter.java b/src/main/java/io/zeebe/flakytestextractor/XmlReporterWriter.java index ebac662..7a3b064 100644 --- a/src/main/java/io/zeebe/flakytestextractor/XmlReporterWriter.java +++ b/src/main/java/io/zeebe/flakytestextractor/XmlReporterWriter.java @@ -86,7 +86,7 @@ private void createTestSuiteElement(final XMLWriter ppw, final ExtendedReportTes ppw.addAttribute("xsi:noNamespaceSchemaLocation", xsdSchemaLocation); ppw.addAttribute("version", xsdVersion); - final String reportName = testSuite.getName(); + final String reportName = testSuite.getFullClassName(); ppw.addAttribute("name", reportName == null ? "" : extraEscapeAttribute(reportName)); ppw.addAttribute("time", String.valueOf(testSuite.getTimeElapsed())); ppw.addAttribute("tests", String.valueOf(testSuite.getNumberOfTests())); @@ -100,7 +100,7 @@ private void startTestElement(final XMLWriter ppw, final ExtendedReportTestCase final String name = testCase.getName(); ppw.addAttribute("name", name == null ? "" : extraEscapeAttribute(name)); - final String className = testCase.getClassName(); + final String className = testCase.getFullClassName(); if (className != null) { ppw.addAttribute("classname", extraEscapeAttribute(className)); } From 8c13769425ac8862a38246d93400df7c33384fbf Mon Sep 17 00:00:00 2001 From: Micha Schweizer Date: Thu, 24 Feb 2022 14:38:38 +0100 Subject: [PATCH 3/5] add skip feature --- .../flakytestextractor/FlakyTestExtractorPlugin.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/zeebe/flakytestextractor/FlakyTestExtractorPlugin.java b/src/main/java/io/zeebe/flakytestextractor/FlakyTestExtractorPlugin.java index cf47b16..0ec3030 100644 --- a/src/main/java/io/zeebe/flakytestextractor/FlakyTestExtractorPlugin.java +++ b/src/main/java/io/zeebe/flakytestextractor/FlakyTestExtractorPlugin.java @@ -22,10 +22,18 @@ public class FlakyTestExtractorPlugin extends AbstractMojo { @Parameter(defaultValue = "${project.build.directory}/surefire-reports", property = "reportDir") protected File reportDir; - @Parameter(defaultValue = "true", property = "failBuild", required = false) + @Parameter(defaultValue = "true", property = "failBuild") protected boolean failBuild = true; + @Parameter(defaultValue = "false", property = "skipFlakyTestExtractor") + protected boolean skip = false; + public void execute() throws MojoFailureException { + if(skip){ + getLog().info("extract-flaky-tests Plugin skipped"); + return; + } + getLog().info("FlakyTestExtractorPlugin - starting"); getLog().info("reportDir: " + reportDir.getAbsolutePath()); getLog().info("failBuild: " + failBuild); From 22351543c86dd383f58ce555bd7764a2c858a3ad Mon Sep 17 00:00:00 2001 From: Micha Schweizer Date: Thu, 24 Feb 2022 16:17:52 +0100 Subject: [PATCH 4/5] add test for skip flag --- .../FlakyTestExtractorPluginTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/java/io/zeebe/flakytestextractor/FlakyTestExtractorPluginTest.java b/src/test/java/io/zeebe/flakytestextractor/FlakyTestExtractorPluginTest.java index a0ee63f..4bf8627 100644 --- a/src/test/java/io/zeebe/flakytestextractor/FlakyTestExtractorPluginTest.java +++ b/src/test/java/io/zeebe/flakytestextractor/FlakyTestExtractorPluginTest.java @@ -71,6 +71,18 @@ public void testExecuteWithFailBuildFalse() throws Exception { }).doesNotThrowAnyException(); } + @Test + public void testExecuteWithSkipped() { + FlakyTestExtractorPlugin sut = new FlakyTestExtractorPlugin(); + sut.reportDir = tempFolder.getRoot(); + sut.skip = true; + + assertThatCode(sut::execute).doesNotThrowAnyException(); + + File[] createdFiles = tempFolder.getRoot().listFiles(file -> file.getName().endsWith("-FLAKY.xml")); + assertThat(createdFiles).isEmpty(); + } + private void inspectFlakyErrorReport(File flakyErrorReport) throws ParserConfigurationException, SAXException, IOException, FileNotFoundException { From eb5ff091db48c4fd1648f18e50cdec8a81653f75 Mon Sep 17 00:00:00 2001 From: Micha Schweizer Date: Thu, 24 Feb 2022 16:20:30 +0100 Subject: [PATCH 5/5] document skip flag in README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f0d6fc2..6fb30fb 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,10 @@ This plugin scans the XML file for flaky tests results and then generates additi ## How can I configure this plugin? -There are two configuration options: +There are three configuration options: * `reportDir` (defaultValue `${project.build.directory}/surefire-reports`) - this is the directory that will be scanned for XML report file. It is also the directory to which new XML files will be written * `failBuild` (defaultValue `true`) - flag to make the plugin fail the build if flaky test were discovered +* `skipFlakyTestExtractor` (defaultValue `false`) - flag to skip this plugin ## What are known shortcomings?