在持续集成期间,我尝试在VST上发布我的单元测试,我使用docker,在执行发布任务时,我仍然得到以下错误,因此
dotnet测试
找不到命令。
No test result files matching **\test-results.xml were found.
如果我运行命令
docker compose运行web测试
在本地,将创建一个包含预期测试结果的测试结果文件夹。xml文件。
我在VST上做错了什么?
回购代码:
Github
我的文件夹体系结构:
web/
âââ web/
â âââ web.csproj
â âââ Dockerfile
â
âââ web.test/
â âââ web.test.csproj
â
âââ web.sln
âââ docker-compose.yml
âââ docker-compose.override.yml
Dockerfile(编辑删除额外的dotnet测试命令):
FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY web.sln ./
COPY web/web.csproj web/
COPY web.test/web.test.csproj web.test/
RUN dotnet restore -nowarn:msb3202,nu1503
COPY . .
WORKDIR /src/web
RUN dotnet build -c Release -o /app
FROM build as test
WORKDIR /src/web.test
#RUN dotnet test
FROM build AS publish
WORKDIR /src/web
RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "web.dll"]
docker编写。yml:
version: '3.4'
services:
web:
image: web
build:
context: .
dockerfile: web/Dockerfile
web-tests:
image: web-tests
build:
context: .
dockerfile: web/Dockerfile
target: test
volumes:
- ${BUILD_ARTIFACTSTAGINGDIRECTORY:-./tests-results/}:/tests
docker编写。推翻yml:
version: '3.4'
services:
web:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "80"
web-tests:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "80"
entrypoint:
- dotnet
- test
- --logger
- trx;LogFileName=/tests/test-results.xml
以及我的两个VSTS任务