- Currently working on Selenium WebDriver and using Java. I have a project called*Test*.
- In that Project i have many Java Programs such as Login.java, Testing1.java etc.,.
- The scenario is i want to run all my scripts daily morning at 12.00 a.m. Is there any possibility to create a scheduler to run my scripts automatically.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
check with quartz scheduler.. http://quartz-scheduler.org/
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"
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.
I am currently working on a similar project where I have to check different web applications for their availability every ~5 minutes and report any errors via mail. I am also using TestNG ans the WebDriver together. I solved my "scheduling problem" by using the TimerTask class.
Here's a short code example: (Find more code examples here)
Since it implements Runnable, you can run multiple threads with it.
Hope that helps. If you have questions how to integrate it with your TestNG set up, just shoot.