Hi there, would be great if you could provide additional guidance for testing when using VSTS for CI/CD.
So far I have built the 'unittest' container and modified the dockerfile to include:
RUN dotnet test --logger "trx;LogFileName=TEST-unittest_results.xml"
I can see the tests being run and the file being created BUT how do I know get the file in VSTS and how to stop the build if there are failing tests? I have added the 'Publish Test Results' task but it doesn't find the file. I'm guessing this is because the file is in the container vs the build environment.
I found this but cant seem to get it working (I'm guessing it is because I am using the Linux host).
Is there are more elegant way?
Hi.
I think there is a better approach:
Anyway @CESARDELATORRE maybe we could create some wiki topic for this issue
@eiximenis thanks for this, this approach makes sense. I am quite new to Docker, can you give me some rough pointers as to what I will need to alter from your example in order to make it work with a multi-container solution?
I've just asked the exact same question here
https://forums.asp.net/p/2138254/6198514.aspx?p=True&t=636573940055548684
Any guidance available somewhere for microservices ?
@eiximenis
Your article is brillant, congratz!!
It's exactly what I was looking for, but with no luck on Google.
I just have an additional question about Microservices : should each Microservice project have its own Test project ? Indeed in eShopOnContainer it's not the case and I wonder how you deal with your tests in VSTS ??
This a very important point that we can't find any reliable guidance anywhere.
@eiximenis I tried to leave a comment on your blog with no success.
I encounter a problem on the Publish Task following your tutorial : VSTS is not able to find the test result xml file (problem described here)
Could you advice me ? I can't find a full explanatory tutorial about the CI part on dotnet with Docker especially when using Unit Tests....
Thanks
Hi @NicolasReyDotNet
I answered your comment in my blog (I was on holidays so I did not saw your comments).
I copy here the same comment I left as my asnwer:
The VSTS pipeline I have is exactly the one shown in this article.
The key point is the bind mount between the test container and the host (the VSTS build agent). Just be sure that you have the volume defined (either in docker-compose.yml as in my post or in docker-compose.override.yml file) and be sure that the path of the bind mount is correct.
In VSTS I use th BUILD_ARTIFACTSTAGINGDIRECTORY environment variable as a host path for the bind mount, so in the “Publish Test Result Task” I need to set the “Search folder” to Search folder: $(Build.ArtifactStagingDirectory)
Let me know if you still have problems!
@eiximenis
Thanks for your feedback (hope your holidays were good !)
I can't access your blog since I posted a comment, I get a blank screen : same from each device from where I posted a comment (sorry for the double post I thought an error occured)
Blank screen on blog
Well, I stilll get the same problem... I think I should miss some point, but I don't know which one.
Is it possible to continue this discussion on stackoverflow ( ?to not pollute the original issue with my needs) ? 'm really sorry to bother you but you're the first one who achieved my exact needs with a fully understandable article ...
The discussion on stackverflow is here CI publish test fail
Closing this issue.
Most helpful comment
Hi.
I think there is a better approach:
Anyway @CESARDELATORRE maybe we could create some wiki topic for this issue