When I run a test or a test suite, the values for the global variables are persisted throughout the test execution, but the original values remain the same, having the ability to decide whether to persist the values obtained during the test to the permanent stored global variables will enable to run individual test objects (per instance when you have to analyze an error or when adding new test objects that use the variables obtained in the test) without the need to seek for each global variable assignment and copy those values to each corresponding global variable.
I understand your need and perhaps the devs may agree and might provide such a switch. However, there are problems with this approach:
At startup, for testing to be meaningful, the variables and values should be known and provably so.
It a test has errors and the test is aborted, your variables will be in an unpredictable state. What happens to the remaining tests? How do you plan on providing them with the values they need in a predictable manner?
A better method might be to write the values to a time-stamped file and read the values in the subsequent test. Then you won’t need to find anything or sort and search the variables in the profile settings - they’ll be fully automated.
if you really want to update the global variables permanently, there is an workaround, see:
read the topic carefully.
however, i strongly advice against it, better use another solution (write them into a separate file/database, use a custom class etc)
note that Katalon it is not following Postman in this approach, where you can override Environment variables through the Global ones so you can safely preserve the initial values but still keep the end of run values … if used with caution.
there is a single Profile in use at a time so any changes straight into the initial values will lead to data loss.
better, write a tear-down method to export all global variables values to a third-party file at the end of the suite execution for debug purposes.
you can use an xml factory to have them in the same structure as the profiles are using, so in case you need them for next execution you can quickly create a new profile from it by using script mode.
Thanks a lot Bionel for your answer, in my case, I designed the global variables to have 2 separated kinds, one is constant like variables that are only used but never overwritten, and the others don’t have an initial value and are only used to pass data between different tests, so possibly the solution to make the changes permanent will work for me.