CI/CD stands for Continuous Integration, Continuous Delivery (or Continuous Deployment), which represents a culture and process around constantly integrating new code. Conventional software development and delivery methods are rapidly becoming obsolete as deployment frequency increases.
Before DevOps, most companies would deploy/ship software in monthly, quarterly, bi-annual, or even annual releases (also known as the Agile days). In the DevOps era, weekly, daily, and even multiple daily deployments are the norm. CI/CD provides developers a solution to the problems associated with constantly integrating new code.
Make sure you are comfortable with the following lessons:
Integrating mabl tests in your deployment process helps you test the end-to-end user experience in multiple browsers as soon as code is deployed to a hosting environment within your CI/CD pipeline.
All mabl tests can run across environments by design, so you can easily run the same tests across multiple environments — from ephemeral preview environments for testing pull/merge requests to persistent staging environments, and even production!
You can integrate mabl with your CI/CD pipeline to run tests on deployment using one of the following options, in order of ease of use:
To run tests on deployment, mabl provides a variety of ways to integrate your automated end-to-end tests with your existing CI/CD pipeline including native plug-ins and a helpful curl-command builder.
Note: For all of the following integrations, your plans must be configured to use a deployment event as a trigger.
You can use the mabl Jenkins integration plugin to automatically trigger specific environment or application plans to run as a build stage with your existing Jenkins setup. Learn more.
mabl's Bamboo integration plugin is used to automatically trigger specific environment or application plans to run as a build stage in your current Bamboo pipeline. Learn more.
With mabl you can integrate your mabl tests directly into your build and release pipelines inside Azure DevOps. Within Azure DevOps, use the mabl pipeline task to automatically trigger specific environment or application plans to run as a build task. Learn more.
mabl integrates with GitHub through the mabl GitHub app and mabl Action. Doing so takes full advantage of GitHub Actions 2.0, automatic GitHub Issue creation, and filtering by GitHub data within mabl. Learn more.
mabl provides GitLab pipeline images that - in addition to triggering test runs - allow you to see test result summaries as well as to review test results in merge requests. Learn more.
You can use the Run mabl tests step template in the Octopus Deploy process to automatically trigger plans to run based on application, environment, or plan label settings. Learn more.
The trigger-tests Orb can be added to CircleCI pipelines to automatically trigger plans to run based on a wide variety of options. Learn more.
You can easily integrate mabl with most other CI/CD solutions through our built-in curl command builder. Learn more about integrating this way.
If you would like to integrate mabl CLI inside your CI/CD pipeline, you can either run them directly through mabl CLI commands or you can use the mabl-cli node package as a dependency in your project and define mabl tests with a testing framework such as Jest.
Note:
# install the CLI
npm install @mablhq/mabl-cli
# authenticate with Command Line Interface API key
mabl auth activate-key KEY_VALUE
# install wait-on to wait for the app to start
npm install wait-on
# start the web app AND wait until it loads
npm start & wait-on http://localhost:3000
# run a single mabl test
mabl tests run --id TEST_ID --environment-id ENVIRONMENT_ID --credentials CREDS_ID --headless
# run a set of tests by a label
mabl tests run --labels COOL_FEATURE_ONE --environment-id ENV_ID --headless
npm install --save-dev @mablhq/mabl-cli
mabl auth activate-key KEY_VALUE
“scripts”: {
...
"mabl:test": "jest mablTests.test.ts",
….
}
import {createMablTestRunner, TestRunConfig} from '@mablhq/mabl-cli';
jest.setTimeout(180000);
const CICD_BRANCH_NAME = process.env.CI_BRANCH;
const runConfig: TestRunConfig = {
credentialsId: 'CREDS_ID',
environmentId: 'ENVIRONMENT_ID',
workspaceId: 'WORKSPACE_ID',
url: 'http://localhost:3000',
branchName: CICD_BRANCH_NAME ?? 'master',
headless: true, // toggle to watch tests locally
};
describe('Super important mabl tests', () => {
it('This needs to always work', async () => {
const mablTestRunner = await createMablTestRunner({
testId: 'TEST_ID',
...runConfig,
});
const result = await mablTestRunner.run();
expect(result.success).toEqual(true);
});
});
npm run mabl:test
Note: If you would like, you can refer to the JavaScript testing frameworks page for more info.
What did we learn?