How to use the Global Variable

I want the test listener to use a global variable to execute a specific test case or test suite.
I make global variable of type null and in the test listener i save the TestCaseContext object into the global variables. But i don’t know how to cast the global variable to the appropriate types explicitly.

  1. When I use the global variable in the test listener and then switch the execution profile, does the global variable execute according to the active profile?

Pls help me

Please show your code and the error log you got.

It still execute the test case, but not execute specific test case that I want to
In test listeners

	def sampleBeforeTestCase(TestCaseContext testCaseContext) {
		GlobalVariable.TEST_CASE_CONTEXT = testCaseContext.getTestCaseId()

In test case

testName = GlobalVariable.TEST_CASE_CONTEXT

What did you expect to see?

What did you actually see?

Please show the error message if you have got any

it does not have any error
I just want to use global variables to perform a specific test case

I do not see what you want.

You just want to learn how to use global variables?

Then, Katalon Studio provides some built-in sample projects. For example:

This project uses GlobalVariables. Why not you try this on your machine and read the code to learn how to use GlobalVariables?

Thank a lot