All Projects → spotify → Git Test

spotify / Git Test

Licence: apache-2.0
test your commits

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Git Test

Gabbi
Declarative HTTP Testing for Python and anything else
Stars: ✭ 132 (-19.51%)
Mutual labels:  test-automation
Genieparser
sub-component of Genie that parse the device output into structured datastructure
Stars: ✭ 146 (-10.98%)
Mutual labels:  test-automation
Gitoxide
An idiomatic, lean, fast & safe pure Rust implementation of Git
Stars: ✭ 2,696 (+1543.9%)
Mutual labels:  version-control
Penetration
渗透 超全面的渗透资料💯 包含:0day,xss,sql注入,提权……
Stars: ✭ 1,706 (+940.24%)
Mutual labels:  test-automation
Strest
⚡️ CI-ready tests for REST APIs configured in YAML
Stars: ✭ 1,746 (+964.63%)
Mutual labels:  test-automation
Stryker Js
Mutation testing for JavaScript and friends
Stars: ✭ 2,043 (+1145.73%)
Mutual labels:  test-automation
Zebrunner
Zebrunner is a Test Automation Management Tool
Stars: ✭ 131 (-20.12%)
Mutual labels:  test-automation
Grammarinator
ANTLR v4 grammar-based test generator
Stars: ✭ 162 (-1.22%)
Mutual labels:  test-automation
Ztest
自动化测试报告
Stars: ✭ 143 (-12.8%)
Mutual labels:  test-automation
Ihct
'I Hate C Testing': A minimal testing framework for C.
Stars: ✭ 154 (-6.1%)
Mutual labels:  test-automation
Gitman
Language-agnostic dependency manager using Git.
Stars: ✭ 139 (-15.24%)
Mutual labels:  version-control
Zunit
A powerful testing framework for ZSH projects
Stars: ✭ 140 (-14.63%)
Mutual labels:  test-automation
Swagger meqa
Auto generate and run tests using swagger/OpenAPI spec, no coding needed
Stars: ✭ 151 (-7.93%)
Mutual labels:  test-automation
Kotlin Faker
Generate realistically looking fake data such as names, addresses, banking details, and many more, that can be used for testing and data anonymization purposes.
Stars: ✭ 136 (-17.07%)
Mutual labels:  test-automation
Mockito
Most popular Mocking framework for unit tests written in Java
Stars: ✭ 12,453 (+7493.29%)
Mutual labels:  test-automation
Unium
Automation for Unity games
Stars: ✭ 132 (-19.51%)
Mutual labels:  test-automation
Stb Tester
Automated Testing for Set-Top Boxes and Smart TVs
Stars: ✭ 148 (-9.76%)
Mutual labels:  test-automation
Fuzzinator
Fuzzinator Random Testing Framework
Stars: ✭ 164 (+0%)
Mutual labels:  test-automation
Argus Eyes
A lightweight commandline tool for visual regression testing of UI components.
Stars: ✭ 158 (-3.66%)
Mutual labels:  test-automation
Ansible Role Git
Ansible Role - Git
Stars: ✭ 153 (-6.71%)
Mutual labels:  version-control

git-test -- test your commits

Run tests on each distinct tree in a revision list, skipping versions whose contents have already been tested.

The 99% example is simply:

git test -v

By default it uses heuristics to try to determine what "local commits" to test, but you can supply another ref spec. git-test looks at each commit and checks the hash of the directory tree against the cache. You can also configure a ref (usually a branch) to test against, per repo or or per branch.

From the point of view of git-test, a test can be any shell command and a test is considered successful if that shell command returns with a 0 exit status. This means git-test can be used both for specialised tests of a single feature or failure mode or for running a comprehensive set of automated tests. The cache is keyed on both directory tree and test, so it won't confuse the unit tests with the integration tests, or a specific regression test.

Motivation

An important design goal for git-test has been to make it convenient to use.

Ideally, you should have a work flow where you run your unit tests whenever you save and run unit tests on all your local commits whenever you've done something with version control.

For ease, git-test offers a few advantages over a simple for loop over a git rev-list:

  • By default it spends some effort on working out which commits to test.
  • Cached results, which are keyed to tree contents, rather than commit. This means that commits can be amended or reordered, but only content trees that have never been tested before will be tested.
  • Separate pre- and post-action hooks, the results of which don't actually factor into the test result. (Useful if cleaning fails if there is nothing to clean, for instance.)
  • Configuration of housekeeping and verification steps using
    • git config,
    • environment variables or
    • command line arguments
  • Selective redo, for where you trust failures but not successes, vice versa, or trust nothing.
  • Save output (both STDOUT and STDERR) from cleaning and verifying to an easily referenced symlink farm.

Configure

Mostly just this:

git config test.verify "test command that returns nonzero on fail"

to default to testing against origin/master:

git config test.branch origin/master

to do the same, but for a single branch:

git config branch.mybranch.test parentbranch

Self-Test

To try the test script with different shells:

for sh in /bin/dash /bin/bash /bin/ksh /bin/mksh /bin/pdksh; do
    echo $sh
    sh test.sh -s $sh
done

Note that since version 1.0.2, the shebang is set to /bin/bash. Other shells are now supported on a "patches welcome" basis. (This is largely because I couldn't find a shell I could run in my GNU/Linux environment that behaves like the OS X (FreeBSD?) sh shell, which has very different behaviour from all the others.)

To regression test properly:

rev=$(git rev-parse --short HEAD)
cp test.sh regressions_${rev}.sh
GIT_TEST_VERIFY="sh regressions_${rev}.sh" git test -v

(The reason for copying the script is to test each commit against the new tests, and the reason for naming it based on the current commit is to key the cache correctly.)

Installation

You can just have the git-test script in your PATH, but there are other options:

Homebrew (on OS X)

If you have Homebrew installed, you can install git-test with:

$ brew install git-test

From source

Aside from the packaging, you can also install from source. It's a single POSIX shell script that uses core git, so all that's required for plain git test to work (besides git, of course) is that git-test needs to be somewhere in your PATH (or GIT_EXEC_PATH).

You can install from source by doing the following:

$ install git-test   /usr/local/bin
$ install git-test.1 /usr/local/share/man1

Or just add this directory to your PATH environment variable.

Debian GNU/Linux

The usual

$ fakeroot debian/rules binary

Should give you a Debian package.

Arch Linux

With Arch Linux, you can use the provided PKGBUILD file. Simply download the file and run makepkg in the same directory as the file. It will always build the latest git version of this package, even if you have an old checkout.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].