Git Product home page Git Product logo

gittools.testing's Introduction

Icon

GitTools.Testing

Makes it easy to automate git for testing libraries which interact with git. This library was pulled out of GitVersion so it could be used in other projects.

License Version Pre-release version Build status Build Status

Fixtures

The main purpose for this library, providing test fixtures which wrap a temporary git repository making it super easy to create test scenarios. For example

using (var fixture = new GitTools.Testing.EmptyRepositoryFixture())
{
    fixture.MakeACommit();
    fixture.MakeACommit();
    fixture.MakeATaggedCommit("1.0.0");
    fixture.BranchTo("develop");
    fixture.MakeACommit();
    fixture.Checkout("master");
    fixture.MergeNoFF("develop");
}

Other fixtures:

  • LocalRepositoryFixture
  • RemoteRepositoryFixture - Creates a remote repository (locally) then clones it giving you access to both to simulate remote repositories.
  • BaseGitFlowRepository - Repository setup for gitflow with develop already checked out

Sequence diagrams

For each of the methods on the fixture, the same extension methods exist on IRepository, the difference is that any methods called on the fixture will automatically record that action in a sequence diagram.

When you dispose the fixture it will automatically log to LibLog a PlantUML Sequence Diagram, which you can paste into a tool like CodeUML, SeedUML or PlantText to render.

The above test produces

@startuml
master -> master: commit
master -> master: commit
master -> master: commit
master -> master: tag 1.0.0
create participant develop
master -> develop: branch from master
develop -> develop: commit
develop -> master: merge
@enduml

Paste that into one of the tools above to see the result!

Other API's

Generate - Makes it easy to generate fake signatures VirtualTime - When testing git you can do lots of operations during the same second, this messes git up. VirtualTime increments the time by a minute each time you access .Now

And a number of other libgit2sharp extension methods which make the api simpler for your tests.

Icon

Network by Lorena Salagre from the Noun Project

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.