Hi there i´m trying to use CI/CD in GITLAB and i´m prettey new to this.
I was able to create the following yml file
# Default image is docker:stable
image: docker:stable
# Define deployment stages
stages:
- build
# We use docker-in-docker (dind) for building docker images (build stage)
services:
- docker:dind
# Build unit test on dotnet core sdk image
build:
stage: build
image: mcr.microsoft.com/dotnet/sdk:5.0
script:
- cd TestRegressionNebra/
- dotnet restore "TestRegressionNebra.csproj"
- dotnet build "TestRegressionNebra.csproj"
- 'dotnet test "TestRegressionNebra.csproj" --test-adapter-path:. --logger:"junit;LogFilePath={assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose"'
artifacts:
when: always
paths:
- ./**/*test-result.xml
reports:
junit:
- ./**/*test-result.xml
tags:
- nebra
But when i run this it gives me this error :
Test run for /builds/fm/ecommerce/qa/testregression/TestRegressionNebra/bin/Debug/net461/TestRegressionNebra.dll (.NETFramework,Version=v4.6.1) Microsoft (R) Test Execution Command Line Tool Version 16.11.0 Starting test execution, please wait... A total of 1 test files matched the specified pattern. System.IO.FileNotFoundException: Could not find 'mono' host. Make sure that 'mono' is installed on the machine and is available in PATH environment variable. at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper.GetMonoPath()
When i run the same command in my personal PC no problems were found.
EDIT: My *.csproj file attached
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JunitXml.TestLogger" Version="3.0.98" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Selenium.Support" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="94.0.4606.6100" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Configuration.Install" />
</ItemGroup>