Create an testng.xml file say name as testsuite.xml.
Now follow below 2 steps:
Step 1: Create an batch file for scheduler:
use below code - modify it and paste in notepad. save the notepad in working directory as"run.bat"
set ProjectPath=C:\Selenium\Selenium_tests\DemoProject
echo %ProjectPath%
set classpath=%ProjectPath%\bin;%ProjectPath%\Lib\*
echo %classpath%
java org.testng.TestNG %ProjectPath%\testsuite.xml
a) First line is for setting project path .
b) second line is for verifying that path is set or not.
c) third line is for setting classpath - lib folder contain all the jar file added to project build path
d) fourth line is for verifying whether classpath is set or not
e) fifth line is for executing xml file having details of all test.
Step 2:
Go to control panel.
Administrative tool.
Task scheduler and create a task which will trigger run.bat file at the time you want.
It will work.