-
Notifications
You must be signed in to change notification settings - Fork 83
Description
SlangBuilderTest.testValidFlowNamespaceWithAllValidCharsTypes fails when executed on it's own because it is an Order-Dependent test that requires SlangBuilderTest.testValidFlowNamespaceCaseInsensitive to mock and set the behavior of metadataExtractor.extractMetadataModellingResult() to return EMPTY_METADATA beforehand. As a result, the test can fail due to external factors not setting up it's state correctly, despite the test and the code that it is testing remaining unchanged. Order dependent flaky tests can lead to unreliable results from CI and can erode developer trust in the test suite.
You can replicate the errors with the following command:
mvn -pl cloudslang-content-verifier -Dtest=io.cloudslang.lang.tools.build.SlangBuilderTest#testValidFlowNamespaceWithAllValidCharsTypes test -e
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running io.cloudslang.lang.tools.build.SlangBuilderTest
[ERROR] OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
[INFO ] 2025/11/18 22:06:21 LoggingServiceImpl -
[INFO ] 2025/11/18 22:06:21 LoggingServiceImpl - ------------------------------------------------------------
[INFO ] 2025/11/18 22:06:21 LoggingServiceImpl - Building project: no_dependencies-0123456789
[INFO ] 2025/11/18 22:06:21 LoggingServiceImpl - ------------------------------------------------------------
[INFO ] 2025/11/18 22:06:21 LoggingServiceImpl -
[INFO ] 2025/11/18 22:06:21 LoggingServiceImpl - --- compiling sources ---
[INFO ] 2025/11/18 22:06:21 LoggingServiceImpl - Start compiling all slang files under: /home/leby2/cloud-slang/cloudslang-content-verifier/target/test-classes/no_dependencies-0123456789
[INFO ] 2025/11/18 22:06:21 LoggingServiceImpl - 1 .sl files were found
[INFO ] 2025/11/18 22:06:21 LoggingServiceImpl -
[ERROR] 2025/11/18 22:06:21 LoggingServiceImpl - Failed to extract metadata for file: '/home/leby2/cloud-slang/cloudslang-content-verifier/target/test-classes/no_dependencies-0123456789/empty_flow.sl'.
Cannot invoke "io.cloudslang.lang.compiler.modeller.result.MetadataModellingResult.getMetadata()" because "metadataResult" is null
[INFO ] 2025/11/18 22:06:21 LoggingServiceImpl - Successfully finished Compilation of: 0 Slang files
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.587 s <<< FAILURE! - in io.cloudslang.lang.tools.build.SlangBuilderTest
[ERROR] io.cloudslang.lang.tools.build.SlangBuilderTest.testValidFlowNamespaceWithAllValidCharsTypes Time elapsed: 0.058 s <<< FAILURE!
junit.framework.AssertionFailedError: Did not compile all Slang files. Expected to compile: 1, but compiled: 0 expected:<0> but was:<1>
at io.cloudslang.lang.tools.build.SlangBuilderTest.testValidFlowNamespaceWithAllValidCharsTypes(SlangBuilderTest.java:435)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] SlangBuilderTest.testValidFlowNamespaceWithAllValidCharsTypes:435 Did not compile all Slang files. Expected to compile: 1, but compiled: 0 expected:<0> but was:<1>
[INFO]
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0