I created a test-case using global variables as url/username/password and execute it from cmd line using the -g_ approach to run the test for different environments.
Each time it runs it has to instantiate the whole runtime environment adding time to the overall duration.
Is there a way to have the url/user/passw combinations stored inside the project (or maybe read from .csv?) and execute the test case while looping over those combinations so it only has to instantiate once?
it is definitely possible. If you prefer using external sources (e.g. file), this should work:
import com.kms.katalon.core.util.KeywordUtil
File loginInfoFile = new File("C:\\test\\userPasswdCombofile.txt")
BufferedReader fr = new BufferedReader(new FileReader(loginInfoFile))
List<String[]> parsedLoginInfo = new ArrayList()
while((line = fr.readLine()) != null) {
String[] parsedLine = line.split(",")
parsedLoginInfo.add(parsedLine)
}
for(String[] singleRecord in parsedLoginInfo) {
KeywordUtil.logInfo("For the address " + singleRecord[0] + ": My name is " + singleRecord[1] + " and my password is " + singleRecord[2])
// put your test scenario into this loop
}
or you can simply use the builtin feature for data driven testing approach.
check the doc’s, there are also plenty topics on this matter here on the forum
add your testcases to a testuite and bind the data file to it
It’s running the test-case & looping over a bunch of URL’s from a file and grabbing the necessary variables with just a single invocation of Katalon cmdline. Also squeezed in some steps to send metrics to a Prometheus push gateway for Grafana visualising! Looking great!