Skip to content

azar-intelops/sample-go-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Folder structure:

Test file should always be present inside the package as to get code coverage and to test the functions which have not exported, we can test within package

why Testing and Why testify:

  • The standard testing package in Golang provides a basic framework for writing unit tests and benchmarks. It includes various functions and methods for assertions and testing error conditions, making it a powerful tool for testing code.

  • Testify, on the other hand, is a third-party package that provides additional testing utilities and assertions that can make testing even more convenient and expressive. It allows developers to write tests that are more concise, readable, and maintainable.

  • ginkgo: This is a BDD-style testing framework for Go that provides a fluent syntax for writing tests. It includes support for asynchronous testing, parallel execution, and test coverage reporting.

  • gomega: This is a matcher library that works with ginkgo or other testing frameworks. It provides a wide range of matchers for testing various types of data.

Comparision

Framework Description Features Pros Cons GitHub Stars (Till 28 April 2023) Popularity Developer-Friendly Documentation License Testing Speed Testing Scalability Testing Security
Go testing package Standard testing package in Go Writing unit tests, running tests, reporting results Lightweight, easy to learn and use, built-in to the language Limited assertion and mocking capabilities N/A Very popular Yes Good BSD-style Fast Scalable Good
testify Assertion library and test suite support Assertion functions, mocking, test suite support Rich set of assertion functions, flexible mocking, test suite support Can be verbose, requires additional dependencies 19.5k Very popular Yes Good MIT Fast Scalable Good
ginkgo BDD-style testing framework Fluent syntax, asynchronous testing, parallel execution, test coverage reporting Easy to read and write, supports BDD-style testing, comprehensive test coverage reporting Requires learning a new syntax, not built-in to the language 7.1k Popular Yes Good MIT Fast Scalable Good
gomega Matcher library for use with ginkgo or other testing frameworks Wide range of matchers for testing various types of data Easy to read and write, supports chaining of matchers, can be used with other testing frameworks Can be verbose, requires additional dependencies 1.9k Popular Yes Good MIT Fast Scalable Good
grpc_testing Testing framework for gRPC services Creating test clients and servers, sending requests and responses, verifying results Specifically designed for testing gRPC services, supports testing of unary, server streaming, and client streaming RPCs Requires knowledge of gRPC and protocol buffers, not suitable for testing non-gRPC code N/A Niche No Good Apache 2.0 Fast Scalable Good

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published