Root path in global variable

Anyone know how to use the projects root path in a global variable right now I have in a global variable, I use the global variable to not hardcode the screenshot directory:

C:\Users\SurfacePro\Katalon Studio\BTS\Object Repository\Screenshots\Baseline

Or do i just have to do it through code?

You can get the project location and adding to the GlobalVariable

Get the project path

String path = System.getProperty("user.dir");
println (path)

Assign the path to GlobalVariable

GlobalVariable.ProjectPath = path

1 Like

Yeah I can do that too, but have to add that to each test, it’s fine was just thinking I could call it directly into global variable

you can set the needed global in the test listener :wink:

ealiaj you don’t need to add that to each test by using Test Listener

yeah forgot about test listeners thanks