Is there a way to obtain the Katalon user profile of the logged in user? As we are a group running tests on different devices, some of the results might vary slightly so I wanted to create an if statement based on the user logged in to Katalon.
To obtain the current user, you just need to run the
whoami command. This command is available on both Windows and Linux.
To run a command, you could use the ProcessBuilder library. Or in this sample code, I will use an util of Katalon /=)
import com.kms.katalon.core.util.ConsoleCommandExecutor String whoAmI = ["whoami"] String theChosenOne = ConsoleCommandExecutor.runConsoleCommandAndCollectFirstResult(whoAmI) println "\n --- " println 'I am "' + theChosenOne + '"' println " --- \n"