{"id":18497779,"url":"https://github.com/timewarpengineering/timewarp-fixie","last_synced_at":"2025-04-09T00:30:42.022Z","repository":{"id":62107254,"uuid":"520070551","full_name":"TimeWarpEngineering/timewarp-fixie","owner":"TimeWarpEngineering","description":"The TimeWarp Fixie testing convention.","archived":false,"fork":false,"pushed_at":"2025-02-17T16:35:29.000Z","size":101,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T00:04:00.520Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TimeWarpEngineering.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-01T10:49:54.000Z","updated_at":"2025-02-17T16:35:34.000Z","dependencies_parsed_at":"2024-08-11T18:07:44.012Z","dependency_job_id":"ab8639aa-9dea-4284-8e8b-300aa3b32eea","html_url":"https://github.com/TimeWarpEngineering/timewarp-fixie","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.0625,"last_synced_commit":"37340108c9069d7ee85378419217f2ebf4ae92ad"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimeWarpEngineering%2Ftimewarp-fixie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimeWarpEngineering%2Ftimewarp-fixie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimeWarpEngineering%2Ftimewarp-fixie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimeWarpEngineering%2Ftimewarp-fixie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimeWarpEngineering","download_url":"https://codeload.github.com/TimeWarpEngineering/timewarp-fixie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247949678,"owners_count":21023368,"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":["hacktoberfest"],"created_at":"2024-11-06T13:35:46.542Z","updated_at":"2025-04-09T00:30:42.016Z","avatar_url":"https://github.com/TimeWarpEngineering.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Dotnet](https://img.shields.io/badge/dotnet-6.0-blue)](https://dotnet.microsoft.com)\n[![Stars](https://img.shields.io/github/stars/TimeWarpEngineering/timewarp-fixie?logo=github)](https://github.com/TimeWarpEngineering/timewarp-fixie)\n[![Discord](https://img.shields.io/discord/715274085940199487?logo=discord)](https://discord.gg/7F4bS2T)\n[![nuget](https://img.shields.io/nuget/v/TimeWarp.Fixie?logo=nuget)](https://www.nuget.org/packages/TimeWarp.Fixie/)\n[![nuget](https://img.shields.io/nuget/dt/TimeWarp.Fixie?logo=nuget)](https://www.nuget.org/packages/TimeWarp.Fixie/)\n[![Issues Open](https://img.shields.io/github/issues/TimeWarpEngineering/timewarp-fixie?logo=github)](https://github.com/TimeWarpEngineering/timewarp-fixie/issues)\n[![Forks](https://img.shields.io/github/forks/TimeWarpEngineering/timewarp-fixie)](https://github.com/TimeWarpEngineering/timewarp-fixie)\n[![License](https://img.shields.io/github/license/TimeWarpEngineering/timewarp-fixie?logo=github)](https://unlicense.org)\n[![Twitter](https://img.shields.io/twitter/url?style=social\u0026url=https%3A%2F%2Fgithub.com%2FTimeWarpEngineering%2Ftimewarp-fixie)](https://twitter.com/intent/tweet?url=https://github.com/TimeWarpEngineering/timewarp-fixie)\n\n[![Twitter](https://img.shields.io/twitter/follow/StevenTCramer.svg)](https://twitter.com/intent/follow?screen_name=StevenTCramer)\n[![Twitter](https://img.shields.io/twitter/follow/TheFreezeTeam1.svg)](https://twitter.com/intent/follow?screen_name=TheFreezeTeam1)\n\n# timewarp-fixie\n\n![TimeWarp Logo](assets/Logo.png)\n\n[Fixie](https://github.com/fixie/fixie/wiki) is a dotnet test framework similar to NUnit and xUnit, but with an emphasis on low-ceremony defaults and flexible customizations.\n\nTimeWarp-fixie is a project that uses conventions to simplify using Fixie even further.\n\n## Feature overview\n\n* Dependency Injection support for test cases.\n* No need to decorate test methods with [Test] attributes. Public methods are test cases by default.\n* Skip - can mark tests to be skipped.\n* Tags - Add tags to your tests and filter runs based on the tag.\n* Inputs - Allow for parameterized tests. (similar to how \"Theory\" works in xUnit)\n* Lifecycle Methods -  if the `Setup` or `Cleanup` methods are found on the test class they will be executed appropriately.\n* NotTest - Can mark methods with `NotTest` attribute if they are not tests.\n* Filter tests by name\n* Filter tests by Tags\n\n## Give a Star! :star:\n\nIf you like or are using this project please give it a star. Thank you!\n\n## Installation\n\nYou can see the latest NuGet packages from the official [TimeWarp NuGet page](https://www.nuget.org/profiles/TimeWarp.Enterprises).\n\n* [timewarp-fixie](https://www.nuget.org/packages/TimeWarp.Fixie/) [![nuget](https://img.shields.io/nuget/v/TimeWarp.Fixie?logo=nuget)](https://www.nuget.org/packages/TimeWarp.Fixie/)\n\n## Usage\n\n### Creating a New Test Project\n\nCreate a new test project:\n\n```console\ndotnet new classlib -n MyProject.Tests\n```\n\nAdd NuGet packages to the project:\n\n```console\ndotnet add package TimeWarp.Fixie\ndotnet add package Fixie.TestAdapter\n```\n\nCreate a dotnet tool manifest:\n\n```console\ndotnet new tool-manifest\n```\n\nAdd Fixie.Console to the manifest:\n\n```console\ndotnet tool install Fixie.Console\n```\n\n### Configuring Testing Convention\n\nInside your Fixie project, create a class that inherits from `Fixie.Conventions.TestingConvention`:\n\n```csharp\nclass TestingConvention : TimeWarp.Fixie.TestingConvention { }\n```\n\nThis will use the `TimeWarp.Fixie` convention.\n\n### Creating a Sample Test\n\nFirst, add Shouldly (you could use basic Asserts or any other assertion library):\n\n```csharp\ndotnet add package Shouldly\n```\n\nCreate a sample test class named `ConventionTests.cs`:\n\n```csharp\nnamespace ConventionTest_;\n\nusing Shouldly;\nusing TimeWarp.Fixie;\n\n[TestTag(TestTags.Fast)]\npublic class SimpleNoApplicationTest_Should_\n{\n  public static void AlwaysPass() =\u003e true.ShouldBeTrue();\n\n  [Skip(\"Demonstrates skip attribute\")]\n  public static void SkipExample() =\u003e true.ShouldBeFalse();\n\n  [TestTag(TestTags.Fast)]\n  public static void TagExample() =\u003e true.ShouldBeTrue();\n\n  [Input(5, 3, 2)]\n  [Input(8, 5, 3)]\n  public static void Subtract(int x, int y, int expectedDifference)\n  {\n    int result = x - y;\n    result.ShouldBe(expectedDifference);\n  }\n}\n```\n\n### Executing the Tests\n\n```console\ndotnet fixie\n```\n\n## Features\n\n### Dependency Injection\n\nTests are instantiated from the dependency injection container set up for tests, so you can use the same pattern for testing as for production apps.\n\n### Configuring Services for the Execution Phase\n\nTo customize the services used in the execution phase, inherit from `TestingConvention` and override the service configuration:\n\n```csharp\nnamespace TimeWarp.Architecture.Testing;\n\npublic class TimeWarpTestingConvention : TestingConvention\n{\n    public TimeWarpTestingConvention() : base(ConfigureAdditionalServicesCallback) { }\n\n    private static void ConfigureAdditionalServicesCallback(ServiceCollection serviceCollection)\n    {\n        Console.WriteLine(\"ConfigureAdditionalServices\");\n        serviceCollection\n            .AddSingleton\u003cWebTestServerApplication\u003e()\n            .AddSingleton\u003cApiTestServerApplication\u003e()\n            .AddSingleton\u003cSpaTestApplication\u003cYarpTestServerApplication, TimeWarp.Architecture.Yarp.Server.Program\u003e\u003e()\n            .AddSingleton\u003cYarpTestServerApplication\u003e();\n    }\n}\n```\n\n### No Need to Decorate Test Methods with [Test] Attributes\n\nPublic methods are test cases by convention:\n\n```csharp\n// Xunit style\n[Test] // \u003c==== Not needed with TimeWarp Fixie Convention\npublic void SomeTest()\n{\n    Assert.Fail();\n}\n```\n\n```csharp\n// TimeWarp Fixie Convention: all public methods are tests \npublic void SomeTest()\n{\n    Assert.Fail();\n}\n```\n\n### Skip - Mark Tests to Be Skipped\n\n```csharp\n[Skip(\"Reason for skipping\")]\npublic static void SkipExample() =\u003e true.Should().BeFalse();\n```\n\n### Tags\n\nYou can add tags to any of your tests. We include some in the `TestTags` static class, but they are just strings, so you can add whatever you like:\n\n```csharp\n[TestTag(TestTags.Fast)]\n[TestTag(\"Bug123\")]\npublic static void TagExample() =\u003e true.Should().BeTrue();\n```\n\n### Parameterized Tests\n\nSimilar to how xUnit uses `[Theory]`, you can run a test for each set of parameters:\n\n```csharp\n[Input(5, 3, 2)]\n[Input(8, 5, 3)]\npublic static void Subtract(int aX, int aY, int aExpectedDifference)\n{\n    int result = aX - aY;\n    result.Should().Be(aExpectedDifference);\n}\n```\n\n### Lifecycle Methods\n\nIf the `Setup` or `Cleanup` methods are found on the test class, they will be executed appropriately for each test:\n\n```csharp\npublic class LifecycleExamples\n{\n    public static void AlwaysPass() =\u003e true.Should().BeTrue();\n\n    [Input(5, 3, 2)]\n    [Input(8, 5, 3)]\n    public static void Subtract(int aX, int aY, int aExpectedDifference)\n    {\n        // Will run lifecycles around each Input\n        int result = aX - aY;\n        result.Should().Be(aExpectedDifference);\n    }\n\n    public static void Setup() =\u003e Console.WriteLine(\"Sample Setup\");\n    public static void Cleanup() =\u003e Console.WriteLine(\"Sample Cleanup\");\n}\n```\n\n### NotTest\n\nIf you have a class that needs to be public but does not contain tests, you can mark it as such with the `[NotTest]` attribute. For example:\n\n```csharp\n[NotTest]\n[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]\npublic class NotTest : Attribute { }\n```\n\n### Filtering Tests by Name\n\nFrom Fixie's [docs](https://github.com/fixie/fixie/wiki/Command-Line-Arguments#filtering-with---tests):\n\nThe optional argument `--tests` (abbreviated `-t`) lets you specify which tests to run.\n\nA full test name match\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimewarpengineering%2Ftimewarp-fixie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimewarpengineering%2Ftimewarp-fixie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimewarpengineering%2Ftimewarp-fixie/lists"}