Home > OS >  How can i run Microsoft Unit Testing Framework for C using github actions?
How can i run Microsoft Unit Testing Framework for C using github actions?

Time:09-01

i'm trying to run my unit test which is using the Microsoft Unit Testing Framework for C using Github actions.

I'v tried adding the DLL with the exe of the sln but it doesn't seem to work.

build:

runs-on: windows-latest

steps:
# using tmp v3 git branch 
- uses: actions/checkout@v3
# getting dependencies 
- name: getting dependencies
  working-directory: UnitTest
  run:  ./BuildTest.bat
# set up 
- name: set up
  working-directory: UnitTest
  run:  ./SetUpTest.bat
# adding msbuild path 
- name: add msbuild to PATH
  uses: microsoft/[email protected]
# # building sln in release 
# - name: build release
#   run: msbuild Dare.sln /p:Configuration=Release
# building sln in debug 
- name: build debug
  run: msbuild Dare.sln /p:Configuration=Debug

# run unit test
- name: list
  working-directory: bin/Debug-windows-x86_64/DareEditor
  run : ls 

# run unit test
- name: run unit test
  working-directory: bin/Debug-windows-x86_64/DareEditor
  # run : ls 
  # run: ./DareEditor.exe /Platform:x64 ./x64\Debug\UnitTest1.dll
  # run: ./DareEditor.exe /Platform:x64 ./x64\Debug\UnitTest1.dll
  run: ./DareEditor.exe 

CodePudding user response:

Went through the documentation and got it working.

Microsoft unit test - https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options?view=vs-2019

GitHub actions vstestconsole set up - https://github.com/marketplace/actions/commit-status-updater

runs-on: windows-latest

steps:
# using tmp v3 git branch 
- uses: actions/checkout@v3
# getting dependencies 
- name: getting dependencies
  working-directory: tools
  run:  ./BuildTest.bat
# set up 
- name: set up
  working-directory: tools
  run:  ./Setup.bat
# adding msbuild path 
- name: add msbuild to PATH
  uses: microsoft/[email protected]
# set up vstest path
- name: Setup VSTest Path
  uses: darenm/Setup-VSTest@v1

# building sln in release 
- name: build release
  run: msbuild Dare.sln /p:Configuration=Release

# building sln in debug 
- name: build debug
  run: msbuild Dare.sln /p:Configuration=Debug

# run unit test
- name: run unit test
  working-directory: bin\Debug-windows-x86_64\DareUnitTest
  run: vstest.console.exe DareUnitTest.dll
  • Related