Search
⌃K

Quick Start ⏱️

Install

Set up the Redefine CLI tool in your CI environment by copy-pasting the code below.
Pip Package Installer
pip install redefine --index-url https://redefine.dev/pip

Configure

Setup authentication key

Store the Redefine authentication key in your CI system by following the recommended best practices for your specific CI platform: GitHub Actions, GitLab CI, Jenkins, CircleCI, Buildkite, or TeamCity. Once stored, you can export the authentication key to the redefine CLI by setting it as the environment variable REDEFINE_AUTH. This ensures that the CLI can access the authentication key securely and use it for authentication purposes.
If you haven't gotten your Redefine credentials yet, don't worry! Just reach out to us at [email protected], and we'll be more than happy to assist you.

Configure your main git branch

Identify the primary working branch in your repository to serve as the stable branch for Redefine. For instance, you could use main as your stable branch name. This will ensure that Redefine operates on the correct branch when processing your project.
To configure your stable branch, use the following command:
redefine config set stable_branch=<stable_branch_name>
Check out Configuration Parameters for more configuration options.

Verify

Once you've installed and configured Redefine, make sure everything is working properly by running the verify command. This command checks if your CI environment is compatible with Redefine and returns a success message if all is good or an error message detailing any issues that need fixing. To run the command, follow these steps:
Pytest
Cypress
redefine verify --pytest
redefine verify --cypress
For a closer look at successful verification output and examples of failure cases, check out Verification Examples.
For a full list of error messages and resolutions, see Verify Troubleshooting.

Run in Discover Mode

With Discover mode, Redefine analyzes your coding patterns and test results to create its initial test optimization model. To start the discovery process, simply replace the verify command from the previous step with the following command:
Pytest
Cypress
redefine start --discover --pytest
redefine start --discover --cypress
For further details on selection modes, please see Selection Modes.

Examples

Check out the examples below that showcase the final setup of Redefine for development environments using pytest. These examples will give you an idea of what your configuration should look like once everything is in place.
Github Actions
Jenkins
CircleCI
TeamCity
Gitlab CI
Buildkite
- name: Run Redefine
id: run_redefine
env:
REDEFINE_AUTH: ${{ secrets.REDEFINE_AUTH_KEY}}
run: |
pip install redefine --index-url https://redefine.dev/pip
redefine config set stable_branch=dev
redefine start --discover --pytest
- name: Test with pytest
id: pytest_tests
run: pytest tests
stages {
stage('run pytest with redefine') {
environment {
REDEFINE_AUTH = credentials('REDEFINE_AUTH_KEY')
}
steps {
sh '''
pip install redefine --index-url https://redefine.dev/pip
redefine config set stable_branch=dev
redefine start --discover --pytest
pytest tests
'''
}
}
name: run Redefine
command: |
pip install redefine --index-url https://redefine.dev/pip
redefine config set stable_branch=dev
redefine verify
environment:
REDEFINE_AUTH: $REDEFINE_AUTH_KEY
- run:
name: test with pytest
command: pytest tests
export REDEFINE_AUTH=%secure:REDEFINE_AUTH_KEY%
export TEAMCITY_GIT_PATH=%teamcity.build.checkoutDir%
export TEAMCITY_HEAD_COMMIT_HASH=%build.vcs.number%
export TEAMCITY_PIPELINE_NAME=%teamcity.project.id%
export TEAMCITY_JOB_NAME=%system.teamcity.buildConfName%
export TEAMCITY_GIT_ACTION=%teamcity.pullRequest.branch.pullrequests%
export TEAMCITY_SOURCE_BRANCH=%teamcity.pullRequest.source.branch%
export TEAMCITY_TARGET_BRANCH=%teamcity.pullRequest.target.branch%
pip install redefine --index-url https://redefine.dev/pip
redefine config set stable_branch=dev
redefine start --discover --pytest
pytest tests
id_tokens:
VAULT_ID_TOKEN:
aud: https://gitlab.com
secrets:
REDEFINE_AUTH:
vault: production/redefine/[email protected]
token: $REDEFINE_AUTH
stage: test
script:
- pip install redefine --index-url https://redefine.dev/pip
- redefine config set stable_branch=dev
- redefine start --discover --pytest
- pytest tests
steps:
- label: "run pytest tests with redefine"
command: |
# redefine expects an environment variable named REDEDINE_AUTH
# check the documentation on how to use a secret in buildkite: https://buildkite.com/docs/pipelines/secrets
export REDEFINE_AUTH = <your-secret>
pip install -U redefine --index-url https://redefine.dev/pip/
redefine config set stable_branch=master
redefine start --discover --pytest
pytest tests
Tracking the discovery progress
Monitor the progress of the discovery process and verify the data using the Redefine Onboarding Wizard, which offers a user-friendly way to track the process and ensure accurate results.