如何在 C# 中安排 Selenium Web 驱动程序测试

How to Schedule Selenium Web Drivers Tests in C#

在我的开发项目中,我们使用 C# 使用 selenium webdriver 实现了回归测试用例。我想每天安排一次回归测试。 使用的工具如下所示。

  1. C# 上的 Selenium Webdriver
  2. Visual Studio 2017
  3. NUnit 测试框架

请提出任何其他解决方案。

提前致谢。

使用任务计划程序;

  1. 使用执行测试的命令创建批处理文件(例如 ..\nunit.exe ..\seleniumTests.cs)
  2. 打开'Task Scheduler'
  3. 创建任务 time/frequency 作为 'Trigger' 并将批处理文件设置为 'Action' 执行。
I found an exact solution for my scenario.

Tools is used:

1. NUnit3 Console. Location: https://github.com/nunit/nunit-console/releases

2. Windows Task Scheduler

 Download NUnit.Console-*.msi file.

 Install exe file. 

Create an nunit command to run your tests:

> nunit3-console testsfile.dll

More details here: https://github.com/nunit/docs/wiki/Console-Command-Line

Next, create the scheduled task

List item

 1. Open Task Scheduler
 2. Under Actions, Click Create a Basic Task
 3. Provide a descriptive name
 4. Choose the starting date and time.
 5. Choose Start a Program as the type of action
 6. In Program/Script add nunit3-console
 7. In Arguments add testsfile.dll
 7. In Start in add nunit3 console location
 8. Click Finish.

Now it will run on the schedule you provided.