Search code examples
asp.netblazorblazor-server-sidebunit

Is there currently a way to run Blazor bUnit tests from within the GitLab CI Pipeline?


We have a Microsoft .NET Blazor server-side application. We have incorporated bUnit testing that triggers when we run the Blazor app from within VisualStudio.

Recently, we have been asked to use GitLab for our CI/CD.

As I am new to GitLab and bUnit, itself, is fairly new, I am not sure how to accomplish this.

In VisualStudio, in order to create and run bUnit tests, we had to have a structure like so:

OurProject/
∟ BlazorProject/
  ∟ BlazorProject.csproj
  ∟ BlazorProject.sln
∟ bUnitTests/
  ∟ bUnitTests.csproj

I'm not even sure how to, or if it is possible, to run these tests from PowerShell. I add this part as the GitLab .gitlab-ci.yml file is essentially running command line commands to accomplish the tasks.

So, does anybody know how to accomplish running bUnit test from within the GitLab CI pipeline?


Solution

  • Just run the test project like you normally do, e.g. via dotnet test.

    Looks like this template is a good starting point: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/dotNET-Core.gitlab-ci.yml