This tutorial explains how to execute a DOS command during a test scenario. Use this when you want to prepare a test execution to delete result files or run a batch file.
Using an Execute Command task, you can run accessible executable files. We will use this task type in this example to run a DOS batch file:
- Create an Execute Command task.
- Select the Configuration tab
- Set Command line path to C:\mybatch.bat
- Add any parameter in the Arguments test area, if needed
The Execute Command task can also be used to run commands directly – for instance, deleting a file. This time, the cmd.exe executable needs to be called.
- Create an Execute Command task.
- Select the Configuration tab
- Set Command line path to C:\Windows\System32\cmd.exe.
- Set Arguments to /C del “C:\myFileToDelete.txt”. Notice the “/C” before the actual command. This is required by the command interpreter.