【问题标题】:How to Schedule Selenium Web Drivers Tests in C#如何在 C# 中安排 Selenium Web 驱动程序测试
【发布时间】:2019-05-28 11:52:29
【问题描述】:

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

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

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

提前致谢。

【问题讨论】:

  • 您可以在 Windows 任务调度程序中安排一个作业,以使用 NUnit.exe 运行测试用例。
  • 构建项目并使用 Nunit-Console.exe 生成的 dll 来运行它。命令行文档:nunit.org/docs/2.5.9/consoleCommandLine.html NUnit 控制台安装程序位置:github.com/nunit/nunit-console/releases
  • 对使用 Jenkins 有什么想法吗?如果这是您正在从事的本地项目还是由公司驱动的,您不会详细说明吗?如果你创建了一个 Jenkins 实例,你就可以开始朝着 CI/CD 方向努力了。
  • @VivekNatarajan 那么我们将如何安排测试用例运行

标签: c# selenium selenium-webdriver selenium-chromedriver scheduling


【解决方案1】:

使用任务调度器;

  1. 使用命令创建批处理文件以执行测试(例如 ..\nunit.exe ..\seleniumTests.cs)
  2. 打开“任务计划程序”
  3. 创建一个以时间/频率为“触发器”的任务,并将批处理文件设置为“动作”以执行。

【讨论】:

【解决方案2】:
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.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-25
    • 2012-09-02
    • 1970-01-01
    • 2012-11-04
    相关资源
    最近更新 更多