OS: Windows7
Katalon version: 5.8.0
Browser: Firefox 62.0.3
Katalon log: attached but not relevant
What was possible in 5.7.x
In 5.7.x, I could choose Null as the type of a GlobalVariable in Profile. See the screenshot:
In the ./Libs/internal/GlobalVariable.groovy file I found the GlobalVariable.MATERIAL_REPOSITORY had the initial value of null.
static {
def allVariables = [:]
allVariables.put('default', ['CURRENT_TESTCASE_ID' : '', 'MATERIAL_REPOSITORY' : null, 'Hostname' : 'demoaut.katalon.com', 'Username' : 'John Doe', 'Password' : 'ThisIsNotAPassword'])
allVariables.put('develop', allVariables['default'] + ['CURRENT_TESTCASE_ID' : '', 'MATERIAL_REPOSITORY' : null, 'Hostname' : 'demoaut-mimic.kazurayam.com', 'Username' : 'John Doe', 'Password' : 'ThisIsNotAPassword'])
allVariables.put('product', allVariables['default'] + ['CURRENT_TESTCASE_ID' : '', 'MATERIAL_REPOSITORY' : null, 'Hostname' : 'demoaut.katalon.com', 'Username' : 'John Doe', 'Password' : 'ThisIsNotAPassword'])
In a Test Listener of my “Visual Testing in Katalon Studio” project, I have a code as follows:
@BeforeTestCase
def beforeTestCase(TestCaseContext testCaseContext) {
if (GlobalVariable.MATERIAL_REPOSITORY == null) {
MaterialRepository mr = MaterialRepositoryFactory.createInstance(materialsFolder)
GlobalVariable.MATERIAL_REPOSITORY = mr
}
GlobalVariable.CURRENT_TESTCASE_ID = testCaseContext.getTestCaseId() // e.g. 'Test Cases/TC1'
}
This worked fine with Katalon Studio 5.7.x
What happend in 5.8.0
In Katalon 5.8.0, I can not select Null as the type of a GlobalVariable any longer. The option Null is not available. See the screenshot:
Because I could not select Null for GlobalVariable.MATERIALS_REPOSITORY in a new Profile “google.co.jp”, I alternatively assigned String type for it. I found in the source code I noticed the GlobalVariable.MATERIALS_REPOSITORY has the initial value ‘’ of String type.
static { def allVariables = [:]
allVariables.put('default', ['CURRENT_TESTCASE_ID' : '', 'MATERIAL_REPOSITORY' : null, 'Hostname' : 'demoaut.katalon.com', 'Username' : 'John Doe', 'Password' : 'ThisIsNotAPassword'])
allVariables.put('google.co.jp', allVariables['default'] + [ 'MATERIAL_REPOSITORY' : '', 'CURRENT_TESTCASE_ID' : '', 'URL' : 'https://www.google.co.jp/ncr'])
allVariables.put('google.com', allVariables['default'] + [ 'MATERIAL_REPOSITORY' : null, 'CURRENT_TESTCASE_ID' : '', 'URL' : 'https://www.google.com/ncr'])
When I runt the Test, I got the following error:
Test Cases/StepByStep/TC_step4 - parameterized URL FAILED because (of) ( Stack trace: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '' with class 'java.lang.String' to class 'com.kazurayam.materials.MaterialRepository' at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:405)
It seems that the org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM() does not like substituting my instance of com.kazurayam.materials.MaterialRepository class into a internal.GlobalVariable with initial type of java.lang.String.
How significant is this issue?
Until v5.7.1 I could store any type of Java/Groovy object into a GlobalVariable with initial type of Null. I depend heavily on this technique. I use this technique in the following projects of mine.
-
Visual Testing in Katalon Studio - Katalon Studio - Katalon Community
-
Testing YouTube video in Katalon Studio - Archive - Katalon Community
-
Testing Slideshow in Katalon Studio - Archive - Katalon Community
and more.
Conclusion
Now in KS5.8.0, GlobalVariable of type Null is gone. Therefore you can not save instances of user-defined classes into GlobalVariable any longer.
I miss GlobalVariable of type Null very much. I can not use KS5.8.0 at all due to this restriction.
I hope Katalon Team to bring GlobalVariable of type Null available again.