Giter Club home page Giter Club logo

xunit-orderer's Introduction

xUnit Orderer

Please support this project by simply putting a Github star. Share this library with friends on Twitter and everywhere else you can.

xUnit Orderer is an implementation of ITestCaseOrderer enforcing xUnit to run the facts in strict order.

There're some scenarios that you might need to chain the facts to be evaluated in a strict order. This project implements the ITestCaseOrderer interface of xUnit and provides the TestPriority decorator to perform the test case ordering.

Check out the example below for details.

Prerequisites

Packages in this project depend on

Older versions contain outdated dependencies, might produce errors.

Getting started

Installation

You can install xUnit Orderer by running following commands in the Package Manager Console

Install-Package XunitOrderer

Usage

AssemblyInfo.cs

using System.Reflection;
using System.Runtime.InteropServices;
using Xunit;

...

[assembly:CollectionBehavior(DisableTestParallelization = true)]
[assembly:TestCollectionOrderer("XunitOrderer.TestCollectionOrderer", "XunitOrderer.Testing")]

TestClass1.cs

[TestPriority(10)]
public class TestClass1 : TestClassBase
{
    [Fact]
    [TestPriority(101)]
    public void First()
    {
        Assert.Equal(1, 1);
    }
 
    [Fact]
    [TestPriority(102)]
    public void Second()
    {
        Assert.Equal(2, 2);
    }
}

TestClass2.cs

[TestPriority(20)]
public class TestClass2 : TestClassBase
{
    [Fact]
    [TestPriority(103)]
    public void Third()
    {
        Assert.Equal(3, 3);
    }
 
    [Fact]
    [TestPriority(104)]
    public void Fourth()
    {
        Assert.Equal(4, 4);
    }
}

The execution order of the facts are:

  • TestClass1 -> First
  • TestClass1 -> Second
  • TestClass2 -> Third
  • TestClass2 -> Fourth

Built with .NET Framework v4.6.2, solution currently supports xUnit v2.2.0.

Contributing

If you want to file a bug, contribute some code, or improve documentation, please read up on the following contribution guidelines:

License

The MIT License (MIT)

Copyright (c) 2017 Burak Tasci

xunit-orderer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

p10tyr

xunit-orderer's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.