Non user-frendly error when `String` is passed to TestNG setThreadCount


(Georgii Kalnytskyi) #1

When I tried to pass a Gradle property which has a class String to setThreadCount of the TestNG provider, I received a following error Could not find method setThreadCount() for arguments [1] on object of type org.gradle.api.tasks.testing.testng.TestNGOptions.

This error didn’t help me figure out what was wrong with my build script. I tried reading --debug and --stacktrace outputs, but neither mentioned a type conversion error, or anything similar. And so I was puzzled why def t_threads = 1 ... setThreadCount(t_threads) worked, but 'def t_threads = test_threads … setThreadCount(t_threads)wheretest_threadsis a property came fromgradle.properties` didn’t.