I could reproduce the incident: the new Date().format('MM/dd/yyyy')
is displayed with an underline, which indicates a coding mistake.
Let me report how I reproduced it.
environment
I reproduced it using
- macOSX 14.6.1
- Katalon Studio v9.0.0 (Free)
The Test Case scripts I tried
Test Cases/printGroovyVersion
:
public String getGroovyVersion() {
try {
return org.codehaus.groovy.runtime.InvokerHelper.version
}
catch (Throwable ignore) { }
return GroovySystem.version
}
println getGroovyVersion()
When I ran it, it printed:
2024-09-21 09:01:41.933 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2024-09-21 09:01:41.936 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/PrintGroovyVersion
2024-09-21 09:01:42.493 DEBUG testcase.PrintGroovyVersion - 1: println(getGroovyVersion())
2024-09-21 09:01:42.507 DEBUG testcase.PrintGroovyVersion - 1: try
2024-09-21 09:01:42.516 DEBUG testcase.PrintGroovyVersion - 1: return org.codehaus.groovy.runtime.InvokerHelper.version
2024-09-21 09:01:42.573 DEBUG testcase.PrintGroovyVersion - 2: catch (Throwable ignore)
2024-09-21 09:01:42.588 DEBUG testcase.PrintGroovyVersion - 4: return groovy.lang.GroovySystem.version
3.0.17
2024-09-21 09:01:42.687 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/PrintGroovyVersion
Test Cases/TryDateFormat
def now = new Date().format('MM/dd/yyyy')
println "now = $now"
Normal case
I tried to run the TryDateFormat
in a healty Katalon Studio v9.0.0. It ran just fine. I could see in the console:
2024-09-21 09:09:33.075 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2024-09-21 09:09:33.080 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/TryDateFormat
2024-09-21 09:09:33.853 DEBUG testcase.TryDateFormat - 1: now = Date().format("MM/dd/yyyy")
2024-09-21 09:09:33.900 DEBUG testcase.TryDateFormat - 2: println(now = $now)
now = 09/21/2024
2024-09-21 09:09:34.097 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/TryDateFormat
Problem reproduced
I checked the list of the jars of Groovy language bundled in the Katalon Studio v9.0.0 on macOS.
$ pwd
/Applications/Katalon Studio.app
:/Applications/Katalon Studio.app
$ ls -la Contents/Eclipse/configuration/resources/lib | grep groovy
-rwxr-xr-x@ 1 kazuakiurayama admin 82789 10 24 2023 groovy-ant-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 6181 10 24 2023 groovy-astbuilder-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 60564 10 24 2023 groovy-cli-picocli-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 1556615 10 24 2023 groovy-console-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 15178 10 24 2023 groovy-datetime-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 7405 10 24 2023 groovy-dateutil-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 122803 10 24 2023 groovy-docgenerator-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 161394 10 24 2023 groovy-groovydoc-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 992265 10 24 2023 groovy-groovysh-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 132953 10 24 2023 groovy-jmx-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 128879 10 24 2023 groovy-json-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 16838 10 24 2023 groovy-jsr223-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 233320 10 24 2023 groovy-macro-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 29430 10 24 2023 groovy-nio-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 22733 10 24 2023 groovy-servlet-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 78915 10 24 2023 groovy-sql-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 429066 10 24 2023 groovy-swing-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 94160 10 24 2023 groovy-templates-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 118019 10 24 2023 groovy-test-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 9118 10 24 2023 groovy-test-junit5-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 5484 10 24 2023 groovy-testng-3.0.17.jar
-rwxr-xr-x@ 1 kazuakiurayama admin 291717 10 24 2023 groovy-xml-3.0.17.jar
Intentionally, I removed the groovy-dateutil-3.0.17.jar
$ rm Contents/Eclipse/configuration/resources/lib/groovy-dateutil-3.0.17.jar
I stopped the Katalon Studio and restarted it. Then I could see the format
method of Date
object is underlined. The Test Cases/TryDateFormat
failed with an Exception.
The incident was reproduced when the groovy-dateutil
jar got missing out of the runtime classpath of Katalon Studio.