Skip to content

Commit

Permalink
Merge pull request #35 from DEFRA/rv/414684
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshkaremane authored Jul 17, 2024
2 parents 7957f3c + d926a30 commit bd69fd2
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
93 changes: 93 additions & 0 deletions docs/How-to-guides/how-to-acceptance-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
title: How to acceptance test
summary: How to create and run acceptance test for a service
uri: https://defra.github.io/adp-documentation/How-to-guides/how-to-acceptance-test/
authors:
- Rajesh Venkatraman
date: 2024-07-17
weight: 2
---

## How to acceptance test

In this how to guide you will learn how to create, deploy, and run acceptace test for a Platform service (Web App, User Interface etc) for your team.

## Prerequisites

Before adding acceptance tests for your service, you will need to ensure that:

- [Onboarded delivery project on to ADP](../Getting-Started/onboarding-a-delivery-project.md)
- [Created a Platform Service for your team/delivery project](../How-to-guides/how-to-create-a-platform-service.md)

## Overview

By completing this guide, you will have completed these actions:

- [x] Learned how to add acceptance test for your service.
- [X] Learned how to run acceptance test locally.
- [X] How to customize your pipeline to run acceptace tests based on tags for different env.

## Guide

### How to add acceptance test for your service?

You may add tags for features and scenarios. There is no restrictions on the name of the tag. Recommended tags @sanity @smoke @regression
[refer](https://github.com/DEFRA/ffc-demo-web/blob/main/test/acceptance/features/subsidenceStartDate.feature)

If custom tags are defined then the pipeline need to be customized to run those tests as detailed in following sections.

### How to run acceptance test locally?

#### Set required tags, default is empty string which will run all tests

- pwsh : `$ENV:TEST_TAGS = "@sanity or @smoke"`
- shell: `export TEST_TAGS = "@sanity or @smoke"`

#### Run the acceptance test script under scripts folder within the repo

```shell
docker-compose up -d
cd test/acceptance
docker-compose run --rm wdio-cucumber
```

### How to customize your pipeline to run acceptace tests?

Every pipeline run includes steps to run varoious tests pre deployment and post deployment.
These tests may include unit, integration, acceptance, performance, accessibilty etc as long as they are defined for the service.

You can customize the tags and environments where you would like to run specific features or scenarios of acceptance test

```yaml
postDeployTest:
testEnvs:
performanceTests: snd4, pre1
accessibilityTests: snd4, tst1,
acceptanceTests:
- env: snd4
tags: '@demotag'
- env: dev1
tags: '@sanity or @smoke'
envToTest: snd4,dev1,tst1,pre1
```
if not defined, the pipeline will run with following default settings
```yaml
postDeployTest:
testEnvs:
performanceTests: snd4, pre1
accessibilityTests: snd4, dev1, tst1
acceptanceTests:
- env: snd4
tags: '@sanity or @smoke'
- env: dev1
tags: '@smoke'
- env: tst1
tags: '@smoke or @regression'
envToTest: snd4,dev1,tst1,pre1
```
Please refer ffc-demo-web pipeline: [Refer](https://github.com/DEFRA/ffc-demo-web/blob/main/.azuredevops/build.yaml)
Test execution reports will be available via Azure DevOps Pipelines user interface for your project and service.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ nav:
- How to guides:
- How to create a platform service: How-to-guides/how-to-create-a-platform-service.md
- How to deploy a platform service: How-to-guides/how-to-deploy-a-platform-service.md
- How to acceptance test: How-to-guides/how-to-acceptance-test.md
# ------------------- Migrate to ADP -------------------
- Migrate to ADP:
- Migrate a delivery project: Migrate-to-ADP/migrate-a-delivery-project.md
Expand Down

0 comments on commit bd69fd2

Please sign in to comment.