Giter Site home page Giter Site logo

diu-system-monitor's Introduction

DIU System Monitor

This codebase is an implementation of Sorry Cypress server for storing results of Automated Tests, and files on Canary-style testing for repeating the automated tests on production environments as a system health monitoring

Pre-requisites

  • An AWS Account, with an IAM with required permissions to use the AWS SDK
  • Locally stored AWS Credentials which grant programmatic access, created in AWS IAM
  • AWS Secrets Manager to include the following secrets: jwt, awsdev (for notes on these please review the deployment code documentation)
  • Typescript v2.7 or later installed
  • Node.js v10.13.0 or later installed

System Tests (Cypress)

Rationale and Objectives

Routine testing of the systems we deploy is essential for a timely and efficient response to errors and ensures minimal downtime. This is crucial to running a clinical system and ensures compliance with best practice (https://aws.amazon.com/blogs/apn/the-6-pillars-of-the-aws-well-architected-framework/).

There are different types of test and different levels of testing. Most tests can fall into a category of either Unit testing or Integration testing: i.e. can a thing work and can things work together.

Whilst the built in testing library Protractor performs a nice role in Angular testing, its most suitable use-case for us is to perform Unit testing. Coding a basic spec.ts file for each component that runs a "can create" test will ensure that the application will build and compile.

However more functional tests can be created for both Unit testing and Integration by using the Cypress library (https://docs.cypress.io/api/table-of-contents). By using this library, we have the added benefit of being able to easily abstract our test files from the codebase itself. This allows us to do more than test during a development sprint or during a deployment pipeline.

By removing the dependency on the codebase for the tests to run, we can carry out Canary-style testing on our live systems (production and development), routinely to ensure all systems are running as expected. This application is designed to provide those routine tests.

Tests and Structure

All test files are contained in the cypress folder. For information on the usecase for the different folders in this section please refer to the cypress guidance.

Any global settings for the application are kept in the settings.js file in the root folder of this codebase.

The main elements we are interested when creating and managing the test files are in the integration, fixtures and support folders.

Fixtures

The json files in the fixtures folder contain demo data for use during the tests.

Support

The files in the support folder include the commands.js file. In here are some sections of repeatable code that we use frequently, like the login command. Using custom commands created in this folder will ensure that we avoid coding errors or duplication of work. Please familiarise yourself with the custom commands prior to creating new tests.

Integration

This folder is the core files that cypress uses for testing. Any spec.ts files you create in this folder or any of its sub-folders will be used in the testing runs. Please ensure that you use a sensible folder structure when creating new files.

Instructions for recording tests

  • use npm run test-server to record tests to a running sorry-cypress server

Instructions for running locally

  • use npm run test-local to run the cypress testing locally. This will load all of the configuration files and create the required fixtures.

Backend (Sorry-Cypress)

Instructions for running in the cloud

  • TBC

Instructions for sorry-cypress running locally

After successfully running docker-compose, we have

Terms of Use

This specific code repository and all code within is © Crown copyright and available under the terms of the Open Government 3.0 licence.

The code has been developed and is maintained by the NHS and where possible we will try to adhere to the NHS Open Source Policy (https://github.com/nhsx/open-source-policy/blob/main/open-source-policy.md).

It shall remain free to the NHS and all UK public services.

Contributions

This code has been authored by NHS staff in the Digital Intelligence Unit @ NHS Blackpool CCG.

This project and all code within is © Crown copyright and available under the terms of the Open Government 3.0 licence.

diu-system-monitor's People

Contributors

alexseymourdev avatar morgans3 avatar stewart-morgan avatar

Forkers

alexseymourdev

diu-system-monitor's Issues

NI-929 Write test scripts for https://api.nhs-bi-platform.co.uk/api-docs/

Generic Tests

  • generic-GET-ByParams 200 tests
  • generic-GET-ByParams 404 tests
  • generic-POST 200 tests
  • generic-PUT 200 tests
  • generic-PUT 404 tests
  • generic-DELETE 200 tests
  • generic-DELETE 404 tests

Non-generic tests

  • cohorts
  • cvicohorts
  • demographics
  • docobo
  • docobooutbound
  • govuk
  • gpinpatients
  • mfa
  • niceevidence
  • password
  • postcodes
  • searchusers
  • serviceaccounts
  • teammembers
  • teamrequests
  • teams
  • trials
  • users

NI-945 Automated Testing Scripts for App

  • Login
  • Dashboard
  • App Store
  • Dashboard Store
  • Profile
  • Teams
  • Admin
  • Navigating to all apps
  • Navigating to all dashboards
  • User Registration
  • Capability and Role request processes
  • Confluence and Support pages

Remaining API test scripts

  • Roles
  • Capabilities
  • VirtualWards
  • Requests
  • HouseholdIsochrone
  • AccessLogs
  • LPRESViewer
  • OpenSource
  • ServiceAccounts

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.