【发布时间】:2020-06-05 22:23:43
【问题描述】:
我使用 NUnit 框架来测试我的 .NET 项目。我想通过 GitHub Actions 运行我的测试。
我的项目的程序集中应该包括什么?也许有一些标准的例子?
【问题讨论】:
-
您可能会在 DevOps SE 上找到更好的答案,因为这并不是真正的编码问题。
标签: c# unit-testing github nunit github-actions
我使用 NUnit 框架来测试我的 .NET 项目。我想通过 GitHub Actions 运行我的测试。
我的项目的程序集中应该包括什么?也许有一些标准的例子?
【问题讨论】:
标签: c# unit-testing github nunit github-actions
您无需在程序集中包含任何内容即可使用 GitHub Actions 运行测试。只需在 .github/workflows 文件夹中创建工作流文件,内容如下(假设您有 .NET Core 项目):
---
name: Tests
on: push
jobs:
tests:
name: Unit Testing
runs-on: windows-latest
steps:
- uses: actions/checkout@v2.1.0
- run: dotnet test
dotnet已预装在windows机器上,但未预装在macos和ubuntu上。因此,您必须通过添加一个额外的步骤来安装dotnet,以防您想在其中一台机器上运行它。为此,您可以使用actions/setup-dotnet 操作。
【讨论】: