Search code examples
msbuildyamljenkins-pluginsmstestgithub-actions

Jenkins Plugin MSTestRunner equivalent in GitHub Workflow Actions


Is there an MSTest.exe YAML equivalent in Github Actions Workflow? If there is can a get sample yaml that includes how a /testcontainer, /category, and /resultsfile would look like?

I was able to find MSBuild. Not sure if it's possible to use MsBuild to run MSTest's if it is then an example using the above would solve my question as well.

Current Workflow 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'

edit: updated with semi-working solution.


Solution

  • Working solution. Still looking for improvements but this will work

    
    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'