[Katalon Profile] Dynamic Profile update upon execution

Victor,

I think that Execution Profile in Katalon Studio is designed read-only for test cases. It is not designed to be updated by test cases runtime.

You can create a json text file in the project directory. I think that a json file would be much easier storage for your dynamic information than modifying Execution Profiles. You can save a json file anywhere in the projectDir; for example /tmp, or /Data Files/. I myself would write it into /Materials folder using my Materials library.

Writing and reading a JSON file is quite easy in Groovy. A sample code from https://gist.github.com/keyle/723181f3a9a59a3f7652

package utils
import groovy.json.JsonBuilder
import groovy.json.JsonSlurper
class HDD {
    static save(Object content, String filePath) {
        new File(filePath).write(new JsonBuilder(content).toPrettyString())
    }
    static Object load(String filePath) {
        return new JsonSlurper().parseText(new File(filePath).text)
    }
}

4 Likes