I am making a Dockerfile for a dotnet core project with some xUnit tests. I want to run the unit tests when the images are being built. However when I docker build I get the following message at the test step:
No test is available in /ciad/tests/bin/Debug/netcoreapp2.1/Tests.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Here is the Dockerfile:
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /ciad # restore COPY API/API.csproj ./api/ RUN dotnet restore api/API.csproj COPY Tests/Tests.csproj ./tests/ RUN dotnet restore tests/Tests.csproj # copy src COPY . . # test RUN dotnet test tests/Tests.csproj
I’m aware that this is an incomplete dockerfile. I’m just stuck with the tests at the moment. Could anyone see what I’m missing?
Good to mention that tests run fine in VS and “dotnet test” command works too. I can also see that the Tests projects’ files are copied to the container.
docker build -t testing .