BastRTS is a tool to perform regression test selection.
Babel Regression Test Selection
A tool to perform regression test selection
BabelRTS saves time when testing code!
Given a codebase that has changed, this tool selects which tests are safe to execute. Only tests that involve changed code are selected. Tests that operate over untouched code shouldn't be run, so BabelRTS doesn't select them. Therefore it saves a lot of time when doing regression testing over large projects or with large test suites.
BabelRTS works well with many languages and it is based upon Dext, a tool that extracts file dependencies from code.
python -m babelrts -h for help.
Python >= 3.8 is required.
Note: this guide assumes that your python 3 installation is under the keyword
python, however for most linux distribution it is under
python3. If this is the case for you, just use
The installation is done through python's package manager pip. Simply run:
python -m pip install babelrts
BabelRTS can be used as a stand alone module, or trough its API. The basic usage is:
python -m babelrts [-h] [-v] [-l <lang profile>] [-p <project folder>] [-t <test folder>] [-s <source folder>] [-o [<output>]]
- -h, --help show help message and exit
- -v, --verbose increase output verbosity
- -l <lang> [<lang> ...] set one or more languages (default all)
- -p <project folder> set project folder (default "current working directory")
- -t <test folder> [<test folder> ...] set one or more test folders relative to <project folder> (default same as <project folder>)
- -s <source folders> [<source folder> ...] set one or more source folders relative to <project folder> (default same as <project folder>)
- -o [<output>] set output file (default "stdout")
The suggested workflow for using BabelRTS that will save time during testing
When run, this tool generates, inside the project folder, a new folder named
.babelrts, which contains 4 files:
- selected.json contains a json array with the paths to all the selected test files. This file should be used to instruct the testing utility on performing regression testing
- hash.json contains a json object with all the sha1 of all the source files in the codebase
- dependencies.json contains a json object with all the file dependencies in the codebase
- changed.json contains a json array with all the changed classes since the previous BabelRTS run
BabelRTS API can be used by another script. Simply import
babelrts to access its functions. Its main API is:
main(), to run the whole module as if it was called in the stand alone option.
run(langs, project_folder, test_folders, source_folders, verbose, output), to run BabelRTS passing your own arguments
rts(langs, project_folder, test_folders, source_folders), to run just the rts part
Example: runninf BabelRTS from another script.
#import BabelRTS module >>> import babelrts #run BabelRTS with language='java', project_folder='java-design-patterns/adapter/', test_folder='src/test', source_folder='src/main', verbose=False >>> selected, dependencies, changed, new_hashes, test_files, source_files = babelrts.rts(['java'], 'java-design-patterns/adapter/', ['src/test'], ['src/main'])
BabelRTS supports many languages out of the box, including:
However many more languages are available. Read Dext Language Profiles for more info.
How it works
BabelRTS uses hashes to determine which files in a codebase have changed and then selects only tests that involve those files, thus saving a lot of time when running the test suite. The steps performed by BabelTS are:
- hash all source files in a codebase
- compare new hashes with the older ones
- mark any file with different hash as "changed"
- mark any new file as "changed"
- compute graph of dependencies
- select any test marked "changed"
- select any test with at least one dependency marked "changed"
- output selected tests
- store hashes for next run
The advantages of using BabelRTS are:
- it works with many languages
- it's lightweight (just a few scripts)
- it's lightning fast to run (faster than other RTS tools)
- it saves a lot of time when used on large projects with large test suites
- it doesn't require anything beside the code itself (other tools need things like the history of faults, class diagrams, integration with versioning tool...)
- it's customizable
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size babelrts-1.1.0-py3-none-any.whl (5.3 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size babelrts-1.1.0.tar.gz (5.4 kB)||File type Source||Python version None||Upload date||Hashes View|