Giter Club home page Giter Club logo

xunit-scenario's Introduction

Xunit scenario code generator extension

This is a Xunit framework extension. It provides implementations that make it possible to run scenario using Xunit tests.

  • It runs tests in order.
  • It shares context between tests.
  • It fails not run tests if one test fails in the test class.
  • Use csharp roslyn code generator .net

Why Use This Library?

  • It automatically generates readable tests based on scenario text.
  • Simplifies the creation of UI/API Automation Acceptance Tests.
  • It is an additional extension for Xunit, so it is possible to create scenario tests and regular Xunit tests.

Getting started

  • Create a new Xunit test project
  • Install the Xunit.Scenario nuget package
  • Create the Setup class.
  • Add assembly attribute with XunitScenarioTestFramework setup to it
using Xunit;

[assembly: TestFramework("Xunit.Scenario.Extension.XunitScenarioTestFramework", "Xunit.Scenario.Extension")]
  • Create a new test class and add a scenario attribute with description, test cases will be generated as partial methods
  • Implement partial methods.
using Xunit.Scenario.Extension;
using System.Threading.Tasks;

namespace ScenarioAutoGeneration
{
    [Scenario(@"
* send first request
* send second request
* send third request
* send fourth request
")]
    public partial class RequestFlowAutoGeneratedScenario : ScenarioSteps<RequestFlowAutoGeneratedScenario.State>
    {
        public RequestFlowAutoGeneratedScenario(State state) : base(state)
        {

        }

        public partial Task S1_send_first_request()
        {
            return Task.CompletedTask;
        }

        public partial Task S2_send_second_request() { return Task.CompletedTask; }

        public partial Task S3_send_third_request() { return Task.CompletedTask; }

        public partial Task S4_send_fourth_request() { return Task.CompletedTask; }

        public class State { }
    }
}

xunit-scenario's People

Contributors

khdevnet avatar

Watchers

 avatar

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.