Azure DevOps (AssertThat as master)

This is step-by-step guide for setting up an Azure DevOps pipeline to automate the synchronization of feature files from AssertThat Test Management to an existing Azure DevOps repository.

Prerequisites:

  • Access to Azure DevOps.

  • An existing Azure DevOps repository.

  • Access to your Jira instance with the admin permissions to projects.

  • Your Jira project's ASSERTTHAT_ACCESS_KEY and ASSERTTHAT_SECRET_KEY, which can be obtained from the AssertThat project configuration.

  • Your Jira project's PROJECT_ID, which you can obtain from AssertThat project configuration

Step 1: Create an Azure DevOps Pipeline

1.1. Go to your Azure DevOps project and select "Pipelines" from the left navigation menu.

1.2. Click "New Pipeline" to create a new pipeline.

1.3. Select the existing Azure DevOps repository where you want to store the pipeline configuration.

1.4. Choose a template for your pipeline. You can select an appropriate template depending on your project requirements. For this example, choose "Starter pipeline" to get a basic YAML configuration.

1.5. Edit the pipeline YAML file.

Step 2: Define the Azure DevOps Pipeline

Define your Azure DevOps pipeline YAML to automate the export of feature files from ASSERT_THAT and push them to your existing Azure DevOps repository. Here's a detailed example with explanations:

pool: vmImage: 'ubuntu-latest' steps: - script: | # Download the feature files from AssertThat # Extract the zip contents # Set up Git with your Azure DevOps repository credentials # Assuming you've already prepared the feature files locally # Replace the following placeholders with actual values: # - YOUR_JIRA_HOST (ASSERT_THAT API endpoint, typically the Jira host) # - YOUR_ASSERTTHAT_ACCESS_KEY (access key from AssertThat project configuration) # - YOUR_ASSERTTHAT_SECRET_KEY (secret key from AssertThat project configuration) # - YOUR_AZURE_DEVOPS_REPO_URL # - YOUR_AZURE_DEVOPS_USERNAME # - YOUR_AZURE_DEVOPS_TOKEN # - YOUR_ASSERT_THAT_PROJECT_ID (the ID of your project in AssertThat) # Export feature files from ASSERT_THAT (use ASSERT_THAT REST API with access and secret keys) curl -o feature_files.zip -H "Authorization: Basic $(echo -n YOUR_ASSERTTHAT_ACCESS_KEY:YOUR_ASSERTTHAT_SECRET_KEY | base64)" https://YOUR_JIRA_HOST/rest/assertthat/latest/project/YOUR_ASSERT_THAT_PROJECT_ID/client/features # NOTE: The example above is for Jira Data Center. In case you use cloud version the following URL should be used for downloading features:https://bdd.assertthat.app/rest/api/1/project/YOUR_ASSERT_THAT_PROJECT_ID/features # Unzip the feature files unzip feature_files.zip # Set up Git git config --global user.email "you@example.com" git config --global user.name "Your Name" git clone https://YOUR_AZURE_DEVOPS_USERNAME:YOUR_AZURE_DEVOPS_TOKEN@YOUR_AZURE_DEVOPS_REPO_URL git add *.feature git commit -m "Sync feature files from AssertThat" git push origin main displayName: 'Export and Push Feature Files' # Additional steps can be added for testing and reporting as needed
  • Replace the placeholders with your specific Jira host, AssertThat access key, AssertThat secret key, Azure DevOps repository details, and credentials.

  • The curl command is used to download the feature files from AssertThat using the access and secret keys.

  • The Authorization: Basic header is used with base64-encoded access and secret keys.

  • The script unzips the downloaded feature files, sets up a Git repository, and pushes the files to the Azure DevOps repository.

Step 3: Save and Run the Pipeline

Save the pipeline YAML file in your existing Azure DevOps repository. Trigger the pipeline by making changes to your main branch or by manually running it from the Azure DevOps interface.

With this pipeline in place, your feature files will be automatically exported from AssertThat using the specified access and secret keys and pushed to your existing Azure DevOps repository periodically or when you trigger the pipeline manually. This ensures the synchronization of your feature files between AssertThat and Azure DevOps.