Testing Go Projects


Course Number: GO-112

Duration: 0.5 days (3.25 hours)

Format: Live, hands-on

Go Projects Testing Training Overview

This instructor-led, private Testing Go Projects training course teaches attendees how to write and execute tests for Go applications with the standard testing package. Students learn proven testing techniques to verify hard-to-test code regularly encountered in real-world projects.

Location and Pricing

This course is taught as a private, live online class for teams of 3 or more. All our courses are hands-on, instructor-led, and tailored to fit your group’s goals and needs. Most Accelebrate classes can be flexibly scheduled for your group, including delivery in half-day segments across a week or set of weeks. To receive a customized proposal and price quote for online corporate training, please contact us.

Objectives

  • Implement and execute tests for Go projects
  • Apply proven testing techniques
  • Tackle real-world testing scenarios
  • Verify the correctness of your code with sensible assertions
  • Write effective test code even for complex, hard-to-test use cases
  • Drive tests from the command line and an IDE
  • Use testing to improve maintainability, achieve high cohesion, and reduce the strong coupling of your production source code

Prerequisites

  • A basic understanding of Go concepts and syntax (knowledge of a Go test framework is not required)
  • Familiarity with test concepts and test scenarios

Outline

Expand All | Collapse All

Why Testing?
  • The importance of testing
Testing Basics
  • Naming conventions and code organization
  • Writing meaningful assertions
  • Signaling helpful failure states
  • Running tests
  • Generating code coverage metrics
  • Reporting of code coverage
  • Implementing and executing a test case
  • Producing an HTML report for code coverage metrics
  • The trade-offs between testing exported and internal functions
Advanced Techniques
  • Managing test fixtures
  • Implementing and organizing repetitive test code
  • Running through test case permutations
  • Using mock objects
  • Separating and executing different types of tests
  • Setting up and tearing down test fixtures
  • Implementing a test helper
  • Implementing a table-driven test
  • Testing in isolation by mocking an interface
  • differentiating between unit and integration tests
Testing Real-World Scenarios
  • Comparing complex output with golden files
  • Testing HTTP endpoints; testing the behavior of CLI applications
  • Using a golden file for JSON data
  • Avoiding network calls and mocking the response
  • Testing a Cobra CLI command
Conclusion

Training Materials

All attendees receive a copy of the instructor’s presentation and related code.

Software Requirements

A computer with the Go runtime (13.x or higher) and an IDE (optimally GoLand or VS Code + the Go plug-in) installed



Learn faster

Our live, instructor-led lectures are far more effective than pre-recorded classes

Satisfaction guarantee

If your team is not 100% satisfied with your training, we do what's necessary to make it right

Learn online from anywhere

Whether you are at home or in the office, we make learning interactive and engaging

Multiple Payment Options

We accept check, ACH/EFT, major credit cards, and most purchase orders



Recent Training Locations

Alabama

Birmingham

Huntsville

Montgomery

Alaska

Anchorage

Arizona

Phoenix

Tucson

Arkansas

Fayetteville

Little Rock

California

Los Angeles

Oakland

Orange County

Sacramento

San Diego

San Francisco

San Jose

Colorado

Boulder

Colorado Springs

Denver

Connecticut

Hartford

DC

Washington

Florida

Fort Lauderdale

Jacksonville

Miami

Orlando

Tampa

Georgia

Atlanta

Augusta

Savannah

Hawaii

Honolulu

Idaho

Boise

Illinois

Chicago

Indiana

Indianapolis

Iowa

Cedar Rapids

Des Moines

Kansas

Wichita

Kentucky

Lexington

Louisville

Louisiana

New Orleans

Maine

Portland

Maryland

Annapolis

Baltimore

Frederick

Hagerstown

Massachusetts

Boston

Cambridge

Springfield

Michigan

Ann Arbor

Detroit

Grand Rapids

Minnesota

Minneapolis

Saint Paul

Mississippi

Jackson

Missouri

Kansas City

St. Louis

Nebraska

Lincoln

Omaha

Nevada

Las Vegas

Reno

New Jersey

Princeton

New Mexico

Albuquerque

New York

Albany

Buffalo

New York City

White Plains

North Carolina

Charlotte

Durham

Raleigh

Ohio

Akron

Canton

Cincinnati

Cleveland

Columbus

Dayton

Oklahoma

Oklahoma City

Tulsa

Oregon

Portland

Pennsylvania

Philadelphia

Pittsburgh

Rhode Island

Providence

South Carolina

Charleston

Columbia

Greenville

Tennessee

Knoxville

Memphis

Nashville

Texas

Austin

Dallas

El Paso

Houston

San Antonio

Utah

Salt Lake City

Virginia

Alexandria

Arlington

Norfolk

Richmond

Washington

Seattle

Tacoma

West Virginia

Charleston

Wisconsin

Madison

Milwaukee

Alberta

Calgary

Edmonton

British Columbia

Vancouver

Manitoba

Winnipeg

Nova Scotia

Halifax

Ontario

Ottawa

Toronto

Quebec

Montreal

Puerto Rico

San Juan