diff options
author | Marius Volkhart <mariusvolkhart@apache.org> | 2021-02-26 22:14:17 +0000 |
---|---|---|
committer | Marius Volkhart <mariusvolkhart@apache.org> | 2021-02-26 22:14:17 +0000 |
commit | 451684aa9168aed515ea9f33b8d30f4e99227390 (patch) | |
tree | f3e557e85c4d7a1e35cf0a4c9bc3ce76295230b5 | |
parent | 0fbf8f2e58e74a4a9e2eb88de8ba3605edf4131b (diff) | |
download | poi-451684aa9168aed515ea9f33b8d30f4e99227390.tar.gz poi-451684aa9168aed515ea9f33b8d30f4e99227390.zip |
Enable running more integration tests from Gradle.
This is particularly relevant for developers who import the Gradle project into their IDE and run tests using the Gradle test runner. Those developers were previously unable to debug integration tests.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1886962 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | build.gradle | 1 | ||||
-rw-r--r-- | src/integrationtest/org/apache/poi/stress/TestAllFiles.java | 16 |
2 files changed, 14 insertions, 3 deletions
diff --git a/build.gradle b/build.gradle index 70684aadc5..f574528646 100644 --- a/build.gradle +++ b/build.gradle @@ -421,7 +421,6 @@ project('integrationtest') { test { // exclude these from the normal test-run - exclude '**/TestAllFiles.class' exclude '**/*FileHandler.class' } diff --git a/src/integrationtest/org/apache/poi/stress/TestAllFiles.java b/src/integrationtest/org/apache/poi/stress/TestAllFiles.java index 8fbfd43c2f..55777d12ee 100644 --- a/src/integrationtest/org/apache/poi/stress/TestAllFiles.java +++ b/src/integrationtest/org/apache/poi/stress/TestAllFiles.java @@ -70,7 +70,8 @@ import org.opentest4j.AssertionFailedError; // also need to set JVM parameter: -Djunit.jupiter.execution.parallel.enabled=true @Execution(ExecutionMode.CONCURRENT) public class TestAllFiles { - public static final File ROOT_DIR = new File("test-data"); + private static final String DEFAULT_TEST_DATA_PATH = "test-data"; + public static final File ROOT_DIR = new File(System.getProperty("POI.testdata.path", DEFAULT_TEST_DATA_PATH)); public static final String[] SCAN_EXCLUDES = { "**/.svn/**", @@ -183,7 +184,18 @@ public class TestAllFiles { } private static String pathReplace(String msg) { + if (msg == null) return null; + // Windows path replacement - return msg == null ? null : msg.replace('\\', '/'); + msg = msg.replace('\\', '/'); + + // Adjust file paths to remove unwanted file path info. + int filePathIndex = msg.indexOf(ROOT_DIR.toString()); + if (filePathIndex > 0) { + int testDataDirectoryIndex = msg.indexOf(DEFAULT_TEST_DATA_PATH); + msg = msg.substring(0, filePathIndex) + msg.substring(testDataDirectoryIndex); + } + + return msg; } } |