{"id":13450638,"url":"https://github.com/bazelbuild/bazel-integration-testing","last_synced_at":"2025-03-23T16:31:50.193Z","repository":{"id":56680301,"uuid":"105262089","full_name":"bazelbuild/bazel-integration-testing","owner":"bazelbuild","description":"Framework for integration tests that call Bazel","archived":true,"fork":false,"pushed_at":"2022-05-17T19:24:13.000Z","size":253,"stargazers_count":32,"open_issues_count":22,"forks_count":29,"subscribers_count":35,"default_branch":"master","last_synced_at":"2024-10-28T17:39:21.492Z","etag":null,"topics":["bazel","test-framework"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bazelbuild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2017-09-29T10:50:01.000Z","updated_at":"2023-01-27T21:48:31.000Z","dependencies_parsed_at":"2022-08-15T23:10:36.459Z","dependency_job_id":null,"html_url":"https://github.com/bazelbuild/bazel-integration-testing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fbazel-integration-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fbazel-integration-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fbazel-integration-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fbazel-integration-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bazelbuild","download_url":"https://codeload.github.com/bazelbuild/bazel-integration-testing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245130865,"owners_count":20565734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","test-framework"],"created_at":"2024-07-31T07:00:36.885Z","updated_at":"2025-03-23T16:31:49.912Z","avatar_url":"https://github.com/bazelbuild.png","language":"Java","readme":"ARCHIVED: Bazel-integration-testing\n=================================\n\nNOTE: This repository has moved to https://github.com/bazel-contrib/rules_bazel_integration_test.\n\n**Because your build infra also needs build (and tests)**\n\nBazel CI\n:---:\n[![Build status](https://badge.buildkite.com/b0041826d71f5484c22145f44b3eac12357f51feb6ba6abb57.svg?branch=master)](https://buildkite.com/bazel/bazel-integration-testing-postsubmit)\n\n\n## Problem statement  \nBazel-integration-testing aims to give confidence when developing code that is strongly dependent on Bazel.  \nIt does so by allowing you to have **isolated reproducible tests which run Bazel inside of them**.  \nHappy path testing are often possible inside of bazel by adding examples of your usage but failing cases are much harder.      \nFew examples for such code can be Starlark plugins (both open and closed source), tools that augment Bazel/Bazel query and actually also Bazel itself.    \nThis project was inspired by Bazel's own integration tests which were in bash at the time and were coupled inside.    \nInternally 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.\nAll of these set up scratch workspaces isolated to the specific tests.  \n## Target audience  \n* Bazel Starlark rule developers (both open source and closed source)  \n* Bazel ecosystem tool developers (both open source and closed source)   \n* Bazel developers  \n## Alternatives\nFor integration testing as of Jan'19 there is no alternative which is usable outside of Bazel.  \nFor some use-cases and tests one can use bazel-skylib's [unittest](https://github.com/bazelbuild/bazel-skylib/blob/master/lib/unittest.bzl) framework.  \nThis 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.  \nTo be clear it's usually a good idea to have a mix of unit tests and integration tests for your feedback loop and confidence.\n## Architecture  \nThe project is built from repository rules, build rules and test drivers.  \nThe 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.  \nThe 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.  \nLastly each stack has a specific test driver which eases creation of scratch WORKSAPCE files, BUILD files, source files, running of Bazel and more.                                                                                                                                                                                                 \n## Getting started\n\nIn order to use `bazel_java_integration_test`, `bazel_go_integration_test`, or `bazel_py_integration_test`,\nyou must add the following to your WORKSPACE file:\n\n```python\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\nhttp_archive(\n    name = \"build_bazel_integration_testing\",\n    url = \"https://github.com/bazelbuild/bazel-integration-testing/archive/3a6136e8f6287b04043217d94d97ba17edcb7feb.zip\",\n    type = \"zip\",\n    strip_prefix= \"bazel-integration-testing-3a6136e8f6287b04043217d94d97ba17edcb7feb\",\n    sha256 = \"bfc43a94d42e08c89a26a4711ea396a0a594bd5d55394d76aae861b299628dca\",\n)\n\n\nload(\"@build_bazel_integration_testing//tools:repositories.bzl\", \"bazel_binaries\")\n#depend on the Bazel binaries, also accepts an array of versions\nbazel_binaries()\n\n```\nFor 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`:\n```python\nload(\"@build_bazel_integration_testing//tools:bazel_java_integration_test.bzl\", \"bazel_java_integration_test_deps\")\nbazel_java_integration_test_deps()\n```\n\n## Usage\n### [Jvm](java/README.md)  \n### Go\n\n[`rules_go`](https://github.com/bazelbuild/rules_go) already supports,\nnatively, an integration testing framework for validating your rules. If you\nneed to write integration tests, please refer to the\n[godoc](https://godoc.org/github.com/bazelbuild/rules_go/go/tools/bazel_testing)\nand associated\n[`go_bazel_test` rule.](https://github.com/bazelbuild/rules_go/blob/master/go/tools/bazel_testing/def.bzl).\nFor example usage, `rules_go` itself is tested using this rule and many\npackages inside of the\n[`tests`](https://github.com/bazelbuild/rules_go/blob/master/tests/) package\ncan be used as examples.\n\n### Python\nTODO\n\n## More info\n### Which bazel versions are supported\nTODO\n### How to have external repositories in your scratch workspace\nTODO\n### Remote execution support\nWe 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.\n## State of the project\n### Active development?\nThe project is under active development.  \nBecause 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.  \nNote 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.  \nWe hope to have more capacity in the next few months to also ramp up the missing pieces below.\n### What is missing  \n* More documentation (for `go` and `python` as well as much better documentation for the workspace drivers).    \n* 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.\n* More adoption by rule-sets (rules_docker, rules_scala, etc)\n* Up-to-date linting\n## Adopters\n\nHere'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](https://github.com/bazelbuild/bazel-integration-testing/edit/master/README.md)!\n\n* [bazel-watcher](https://github.com/bazelbuild/bazel-watcher)\n* [Wix](https://www.wix.com/)\n","funding_links":[],"categories":["Tooling","Java"],"sub_categories":["General"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelbuild%2Fbazel-integration-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbazelbuild%2Fbazel-integration-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelbuild%2Fbazel-integration-testing/lists"}