Skip to content

ByteSizedLaw/GoLang-Unit-Tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GoLang Unit Tests

A sample project for Software Engineers looking to perform unit tests in Go
This example shows a manual test, but can easily be automated via CICD pipelines or runners by DevOps engineers.
As part of the example, I have created an automated test workflow here, which is automatically run when you push to the Main branch.

How to execute the test:

  1. Clone the repo to a folder on your PC
  2. Open Command Prompt
  3. Navigate to the folder in Step 1, from within Command Prompt
  4. Run: go test main.go main_test.go
  5. You should get an output that says "ok", or an error message showing where the test failed

Notes:

  1. To create a Test file, create a new file called *_test.go, where * is the name of the file you're creating tests for.
  2. Each test method has to start with "Test", and the following word should be capitalized.
  3. Each test method should be within the same package as the method/function it's testing.

About

For Software Engineers looking to perform unit tests in Go

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages