Unit tests for microservices


#1

There are no unit tests written for it. Are there any reasons for it?


#2

No special reason, eventually we will add some tests, for now, we have focused on the core functionality and making the solution work.


#3

You know developers don’t like writing tests. :slight_smile:


#4

Thanks for the update!


#5

I can understand! :grinning:


#6

Yeah, well, it’s not like we don’t like testing, it’s just that there were more urgent things to do :wink:.


#7

Are you guys open to receive PRs to get those tests in place?


#8

Yes, any additional help would be really appreciated!
Basically, our approach (at least for now), is to have 2 separate test projects under tests directory e.g. tests/DShop.Api.Test and tests/DShop.Api.Test.EndToEnd.
The first one would be basic unit tests, for example using xUnit, Moq, FluentAssertions, Fixture etc. and the second one would be sort of a integration/e2e tests using ASP.NET Core Test Server library.


#9

So the direction you want to take is XUnit, Moq, and FluentAssertions. What other standards are you wanting to set? With some coordinated standards we can get some things moving forward.


#10

It’s not mandatory - these are the libraries that we use on a daily basis, however, feel free to use something else. I think that we’d like to stick to xUnit as the testing framework and FluentAssertions (or something similar) to skip a static Assert.() code. The key is just to stay consistent :slight_smile:.