GitHub 工作流操作中的 Jenkins 插件 MSTestRunner 等价物

Jenkins Plugin MSTestRunner equivalent in GitHub Workflow Actions

Github Actions Workflow 中是否有 MSTest.exe YAML 等效项? 是否可以获取包含 /testcontainer/category/resultsfile 的示例 yaml?

我找到了 MSBuild。不确定是否可以将 MsBuild 用于 运行 MSTest,如果可以的话,那么使用上面的示例也可以解决我的问题。

当前工作流 yaml

 name: MS Test Build

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:

  build:
    runs-on: windows-latest
                             
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    
    - name: Setup MSBuild
      uses: microsoft/setup-msbuild@v1.0.2

    - name: MSTest
      shell: powershell
      run: '& "$(vswhere -property installationPath)\Common7\IDE\MSTest.exe" /testcontainer:Test.dll /resultsfile:TestResults.trx'

编辑:更新了半工作解决方案。

既然你手边有 msbuild,你应该也能 运行 mstest:

name: MSBuild and MSTest CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@master

    - name: Dependency - MSBuild
      uses: microsoft/setup-msbuild@v1.0.2
      with:
        vswhere-path: 'C:\Program Files (x86)\Microsoft Visual Studio\Installer'  

    - name: MSBuild
      working-directory: src
      continue-on-error: true
      run: msbuild MyProject.csproj

    - name: MSTest
      working-directory: src
      continue-on-error: true
      run: mstest <paramaters here>

Here you have info how to use msttest

工作解决方案。仍在寻求改进,但这会奏效


name: MS Test Build

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:

  build:
    runs-on: windows-latest
                             
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    
    - name: Setup MSBuild
      uses: microsoft/setup-msbuild@v1.0.2

    - name: MSTest
      shell: powershell
      run: '& "$(vswhere -property installationPath)\Common7\IDE\MSTest.exe" /testcontainer:Test.dll /resultsfile:TestResults.trx'