{"id":13824288,"url":"https://github.com/martincostello/dotnet-minimal-api-integration-testing","last_synced_at":"2025-05-16T09:04:50.718Z","repository":{"id":36975334,"uuid":"376289478","full_name":"martincostello/dotnet-minimal-api-integration-testing","owner":"martincostello","description":"An example of integration testing ASP.NET Core Minimal hosting and APIs","archived":false,"fork":false,"pushed_at":"2025-05-12T09:50:49.000Z","size":6255,"stargazers_count":407,"open_issues_count":2,"forks_count":32,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-12T10:50:24.937Z","etag":null,"topics":["aspnetcore","dotnet","testing"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martincostello.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["martincostello"],"buy_me_a_coffee":"martincostello"}},"created_at":"2021-06-12T12:53:30.000Z","updated_at":"2025-05-12T09:50:51.000Z","dependencies_parsed_at":"2023-02-18T04:16:00.982Z","dependency_job_id":"ece38ac5-0b43-47e7-b213-d2e742637d90","html_url":"https://github.com/martincostello/dotnet-minimal-api-integration-testing","commit_stats":{"total_commits":1289,"total_committers":6,"mean_commits":"214.83333333333334","dds":0.2319627618308766,"last_synced_commit":"4caf85d8b7f569f93cdacb063386cb6d9bb36dea"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martincostello%2Fdotnet-minimal-api-integration-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martincostello%2Fdotnet-minimal-api-integration-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martincostello%2Fdotnet-minimal-api-integration-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martincostello%2Fdotnet-minimal-api-integration-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martincostello","download_url":"https://codeload.github.com/martincostello/dotnet-minimal-api-integration-testing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254501557,"owners_count":22081528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnetcore","dotnet","testing"],"created_at":"2024-08-04T09:01:00.293Z","updated_at":"2025-05-16T09:04:45.691Z","avatar_url":"https://github.com/martincostello.png","language":"C#","funding_links":["https://github.com/sponsors/martincostello","https://buymeacoffee.com/martincostello"],"categories":["dotnet","C# #","C\\#","C#","testing"],"sub_categories":[],"readme":"# Integration Testing ASP.NET Core Minimal APIs\n\n[![Build status](https://github.com/martincostello/dotnet-minimal-api-integration-testing/actions/workflows/build.yml/badge.svg?branch=main\u0026event=push)](https://github.com/martincostello/dotnet-minimal-api-integration-testing/actions/workflows/build.yml?query=branch%3Amain+event%3Apush)\n[![codecov](https://codecov.io/gh/martincostello/dotnet-minimal-api-integration-testing/branch/main/graph/badge.svg)](https://codecov.io/gh/martincostello/dotnet-minimal-api-integration-testing)\n\n## Introduction\n\nThis sample project demonstrates techniques you can use for integration testing\nan ASP.NET Core web application that uses the [minimal APIs] feature.\n\n[minimal APIs]: https://devblogs.microsoft.com/aspnet/asp-net-core-updates-in-net-6-preview-4/#introducing-minimal-apis\n\nThe system-under-test used by the sample implements a simple Todo list\napplication with ASP.NET Core using the following technologies:\n\n* [Minimal APIs]\n* [EFCore] with [SQLite]\n* [GitHub OAuth] authentication\n* [Razor Pages]\n* [TypeScript]\n\n[EFCore]: https://docs.microsoft.com/en-us/ef/core/\n[GitHub OAuth]: https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers/blob/dev/docs/github.md\n[Razor Pages]: https://docs.microsoft.com/en-us/aspnet/core/razor-pages/\n[SQLite]: https://docs.microsoft.com/en-us/ef/core/providers/sqlite/\n[TypeScript]: https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes-oop.html\n\nThe tests show how you can write integration tests for the [API] and [User\nInterface] layers of an application that can help you get good coverage of the\nsystem-under-test, as well as help give you confidence that the changes you make\nto an application are ready to ship to a production system.\n\nThe tests include demonstrations of the use of the following open source\nlibraries and technologies:\n\n* [coverlet]\n* [HttpClientFactory]\n* [HttpClient Interception]\n* [Playwright]\n* [ReportGenerator]\n* [Shouldly]\n* [WebApplicationFactory\u0026lt;T\u0026gt;]\n* [xunit]\n* [xunit Logging]\n\n[API]: https://github.com/martincostello/dotnet-minimal-api-integration-testing/blob/main/tests/TodoApp.Tests/ApiTests.cs\n[coverlet]: https://github.com/coverlet-coverage/coverlet\n[HttpClientFactory]: https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests\n[HttpClient Interception]: https://github.com/justeat/httpclient-interception\n[Playwright]: https://playwright.dev/dotnet/\n[ReportGenerator]: https://github.com/danielpalme/ReportGenerator\n[Shouldly]: https://docs.shouldly.org\n[User Interface]: https://github.com/martincostello/dotnet-minimal-api-integration-testing/blob/main/tests/TodoApp.Tests/UITests.cs\n[WebApplicationFactory\u0026lt;T\u0026gt;]: https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests\n[xunit]: https://xunit.net/\n[xunit Logging]: https://github.com/martincostello/xunit-logging\n\n## Debugging\n\nTo debug the application locally outside of the integration tests, you will need\nto [create a GitHub OAuth app] to obtain secrets for the `GitHub:ClientId` and\n`GitHub:ClientSecret` [options] so that the [OAuth user authentication] works and\nyou can log into the Todo App UI.\n\n\u003e 💡 When creating the GitHub OAuth app, use `https://localhost:50001/sign-in-github`\nas the _Authorization callback URL_.\n\u003e\n\u003e ⚠️ Do not commit GitHub OAuth secrets to source control. Configure them\nwith [User Secrets] instead.\n\n[create a GitHub OAuth app]: https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app\n[OAuth user authentication]: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/?view=aspnetcore-5.0\u0026tabs=visual-studio\n[options]: https://github.com/martincostello/dotnet-minimal-api-integration-testing/blob/1cd99029a9e3af57ab2fe1335b43e298efb65c09/src/TodoApp/appsettings.json#L10-L11\n[User Secrets]: https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets\n\n## Building and Testing\n\nCompiling the application yourself requires Git and the\n[.NET SDK](https://www.microsoft.com/net/download/core \"Download the .NET SDK\")\nto be installed (version `9.0.100` or later).\n\nTo build and test the application locally from a terminal/command-line, run the\nfollowing set of commands:\n\n```powershell\ngit clone https://github.com/martincostello/dotnet-minimal-api-integration-testing.git\ncd dotnet-minimal-api-integration-testing\n./build.ps1\n```\n\n## Feedback\n\nAny feedback or issues can be added to the issues for this project in\n[GitHub](https://github.com/martincostello/dotnet-minimal-api-integration-testing/issues \"Issues for this project on GitHub.com\").\n\n## Acknowledgements\n\nThanks to David Fowler ([@davidfowl](https://github.com/davidfowl)) from the\nASP.NET Core team for helping out with resolving issues with Minimal Actions\nfound from testing this sample with the ASP.NET Core 6 pre-releases!\n\n## Repository\n\nThe repository is hosted in\n[GitHub](https://github.com/martincostello/dotnet-minimal-api-integration-testing \"This project on GitHub.com\"):\n\u003chttps://github.com/martincostello/dotnet-minimal-api-integration-testing.git\u003e\n\n## License\n\nThis project is licensed under the\n[Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt \"The Apache 2.0 license\")\nlicense.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartincostello%2Fdotnet-minimal-api-integration-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartincostello%2Fdotnet-minimal-api-integration-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartincostello%2Fdotnet-minimal-api-integration-testing/lists"}