From d80cd964a9fe57d26fd35cc68ffa5d5cd38c3f12 Mon Sep 17 00:00:00 2001 From: Nicolas Peransin Date: Fri, 10 Jul 2026 09:48:03 +0200 Subject: [PATCH] #2992 Fix tests of CommandLine when running in CI In CI, other tests may leave content in workspace. As commandline deals with all projects, tests must clean the workspace before execution. --- .../testcases/AbstractCommandLineExportTestCase.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/plugins/org.polarsys.capella.test.commandline.ju/src/org/polarsys/capella/test/commandline/ju/testcases/AbstractCommandLineExportTestCase.java b/tests/plugins/org.polarsys.capella.test.commandline.ju/src/org/polarsys/capella/test/commandline/ju/testcases/AbstractCommandLineExportTestCase.java index 6755ca9969..5202b3ab4d 100644 --- a/tests/plugins/org.polarsys.capella.test.commandline.ju/src/org/polarsys/capella/test/commandline/ju/testcases/AbstractCommandLineExportTestCase.java +++ b/tests/plugins/org.polarsys.capella.test.commandline.ju/src/org/polarsys/capella/test/commandline/ju/testcases/AbstractCommandLineExportTestCase.java @@ -24,6 +24,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.polarsys.capella.core.commandline.core.CommandLineConstants; import org.polarsys.capella.test.framework.api.BasicTestCase; @@ -88,10 +90,18 @@ protected void cleanExportResources() throws IOException { @Override protected void setUp() throws Exception { + cleanWorkspace(); super.setUp(); cleanExportResources(); } + private static void cleanWorkspace() throws Exception { + for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { + // Most Tests use reference Test resources directly. + project.delete(IResource.NEVER_DELETE_PROJECT_CONTENT, null); + } + } + @Override protected void tearDown() throws Exception { try {