Giter Club home page Giter Club logo

fscenario's Introduction

FScenario

FScenario is a .NET project to help developers writing more safe integration tests but also to make the developing more fun. The project contains several ways to help the developer to clean up in after the integration test has run, polling mechanisms to make the assertion phase more reliable, building blocks to create your own disposable fixture, ...

logo

Information

Following resources contains some extra information about this library:

NuGet

NuGet Badge

Build Status

Mono .NET
Mono CI Build Status .NET Build status

Examples

The project exposes several reusable building blocks to make your integration/scenario test more reliable in seconds.

Several test fixtures to test file system related functionality:

open System.IO
open Expecto
open FScenario

let startYourApplication = ignore

[<Tests>]
let file_tests =
    testCaseAsync "should poll for file presence" <| async {
      Dir.clean "."
      do startYourApplication
      let! f = Poll.untilFileExistsEvery1sFor5s "some-file.txt"
      FileInfo.delete f
};

Several test fixtures to test HTTP functionality or HTTP callbacks from your applications without any big setup.

open Expecto
open FScenario

[<Tests>]
let http_tests =
    testCaseAsync "starts http server and GET -> OK" <| async {
        let endpoint = "http://localhost:8080"
        use _ = Http.server endpoint
        do! Poll.untilHttpOkEvery1sFor5s endpoint
        use! res = Http.get endpoint
        Expect.equal OK res.StatusCode "http status code should be OK"
    };

And a lot more building blocks that are written in such a generic way, you can use it anywhere.

async {
    do! Poll.target (fun () -> async { return Dir.files "my-dir" })
        |> Poll.until (Seq.length >> (=) 3)
        |> Poll.every _1s
        |> Poll.timeout _10s
        |> Poll.error "Directory 'my-dir' should have 3 files" }

With full C# support!

Poll.Target(() => Task.FromResult(Dir.Files("my-dir")))
    .Until(fs => fs.Length == 3)
    .Every(TimeSpans._1s)
    .For(TimeSpans._10s)
    .Error("Directory 'my-dir' should have 3 files);

fscenario's People

Contributors

stijnmoreels avatar

Watchers

 avatar  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.