All Projects → bazelbuild → bazel-integration-testing

bazelbuild / bazel-integration-testing

Licence: Apache-2.0 license
Framework for integration tests that call Bazel

Programming Languages

java
68154 projects - #9 most used programming language
Starlark
911 projects
python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to bazel-integration-testing

rules sass
Sass rules for Bazel
Stars: ✭ 47 (+42.42%)
Mutual labels:  bazel
android-build-eval
This project includes Uber-agnostic auto-generated project(s) with a comparable complexity to existing Uber Production mobile apps. These are buildable on Buck, Bazel and Gradle- therefore enable build time benchmarking.
Stars: ✭ 82 (+148.48%)
Mutual labels:  bazel
EyeJS
A JavaScript testing framework for the real world
Stars: ✭ 68 (+106.06%)
Mutual labels:  test-framework
exactly
Exactly - tests a command line program by executing it in a temporary sandbox directory and inspecting its result.
Stars: ✭ 30 (-9.09%)
Mutual labels:  test-framework
kmtest
Kernel-mode C++ unit testing framework in BDD-style
Stars: ✭ 42 (+27.27%)
Mutual labels:  test-framework
bazel-nx-example
⚡ Example monorepo for Nest + Angular built with Bazel
Stars: ✭ 41 (+24.24%)
Mutual labels:  bazel
bazel-compile-commands-extractor
Goal: Enable awesome tooling for Bazel users of the C language family.
Stars: ✭ 295 (+793.94%)
Mutual labels:  bazel
PixelTest
Fast, modern, simple iOS snapshot testing written purely in Swift.
Stars: ✭ 56 (+69.7%)
Mutual labels:  test-framework
rules appengine
AppEngine rules for Bazel
Stars: ✭ 28 (-15.15%)
Mutual labels:  bazel
wollemi
No description or website provided.
Stars: ✭ 25 (-24.24%)
Mutual labels:  bazel
rules gitops
This repository contains rules for continuous, GitOps driven Kubernetes deployments.
Stars: ✭ 112 (+239.39%)
Mutual labels:  bazel
eat
Json based scenario testing tool(which can have test for functional and non-functional)
Stars: ✭ 41 (+24.24%)
Mutual labels:  test-framework
bazel-website
Website for Bazel, a fast, scalable, multi-language and extensible build system
Stars: ✭ 16 (-51.52%)
Mutual labels:  bazel
evolutio
ab testing framework with automated code removing
Stars: ✭ 15 (-54.55%)
Mutual labels:  test-framework
Grazel
A tool to migrate Android projects from Gradle to Bazel incrementally and automatically
Stars: ✭ 222 (+572.73%)
Mutual labels:  bazel
pry-test
A small test framework that supports debugging test failures & errors when they happen
Stars: ✭ 24 (-27.27%)
Mutual labels:  test-framework
mutest
A BDD testing framework for C, inspired by Mocha
Stars: ✭ 22 (-33.33%)
Mutual labels:  test-framework
rules java
Java rules for Bazel
Stars: ✭ 44 (+33.33%)
Mutual labels:  bazel
rules ruby
Ruby Rules for Bazel. It is, perhaps, production-ready. This project builds atop the work of Yugui, whose original rules can be found at https://github.com/yugui/rules_ruby. Please be aware there is an active fork of this project maintained by Coinbase at https://github.com/coinbase/rules_ruby.
Stars: ✭ 85 (+157.58%)
Mutual labels:  bazel
ask-sdk-test
Alexa Skill Test Framework for Typescript and ASK2
Stars: ✭ 22 (-33.33%)
Mutual labels:  test-framework

ARCHIVED: Bazel-integration-testing

NOTE: This repository has moved to https://github.com/bazel-contrib/rules_bazel_integration_test.

Because your build infra also needs build (and tests)

Bazel CI
Build status

Problem statement

Bazel-integration-testing aims to give confidence when developing code that is strongly dependent on Bazel.
It does so by allowing you to have isolated reproducible tests which run Bazel inside of them.
Happy path testing are often possible inside of bazel by adding examples of your usage but failing cases are much harder.
Few examples for such code can be Starlark plugins (both open and closed source), tools that augment Bazel/Bazel query and actually also Bazel itself.
This project was inspired by Bazel's own integration tests which were in bash at the time and were coupled inside.
Internally at Wix we use this to develop and test several internal rules, macros and also tools that need to run bazel query and bazel while bazel-watcher runs Bazel in its E2Es to verify its assumptions on bazel run amongst other things. All of these set up scratch workspaces isolated to the specific tests.

Target audience

  • Bazel Starlark rule developers (both open source and closed source)
  • Bazel ecosystem tool developers (both open source and closed source)
  • Bazel developers

Alternatives

For integration testing as of Jan'19 there is no alternative which is usable outside of Bazel.
For some use-cases and tests one can use bazel-skylib's unittest framework.
This is faster and might be easier to setup in the test (smaller scope) but has the built-in limitations of unit testing where you make assumptions about the environment.
To be clear it's usually a good idea to have a mix of unit tests and integration tests for your feedback loop and confidence.

Architecture

The project is built from repository rules, build rules and test drivers.
The build rules are per stack (currently JVM, go, python) and are essentially a wrapper over the $stack_test rule. For every bazel version configured such a wrapper is generated along with a test_suite aggregate.
The JVM build rules are a bit more advanced in that they integrate with bazel_external_dependency_archive repository rule to support external dependencies in the test workspace.
Lastly each stack has a specific test driver which eases creation of scratch WORKSAPCE files, BUILD files, source files, running of Bazel and more.

Getting started

In order to use bazel_java_integration_test, bazel_go_integration_test, or bazel_py_integration_test, you must add the following to your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "build_bazel_integration_testing",
    url = "https://github.com/bazelbuild/bazel-integration-testing/archive/3a6136e8f6287b04043217d94d97ba17edcb7feb.zip",
    type = "zip",
    strip_prefix= "bazel-integration-testing-3a6136e8f6287b04043217d94d97ba17edcb7feb",
    sha256 = "bfc43a94d42e08c89a26a4711ea396a0a594bd5d55394d76aae861b299628dca",
)


load("@build_bazel_integration_testing//tools:repositories.bzl", "bazel_binaries")
#depend on the Bazel binaries, also accepts an array of versions
bazel_binaries()

For JVM tests one would like to call the below instead of the above call to bazel_binaries since it does that plus more dependencies needed for java_test:

load("@build_bazel_integration_testing//tools:bazel_java_integration_test.bzl", "bazel_java_integration_test_deps")
bazel_java_integration_test_deps()

Usage

Jvm

Go

rules_go already supports, natively, an integration testing framework for validating your rules. If you need to write integration tests, please refer to the godoc and associated go_bazel_test rule.. For example usage, rules_go itself is tested using this rule and many packages inside of the tests package can be used as examples.

Python

TODO

More info

Which bazel versions are supported

TODO

How to have external repositories in your scratch workspace

TODO

Remote execution support

We need to add more info (and also port a small configuration utility) but I'll just add that Wix uses this library on RBE successfully for a few good months.

State of the project

Active development?

The project is under active development.
Because the project solves many use cases right now and unfortunately because of capacity issues we're more in a reactive mode but we strongly encourage feedback in the form of issues and PRs.
Note that it is easier for us to review and assist when PRs are Small and especially when they are prefaced with an issue describing the need and possibly iterating there on the design.
We hope to have more capacity in the next few months to also ramp up the missing pieces below.

What is missing

  • More documentation (for go and python as well as much better documentation for the workspace drivers).
  • Adding external dependencies is possible in some cases (http_archive) but is not easy. We'd like to see if we can expand this support and make it easier.
  • More adoption by rule-sets (rules_docker, rules_scala, etc)
  • Up-to-date linting

Adopters

Here's a (non-exhaustive) list of companies and projects that use bazel-integration-testing. Don't see yours? You can add it in a PR!

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