-
Notifications
You must be signed in to change notification settings - Fork 0
Description
If run "mvn clean test -Dtestomatio.listening=true -Dtestomatio.run.id="$TESTOMATIO_RUN_ID""
with testomatio.properties file (testomatio.url, testomatio.api.key are set)
an ERROR is produced in logs.
So in this case testomatio.export.required is not set (I don't want to export tests to Testomatio).
If set testomatio.export.required=false tests are exported (but I don't want to).
2025-09-10 12:53:57.297 [main] ERROR io.testomat.testng.methodexporter.TestNgMethodExportManager - Error checking export required property: No such property: testomatio.export.required
io.testomat.core.exception.PropertyNotFoundException: No such property: testomatio.export.required
at io.testomat.core.propertyconfig.provider.DefaultPropertyProvider.getProperty(DefaultPropertyProvider.java:28) ~[java-reporter-core-0.7.6.jar:0.7.6]
at io.testomat.core.propertyconfig.provider.FilePropertyProvider.getProperty(FilePropertyProvider.java:36) ~[java-reporter-core-0.7.6.jar:0.7.6]
at io.testomat.core.propertyconfig.provider.SystemEnvPropertyProvider.getProperty(SystemEnvPropertyProvider.java:27) ~[java-reporter-core-0.7.6.jar:0.7.6]
at io.testomat.core.propertyconfig.provider.JvmSystemPropertyProvider.getProperty(JvmSystemPropertyProvider.java:32) ~[java-reporter-core-0.7.6.jar:0.7.6]
at io.testomat.testng.methodexporter.TestNgMethodExportManager.isInitializeExportRequired(TestNgMethodExportManager.java:152) ~[java-reporter-testng-0.7.6.jar:?]
at io.testomat.testng.methodexporter.TestNgMethodExportManager.loadTestBodyForClass(TestNgMethodExportManager.java:63) ~[java-reporter-testng-0.7.6.jar:?]
at io.testomat.testng.listener.TestNgListener.exportTestClassIfNotProcessed(TestNgListener.java:137) ~[java-reporter-testng-0.7.6.jar:?]
at io.testomat.testng.listener.TestNgListener.onTestSuccess(TestNgListener.java:108) ~[java-reporter-testng-0.7.6.jar:?]
at org.testng.internal.TestListenerHelper.runTestListeners(TestListenerHelper.java:112) ~[testng-7.8.0.jar:7.8.0]
at org.testng.internal.invokers.TestInvoker.runTestResultListener(TestInvoker.java:262) ~[testng-7.8.0.jar:7.8.0]
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:751) ~[testng-7.8.0.jar:7.8.0]
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227) ~[testng-7.8.0.jar:7.8.0]
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50) ~[testng-7.8.0.jar:7.8.0]
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:957) ~[testng-7.8.0.jar:7.8.0]
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:200) ~[testng-7.8.0.jar:7.8.0]
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148) ~[testng-7.8.0.jar:7.8.0]
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128) ~[testng-7.8.0.jar:7.8.0]
at java.util.ArrayList.forEach(ArrayList.java:1596) [?:?]
at org.testng.TestRunner.privateRun(TestRunner.java:848) [testng-7.8.0.jar:7.8.0]
at org.testng.TestRunner.run(TestRunner.java:621) [testng-7.8.0.jar:7.8.0]
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443) [testng-7.8.0.jar:7.8.0]
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437) [testng-7.8.0.jar:7.8.0]
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397) [testng-7.8.0.jar:7.8.0]
at org.testng.SuiteRunner.run(SuiteRunner.java:336) [testng-7.8.0.jar:7.8.0]
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) [testng-7.8.0.jar:7.8.0]
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95) [testng-7.8.0.jar:7.8.0]
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280) [testng-7.8.0.jar:7.8.0]
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200) [testng-7.8.0.jar:7.8.0]
at org.testng.TestNG.runSuites(TestNG.java:1114) [testng-7.8.0.jar:7.8.0]
at org.testng.TestNG.run(TestNG.java:1082) [testng-7.8.0.jar:7.8.0]
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:308) [surefire-testng-3.5.3.jar:3.5.3]
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:71) [surefire-testng-3.5.3.jar:3.5.3]
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:113) [surefire-testng-3.5.3.jar:3.5.3]
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385) [surefire-booter-3.5.3.jar:3.5.3]
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) [surefire-booter-3.5.3.jar:3.5.3]
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507) [surefire-booter-3.5.3.jar:3.5.3]
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495) [surefire-booter-3.5.3.jar:3.5.3]
2
Description of this issue from chat gpt:
📝 Issue description draft
Title:
Property testomatio.export.required is incorrectly handled – causes ERROR logs and unwanted test export
Description:
When using testomatio-reporter-java with TestNG integration, the property testomatio.export.required is not correctly evaluated.
Currently, in TestNgMethodExportManager.isInitializeExportRequired(), the logic checks only whether the property exists (!= null).
This means:
If the property is not defined → a PropertyNotFoundException is thrown, producing noisy ERROR logs.
If the property is defined with any value (even false) → it is treated as “export required”, and test cases are exported to Testomat.
As a result:
Setting testomatio.export.required=false does not actually disable export (unexpected behavior).
Leaving the property undefined spams logs with errors like:
ERROR io.testomat.testng.methodexporter.TestNgMethodExportManager - Error checking export required property: No such property: testomatio.export.required
io.testomat.core.exception.PropertyNotFoundException: No such property: testomatio.export.required
Steps to Reproduce:
Run any TestNG tests with the reporter integrated.
Do not define testomatio.export.required property → logs contain ERROR messages.
Define -Dtestomatio.export.required=false → tests are still exported to Testomat, despite being set to false.
Expected Behavior:
If the property is not set → export should be skipped silently (no ERROR logs).
If the property is set to true → export should run.
If the property is set to false → export should be disabled.
Actual Behavior:
No property → ERROR in logs.
Property = false → export still happens.
Proposed Fix:
Update TestNgMethodExportManager.isInitializeExportRequired() to evaluate the actual boolean value:
private boolean isInitializeExportRequired() {
try {
String propertyValue = provider.getProperty(EXPORT_REQUIRED_PROPERTY_NAME);
log.debug("Property {} value: {}", EXPORT_REQUIRED_PROPERTY_NAME, propertyValue);
return Boolean.parseBoolean(propertyValue);
} catch (PropertyNotFoundException e) {
log.debug("Property {} not found, export disabled", EXPORT_REQUIRED_PROPERTY_NAME);
return false;
}
}
Environment:
Reporter version: java-reporter-core-0.7.2
Test framework: TestNG
Build tool: Maven
Java version: 17