From 73d9e3ccee01748038f4e31c5f20d9a732fc341a Mon Sep 17 00:00:00 2001 From: rajeshkaremane Date: Wed, 17 Jul 2024 12:55:17 +0100 Subject: [PATCH 1/3] acceptance test --- docs/How-to-guides/how-to-acceptance-test.md | 87 ++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 docs/How-to-guides/how-to-acceptance-test.md diff --git a/docs/How-to-guides/how-to-acceptance-test.md b/docs/How-to-guides/how-to-acceptance-test.md new file mode 100644 index 0000000..be61fac --- /dev/null +++ b/docs/How-to-guides/how-to-acceptance-test.md @@ -0,0 +1,87 @@ +--- +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? + +1. 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"` + +2. Run the acceptance test script under scripts folder within the repo. + +### 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. From 5ea0be9e87f18c8b9c4fbb87343b9f568c918557 Mon Sep 17 00:00:00 2001 From: rajeshkaremane Date: Wed, 17 Jul 2024 12:58:43 +0100 Subject: [PATCH 2/3] updated index file --- mkdocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mkdocs.yml b/mkdocs.yml index 9ebe851..2c95aff 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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 From d926a306532d3d333259f9fbdc63a585730dbb01 Mon Sep 17 00:00:00 2001 From: rajeshkaremane Date: Wed, 17 Jul 2024 14:13:40 +0100 Subject: [PATCH 3/3] minor update --- docs/How-to-guides/how-to-acceptance-test.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/How-to-guides/how-to-acceptance-test.md b/docs/How-to-guides/how-to-acceptance-test.md index be61fac..7352711 100644 --- a/docs/How-to-guides/how-to-acceptance-test.md +++ b/docs/How-to-guides/how-to-acceptance-test.md @@ -38,12 +38,18 @@ If custom tags are defined then the pipeline need to be customized to run those ### How to run acceptance test locally? -1. Set required tags, default is empty string which will run all tests. +#### 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"` -2. Run the acceptance test script under scripts folder within the repo. +#### 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?