# Scheduling on Windows
This post will explain, how you may schedule test cases written in vREST NG Application on Windows machine.
# Prerequisite
Prerequisite for the machine, on which you want to schedule test cases.
- Download/Install
vrest-ng-cli
utility. For download and setupvrest-ng-cli
, please follow Setup / install vREST NG CLI.
Let's take a sample application (Contacts Application) and step by step guide on how we can schedule vREST NG test cases.
TIP
Note: You can find the source code of the sample application at Github (opens new window).
# Step by Step Guide:
# Step 1: Write your automated test suite in vREST NG Application
First, you need to write test cases for your test application in the vREST NG Application to ensure the build quality of your web application. You can find the test cases for our sample application in the Github repository here (opens new window).
# Step 2: Learn how vrest-ng-cli command works and get your hands dirty on it by installing it locally first
First, try out the vrest-ng-cli module by following the guide Execute Test Cases using vREST NG CLI.
Once you setup this module on your local machine, you can execute the vREST NG test cases by executing the following command:
/path/to/vrest-ng-cli.exe run --projectdir=<path_to_project_dir> --logger=xunit [--logfilepath=<absolute log file path>] [--env=<ENVIRONMENT>]
# Step 3: Write a batch script to be executed by Windows Task Scheduler
Now, you may add this vrest-ng-cli command in a batch script which you can schedule via Windows Task Scheduler. That's it.
In the below batch script, we have also redirected the vrest-ng-cli
command standard output and error to a log file. This will help in debugging if anything goes wrong while executing test cases using vrest-ng-cli
.
set mydate=%date:/=_%
set mytime=%time::=_%
set logFileName=%mydate: =_%_%mytime:.=_%
"C:\Users\John Doe\Desktop"\vrest-ng-cli.exe run --projectdir=<path_to_project_dir> --logger=xunit --logfilepath=<absolute log file path> --env=<ENVIRONMENT> 1> "C:\Users\John Doe\Desktop\vrest_process_logs"\%logFileName%.log 2>&1
Now you may integrate this batch script in Windows Task Scheduler.