guardian / tip

Scala library for testing in production


Testing in Production (TiP) Maven Central Build Status Coverage Status

How to verify user journeys are not broken without writing a single test?

  • First time a production user completes a path the corresponding square on the board lights up green: board_example

  • Once all paths have been completed, label is set on the corresponding pull request: pr_label_example and a message is written to logs All tests in production passed.

User Guide

Minimal configuration - single board

  1. Add library to your application's dependencies:
    libraryDependencies += "" %% "tip" % "0.5.0"
  2. List paths to be covered in tip.yaml file and make sure it is on the classpath:
    - name: Register
      description: User creates an account
    - name: Update User
      description: User changes account details
  3. Instantiate Tip with TipConfig:
    val tipConfig = TipConfig("guardian/identity")
  4. Call tip.verify("My Path Name"") at the point where you consider path has been successfully completed.
  5. Access board at <tip cloud domain>/{owner}/{repo}/boards/head to monitor verification in real-time.

Setting a label on PR

Optionally, if you want Tip to notify when all paths have been hit by setting a label on the corresponding merged PR, then

  1. Create a GitHub label, for instance, a green label with name Verified in PROD: label_example
  2. Create a GitHub personal access token with at least public_repo scope. Keep this secret!
  3. Set personalAccessToken in TipConfig:
      repo = "guardian/identity",
      personalAccessToken = some-secret-token

Board by merge commit SHA

Optionally, if you want to have a separate board for each merged PR, then

  1. Set boardSha in TipConfig:
      repo = "guardian/identity",
      boardSha = some-sha-value
  2. Example Tip configuration which uses sbt-buildinfo to set boardSha:
      repo = "guardian/identity",
      personalAccessToken = config.Tip.personalAccessToken, // remove if you do not need GitHub label functionality
      label = "Verified in PROD", // remove if you do not need GitHub label functionality
      boardSha = BuildInfo.GitHeadSha // remove if you need only one board instead of board per sha
      buildInfoKeys := Seq[BuildInfoKey](
        BuildInfoKey.constant("GitHeadSha", "git rev-parse HEAD".!!.trim)
      buildInfoPackage := ""
      buildInfoOptions += BuildInfoOption.ToMap
  3. Access board at <tip cloud domain>/board/{sha}