https://github.com/nikiforovall/tests-instrumentation-with-otel-and-aspire
Integration Tests + Alba + Aspire Dashboard + Testcontainers + Otel
https://github.com/nikiforovall/tests-instrumentation-with-otel-and-aspire
aspire dotnet opentelemtry
Last synced: about 1 month ago
JSON representation
Integration Tests + Alba + Aspire Dashboard + Testcontainers + Otel
- Host: GitHub
- URL: https://github.com/nikiforovall/tests-instrumentation-with-otel-and-aspire
- Owner: NikiforovAll
- License: mit
- Created: 2024-06-06T15:52:15.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-06-12T09:02:33.000Z (11 months ago)
- Last Synced: 2025-02-28T08:33:55.052Z (about 2 months ago)
- Topics: aspire, dotnet, opentelemtry
- Language: C#
- Homepage: https://nikiforovall.github.io/dotnet/opentelemtry/2024/06/07/test-instrumentation-with-otel-aspire.html
- Size: 535 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Automated Tests Monitoring With Aspire Dashboard
Integration Tests + Alba + Aspire Dashboard + Testcontainers + Otel
See also: - for Getting Started.

This repository demonstrates how to instrument integration tests via OpenTelemetry and see the results from Aspire Dashboard.
Integration tests dependencies (PostgresSQL Database, AspireDashboard) are automatically managed as Testcontainers.
Open: to see the results of Test Runs.
## Test
```bash
dotnet test --filter TodosTests --verbosity normal
# Starting test execution, please wait...
# A total of 1 test files matched the specified pattern.
# [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.1+ce9211e970 (64-bit .NET 8.0.6)
# [xUnit.net 00:00:00.17] Discovering: Api.IntegrationTests
# [xUnit.net 00:00:00.24] Discovered: Api.IntegrationTests
# [xUnit.net 00:00:00.24] Starting: Api.IntegrationTests
# [xUnit.net 00:00:07.51] Finished: Api.IntegrationTests
# Passed IntegrationTests.TodosTests.PostTodos_InvalidTitle_BadRequest(todoItem: TodoItemViewModel { Id = 205, Title = Title4cc824aa-1ec5-4c99-b210-7e5251a86876, IsComplete = True }) [139 ms]
# Passed IntegrationTests.TodosTests.DeleteTodo_ExistingTodo_NotFound [327 ms]
# Passed IntegrationTests.TodosTests.PostTodos_ValidTodo_Ok [359 ms]
# Passed IntegrationTests.TodosTests.DeleteTodo_ExistingTodo_Ok(item: TodoItem { Id = 234, IsComplete = True, Title = "Title652b0e41-0d24-427a-a829-33dfa22eab88" }) [378 ms]
# Passed IntegrationTests.TodosTests.GetTodo_ExistingTodo_Ok(item: TodoItem { Id = 198, IsComplete = True, Title = "Titlef9f1ab3a-0c0e-49ea-a94f-c008183794aa" }) [437 ms]
# Passed IntegrationTests.TodosTests.GetTodos_SomeTodosExist_Ok(todoItemTitle: "todoItemTitle43031b1e-8d34-49a1-82e9-fc844ff505ea") [508 ms]# Test Run Successful.
# Total tests: 6
# Passed: 6
# Total time: 8.3519 Seconds
```## Demo
All traces:

Result of warmup:

Note, events denoted when each dependency has started.
Sequential test run:

Parallel test run:

💡Test Runs are separated based on `service.instance.id` which is equivalent to `test.run_id` custom attribute and assigned based on sequential Guids.

## Reference
-
-
-
-
-