Schedule the TestNG Scripts For Execution

As we may be busy with our script development or our manager asks us to prepare an automated scheduler which will run our scripts when we are not available or without our intervention.

Let’s see with an example how we are going to achieve this.

Steps to Create an Automation Scheduler in Windows :

Open the Task Scheduler from Start icon by entering the text scheduler in the search box.
Java-Task-Scheduler-Windows

2.Select the Task Scheduler.

Java-Task-Scheduler-Select

  1. A three pane console should be opened.

Scheduling-TestNG

  1. Goto the third pane i.e Actions and select Create Basic Task.

Java-Task-Scheduler-Create-Basic-Task

  1. Create a Basic Task will be opened.

Java-Task-Scheduler-Task-Name

  1. Enter the name of the task and description for the task.

Java-Task-Scheduler-Name-Description

  1. Click “Next” button, which will display the trigger dialog icon.

Java-Task-Scheduler-First-Next-Button

  1. In the Trigger Diaglog icon, we have an option at what intervals the script needs to run like Daily, Weekly, Monthly, One Time, when the computer starts, When I log on, When a specific event is logged.
  2. Selected Daily in this example.Java-Task-Scheduler-Second-Next
  3. Click Next button.

Java-Task-Scheduler-Trigger-Next

  1. Select the start and end date.

Java-Task-Scheduler-Daily

  1. Click Next button

Java-Task-Scheduler-Daily-Next

  1. Action wizard will open.

Java-Task-Scheduler-Action

14.Let the choose be “Start a program”

  1. Click Next button.

Java-Task-Scheduler-Action-Next

16.Click Browse icons.

Java-Task-Scheduler-Browse-Icon

Select the bat file created for TestNG to be executed.
Click Next button
Finish Dialog icon should be displayed.
Click Finish Button.
In the Task scheduler Summary , you will be able to see the task created in the active Tasks list.
Congratulations you have created your automation scheduler now. The Scheduler will pick the bat file and read the testng.xml to execute the scripts.

Leave a Comment

Your email address will not be published. Required fields are marked *