{"id":13678348,"url":"https://github.com/microsoft/coyote","last_synced_at":"2025-04-23T20:52:04.970Z","repository":{"id":37496140,"uuid":"202449779","full_name":"microsoft/coyote","owner":"microsoft","description":"Coyote is a library and tool for testing concurrent C# code and deterministically reproducing bugs.","archived":false,"fork":false,"pushed_at":"2024-12-11T17:28:41.000Z","size":20970,"stargazers_count":1536,"open_issues_count":42,"forks_count":78,"subscribers_count":37,"default_branch":"main","last_synced_at":"2025-04-20T10:14:32.819Z","etag":null,"topics":["coyote","dotnet","fuzzing","software-reliability","systematic-testing","testing","testing-tools"],"latest_commit_sha":null,"homepage":"https://microsoft.github.io/coyote/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-08-15T01:09:42.000Z","updated_at":"2025-04-19T06:22:02.000Z","dependencies_parsed_at":"2023-02-18T12:01:14.888Z","dependency_job_id":"ca2274da-1964-4405-942d-1089a47c29b2","html_url":"https://github.com/microsoft/coyote","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fcoyote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fcoyote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fcoyote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fcoyote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/coyote/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250514756,"owners_count":21443208,"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":["coyote","dotnet","fuzzing","software-reliability","systematic-testing","testing","testing-tools"],"created_at":"2024-08-02T13:00:52.604Z","updated_at":"2025-04-23T20:52:04.947Z","avatar_url":"https://github.com/microsoft.png","language":"C#","readme":"# `Coyote`\n\n[![NuGet](https://img.shields.io/nuget/v/Microsoft.Coyote.svg)](https://www.nuget.org/packages/Microsoft.Coyote/)\n[![Nuget](https://img.shields.io/nuget/dt/Microsoft.Coyote?color=informational)](https://www.nuget.org/packages/Microsoft.Coyote/)\n![Build and Test CI](https://github.com/microsoft/coyote/actions/workflows/test-coyote.yml/badge.svg?branch=main)\n![CodeQL](https://github.com/microsoft/coyote/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)\n\nCoyote is a cross-platform library and tool for testing concurrent C# code and deterministically reproducing bugs.\n\nUsing Coyote, you can easily test the *concurrency* and other *nondeterminism* in your C# code, by\nwriting what we call a *concurrency unit test*. These look like your regular unit tests, but can\nreliably test concurrent workloads (such as actors, tasks, or concurrent requests to ASP.NET\ncontrollers). In regular unit tests, you would typically avoid concurrency due to flakiness, but\nwith Coyote you are encouraged to embrace concurrency in your tests to find bugs.\n\nCoyote is used by many teams in [Azure](https://azure.microsoft.com/) to test their distributed\nsystems and services, and has found hundreds of concurrency-related bugs before deploying code\nin production and affecting users. In the words of an Azure service architect:\n\u003e Coyote found several issues early in the dev process, this sort of issues that would usually bleed\n\u003e through into production and become very expensive to fix later.\n\nCoyote is made with :heart: by Microsoft Research.\n\n## How it works\n\nConsider the following simple test:\n```csharp\n[Fact]\npublic async Task TestTask()\n{\n  int value = 0;\n  Task task = Task.Run(() =\u003e\n  {\n    value = 1;\n  });\n\n  Assert.Equal(0, value);\n  await task;\n}\n```\n\nThis test will pass most of the time because the assertion will typically execute before the task\nstarts, but there is one schedule where the task starts fast enough to set `value` to `1` causing\nthe assertion to fail. Of course, this is a very naive example and the bug is obvious, but you could\nimagine much more complicated race conditions that are hidden in complex execution paths.\n\nThe way Coyote works, is that you first convert the above test to a concurrency unit test using the\nCoyote `TestingEngine` API:\n```csharp\nusing Microsoft.Coyote.SystematicTesting;\n\n[Fact]\npublic async Task CoyoteTestTask()\n{\n  var configuration = Configuration.Create().WithTestingIterations(10);\n  var engine = TestingEngine.Create(configuration, TestTask);\n  engine.Run();\n}\n```\n\nNext, you run the `coyote rewrite` command from the CLI (typically as a post-build task) to\nautomatically rewrite the IL of your test and production binaries. This allows Coyote to inject\nhooks that take control of the concurrent execution during testing.\n\nYou can then run the concurrent unit test from your favorite unit testing framework (such as\n[xUnit](https://xunit.net/)). Coyote will take over and repeatedly execute the test from\nbeginning to the end for N iterations (in the above example N was configured to `10`). Under the\nhood, Coyote uses intelligent search strategies to explore all kinds of execution paths that might\nhide a bug in each iteration.\n\nThe awesome thing is that once a bug is found, Coyote gives you a trace through the `engine.TestReport`\nAPI that you can use to reliably *reproduce* the bug as many times as you want, making debugging and\nfixing the issue significantly easier.\n\n## Get started\n\nGetting started with Coyote is easy! First, follow this\n[guide](https://microsoft.github.io/coyote/#get-started/install/) to install the `coyote`\ncommand-line tool from [NuGet](https://www.nuget.org/packages/Microsoft.Coyote/). You are now ready\nto check out the Coyote [website](https://microsoft.github.io/coyote/) for tutorials, documentation,\nhow-tos, samples and more information about the project. Enjoy!\n\nUpgrading your `coyote` dependencies? Check the changelog [here](History.md).\n\n## Support\n\nNote that Coyote is an open-source project that is provided \"as-is\". We are not able to provide\nany formal support. For Microsoft employees we have the [Friends of Coyote Teams\nchannel](https://teams.microsoft.com/l/channel/19%3a1fe966b4fdc544bca648d89bf25c3c56%40thread.tacv2/General?groupId=7a6d8afc-c23d-4e5d-b9cb-9124118c0220\u0026tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47), which is an internal community that can help answer questions and\nlearn from each other.\n\n## Contributing\n\nThis project welcomes contributions and suggestions. Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.\n\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide a\nCLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repositories using our CLA.\n\n## Code of Conduct\n\nThis project has adopted the [Microsoft Open Source Code of\nConduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of\nConduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact\n[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n","funding_links":[],"categories":["C#","testing","🗒️ Cheatsheets"],"sub_categories":["📦 Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fcoyote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2Fcoyote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fcoyote/lists"}