GitLab & GitHub
Connect GitHub or GitLab to send TestFlair bugs to your issue tracker and to make your CI pipeline run TestFlair test runs before a build can pass.
- Push bugs TestFlair bugs become GitHub or GitLab issues
- Gate builds Your pipeline starts test runs and fails if any case fails or is blocked
- Trigger pipelines Start a GitLab pipeline or a GitHub Actions workflow from TestFlair
- Hosting GitHub.com; GitLab.com and self-hosted GitLab
- Who can set up CI Workspace Owner or Coordinator, or a Project Admin, QA Manager or Tester on the mapped project
The two integrations work the same way. Where they differ, the steps below show both.
Connecting
Click Connect on the GitHub or GitLab card in the Integrations Hub. The setup wizard has two steps: Authentication and Project Mapping.
Step 1: Authentication
- GitHub
- GitLab
Choose GitHub Cloud, then a method:
| Method | How |
|---|---|
| OAuth 2.0 (recommended) | Click Connect, approve TestFlair on GitHub, and you return to the wizard. |
| API Token | Paste a Personal Access Token with the repo and workflow scopes. |
Self-hosted GitHub isn't supported yet.
| Hosting | Method |
|---|---|
| GitLab Cloud | OAuth 2.0 (recommended), or API Token: a Personal Access Token with the api scope |
| Self-Hosted | Enter your GitLab Base URL (for example https://gitlab.yourcompany.com) and a Personal Access Token with the api scope |
To create a GitLab token: profile icon → Preferences → Personal access tokens → Generate token, choose your scopes, then copy the token.
Tokens are encrypted when stored.
Step 2: Project Mapping
Pair each TestFlair project with where its issues should go:
- GitHub: a GitHub Repository (owner/repo), for example
acme/web-app. - GitLab: a GitLab project (id or path), for example
1234orgroup/project.
Add as many pairs as you need. One TestFlair project can map to several repositories, for example a frontend and a backend repository. Click Finish setup.
A connection belongs to the workspace: one GitHub connection and one GitLab connection serve every project in it. Add more mappings later from the connection page with Map new project.
The connection page
Integrations → card → Manage → View Details shows:
| Section | What it holds |
|---|---|
| Connection Information | Base URL, Authentication Method, Connected On, Synced Today and mapped projects. |
| Project Mappings | Each TestFlair project and its repository. Remove one with the delete icon; the last mapping can't be removed — disconnect instead. |
| CI token panel | Generate or rotate the CI token and copy the pipeline snippet. |
| Trigger a GitLab pipeline / Dispatch a GitHub Actions workflow | Start a pipeline from TestFlair. |
| Pushed history | Recent bug pushes with their status. Open one to see which bugs it contained. |
The CI token and pipeline panels appear only if you can manage integrations on the mapped project (see the at-a-glance box).
Pushing bugs to issues
From the connection page:
- Click Push bugs at the top.
- Select the mapped projects to push bugs from, then click Next.
- Tick the bugs to push. Use the search box to find them, and open a bug to preview it.
- Click Push.
To push to one repository only, click the push icon on its card under Project Mappings.
You can also push from the Bugs page: select bugs and click Push to GitHub or Push to GitLab in the selection bar, or use a bug's … menu. See Bugs.
While the push runs, you can close the window; a notification tells you when it's done. Each pushed bug is marked Pushed in the picker.
Pushing a bug that was already pushed creates a new issue each time, and the bug is marked Re-pushed. Existing issues are not updated.
Running test runs from your pipeline
Your pipeline asks TestFlair to start one or more test runs, waits for them to finish, and fails the job unless every case passed.
1. Generate a CI token
On the connection page, click Generate token in the GitHub Actions CI token or GitLab CI token panel.
The token is shown once. Copy it straight into your CI secret store; you can't display it again. If you lose it, click Rotate token to issue a new one. Rotating disables the old token immediately, so update your CI variable straight away.
2. Store it in your CI
- GitHub
- GitLab
Add an Actions secret named TESTFLAIR_CI_TOKEN (Settings → Secrets and variables → Actions).
Add a masked CI/CD variable named TESTFLAIR_CI_TOKEN (Settings → CI/CD → Variables).
3. Copy the pipeline snippet
- Pick the Project mapping.
- Pick one or more Test run entries from that project.
- Click Copy above the Script and paste it into your pipeline:
- GitHub: a workflow file such as
.github/workflows/testflair.yml. The snippet runs onworkflow_dispatch(started by hand or by a dispatch); change theon:line to run it on pushes or pull requests. - GitLab: a
testflair-testsjob in.gitlab-ci.yml.
- GitHub: a workflow file such as
The snippet sends the token in the X-TestFlair-CI-Token header. You don't need to look up any IDs.
What the pipeline runs
- Each test run executes the test cases, engine and execution preferences saved on it. To change what CI runs, edit the test run in TestFlair; the snippet stays the same.
- A run that has never started is started; a finished run is run again as a new session.
- A run that is already running, or that lives in a project not mapped to this connection, isn't started. If none of the selected runs can start, the job fails with No runs started and prints the reason for each run.
- The token can start only test runs in projects mapped to that connection.
When the build passes
A run passes only when its session has completed with no failed and no blocked cases. A blocked case never ran, so it fails the build too.
The job log prints a status line per run, for example Status: COMPLETED | passed=false | 8/10 passed, 1 failed, 1 blocked. When a run doesn't pass, it adds:
- Why it failed: a one-line summary.
- Failed cases: one
✗line per failed or blocked case with its real error: the assertion or exception message, the compiler error if the script didn't compile, or why the case was blocked (no script, script still generating, script for the other engine).
Triggering a pipeline from TestFlair
The other direction, on the same page:
- GitHub
- GitLab
In Dispatch a GitHub Actions workflow, pick the mapping, a branch or tag, and the Workflow file, then click Dispatch workflow. The workflow must accept workflow_dispatch.
In Trigger a GitLab pipeline, pick the mapping and a branch or tag, then click Trigger pipeline. A confirmation offers View in GitLab.
Disconnecting
Manage → Disconnect removes the connection, its project mappings and its CI token from TestFlair. Issues and pipelines already created in GitHub or GitLab are not affected.
Any pipeline still using the old token fails from then on. Remove the snippet or reconnect and store a new token.
Troubleshooting
The card says Coming soon.
- The integration isn't available on your account yet. Contact [email protected].
A repository or project can't be mapped.
- GitHub needs the
owner/repoform. GitLab accepts a numeric id or the fullgroup/projectpath. - The account you connected must be able to see the repository.
I can't see the CI token panel.
- You need to be a workspace Owner or Coordinator, or a Project Admin, QA Manager or Tester on the mapped project.
The pipeline fails with "Invalid CI token" (401).
- The token was rotated or the connection was disconnected. Generate a new token and update
TESTFLAIR_CI_TOKEN. - Check the header name is exactly
X-TestFlair-CI-Token.
The job fails with "No runs started".
- Read the reason printed under it. "Test run is not in a project mapped to this GitLab connection" (or GitHub) means the run's project isn't mapped to the repository the token belongs to.
- A run that is still running from an earlier start can't be started again until it finishes.
The build fails but the run shows Completed.
- Completed means every case finished, not that they passed. Failed or blocked cases fail the build. Check the Failed cases lines in the job log, and see Why a case is Blocked.
Bugs push, but no issues appear.
- The connected account needs permission to create issues in the repository. Open the entry in Pushed history to see what failed.
Next steps
- Test Runs Build the runs your pipeline starts
- Bugs Manage the bugs you push
- Test Scripts Generate the scripts your runs execute
- Integrations Hub All your connections