Launch Windows Executables or Batch Files at beginning of TestCase

Hi I would like to launch windows executables, bat files etc at the beginning of each Test Case, rather than doing this manually before running the automated web testing.
I’ve tried doing this in script mode but do not seem to be able to launch either bat or exe.
Anyone have samples for this please

Hi Gareth ,

In this case I would suggest using ‘Test Listeners’ and insert your code in @BeforeTestCase call. It would be like this

import java.nio.file.Path

import com.kms.katalon.core.annotation.BeforeTestCase
import com.kms.katalon.core.context.TestCaseContext

class NewTestListener {
	/**
	 * Executes before every test case starts.
	 * @param testCaseContext related information of the executed test case.
	 */
	@BeforeTestCase
	def sampleBeforeTestCase(TestCaseContext testCaseContext) {
		def BatchFile = Path+'yourBatch.bat'
		Runtime.runtime.exec(BatchFile)
	}
}

Thanks Vinh

I will give this a try today