Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 2.23 KB

5.5.5-test-automation.md

File metadata and controls

46 lines (35 loc) · 2.23 KB
docs/5-software-development-practices/5.5.5-test-automation.md
category estReadingMinutes exercises
Software Quality
5
name description estMinutes technologies
Create a GitHub Action to test a Go project
Create a GitHub Action that will run Unit Tests when a change is pushed
180
GitHub Actions
Go

Automated Testing

Automated testing is a crucial step to ensure code quality because developed tests are guaranteed to run once new source code is committed. GitHub Actions is a tool that can help us leverage our tests in a build step. With a testing stage in GitHub Actions, code quality can be ensured by automatically running the tests that have been written. If tests fail, the build can be marked as unstable and deployment will not occur.

?> If you want to test the creation or alteration of a GitHub workflow before committing it, you can use a tool called ACT

Exercise 1

  1. Create a new workflow, test, like you did for the getting-started workflow in the GitHub Actions section of the bootcamp.
  2. Set up this workflow to run whenever code changes are pushed to any branch of your repository
  3. Create jobs for the workflow:
    • Setup - Setup the Go Language
    • Test - Run your Unit Tests, make sure this job depends on the Setup job
  4. Commit and push the changes
  5. Go to the Actions tab on your repository fork and verify that test workflow ran successfully.

Exercise 2

  1. Open up your getting-started workflow that you created in the GitHub Actions section of the bootcamp.
  2. Edit this workflow to include the Test and Setup jobs you created in Exercise 1 as part of this workflow
  3. Alter the existing simple job to depend on the Test job completing successfully.
  4. Commit and push the changes to your getting-started workflow.
  5. Go to the Actions tab on your repository fork and verify that build workflow ran successfully.

Exercise 3 - Badges

  1. Update the README.md to include a workflow status badge for your test workflow.

Deliverables

  • Discuss the positives of having your testing built into an automation tool such as GitHub Actions
  • Discuss the benefits of having workflow badges on your projects