Closed seertenedos closed 4 years ago
@seertenedos could you make sure that these files:
IoC.dll
TeamCity.ServiceMessages.dll
TeamCity.VSTest.TestAdapter.dll
TeamCity.VSTest.TestLogger.dll
are in a directory like YourTestProject\bin\Release\netcoreapp2.2
before running a command like dotnet test -c Release --no-build
The option --no-build
supposes that all binaries were already built and an output folder is ready to run tests.
Also try running your tests without the option --no-build
.
@NikolayPianikov wow you were right. without --no-build it works.
Thanks to your help i have located the causeand it comes down to when you set ENV TEAMCITY_VERSION. Turns out it needs to be set before the build where as in the past i set it only before i ran the tests. eg
RUN dotnet build "U-BLT.sln" -c Release
ARG TEAMCITY_VERSION
ENV TEAMCITY_VERSION = $TEAMCITY_VERSION
RUN dotnet test -c Release --no-build -verbosity:normal ./U-BLT.sln
but
ARG TEAMCITY_VERSION
ENV TEAMCITY_VERSION = $TEAMCITY_VERSION
RUN dotnet build "U-BLT.sln" -c Release
RUN dotnet test -c Release --no-build -verbosity:normal ./U-BLT.sln
works and it also works without the --no-build I would have though it was the test that checks the env var but it actually looks like it is the build that does it. I can handle that but just makes things a little be more of a pain for reusable layers to prevent multiple builds of the same code.
I don't remember this being stated anywhere in the documentation and honestly it is not what i would expect.
I've added notes under the demo video.
This ticket saved me tons of time! I hadn't built my project with TEAMCITY_VERSION, just ran the tests with it.
dotnet test -c Release --no-build -verbosity:normal ./U-BLT.sln
results in the following error for my 2+ unit test projects and i can't work out how to fix it.
Environment/setup I am using dotnet core 2.2 docker images. Building on linux. I am performing the tests as part of the docker build in case this affects anything and i am using
Basically i am trying to run all test projects on a solution in a docker build step on teamcity as something we would use for all our solutions going forward. I am doing it inside the docker build pipeline to take advantage of the multi image builds and caching in docker to greatly speed up the build especially for some of our bigger applications with many projects and nuget packages.