I want to create an integration test in C#10 (.NET 6) that does some tests on the Elasticsearch index but I can't do it with the real data. I want to mock an index or create an index with dummy data and then test it by giving mock inputs and expecting results. The index will be for the testing purposes that's why either mocking or creating a dummy will work.
Asked
Active
Viewed 348 times
0
-
Look about [Test Containers](https://github.com/testcontainers/testcontainers-dotnet). – rabbitbr Oct 13 '22 at 11:11
-
What are the test containers used for? For mocking indices or creating dummy data? And can I use them in C#10? – greatdsa Oct 13 '22 at 11:14
-
The container test will create a container with Elasticsearch version x. That way you can create your test indices and validate queries you want. I usually use it in my integration tests when I create new APIs. However I work with java the link I sent you is for those who use .NET. – rabbitbr Oct 13 '22 at 11:17
-
Is there a way to do it without containers? – greatdsa Oct 14 '22 at 08:10
-
With Test Containers? I don't think so but using containers is the biggest benefit because you don't need to create the environment locally. – rabbitbr Oct 14 '22 at 14:11