JavaRush
AI Academy
new
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Unit tests in Go: *_test.go, TestXxx, Arrange–Act–Assert

    Go SELF
    29 level,0 lecture
    We break down how go test discovers tests by files *_test.go and functions in the TestXxx format, why a test needs the * testing.T context, and how t.Errorf differs from t.Fatalf. We reinforce the Arrange–Act–Assert template, the got/ want pattern, and also write short unit tests for the ValidateTitle and NormalizePriority functions.
    Open
  • Table-driven tests — cases, names, readable errors

    Go SELF
    29 level,1 lecture
    We break down the table-driven approach in Go: how to describe scenarios as data via []struct{...}, why to add a name field, how to write readable messages in t.Errorf, when continue and wantErr are appropriate, and how to check the meaning of errors via errors.Is (without comparing text). At the end: common mistakes and a mini example of “assembling” the todo task.
    Open
  • Subtests t.Run and t.Helper: maintainable tests

    Go SELF
    29 level,2 lecture
    We break down how to turn table-driven tests into a clear scenario tree with t.Run, how to write small helper functions, and how to get the “right” failure locations via t.Helper(). As a result, tests become more readable, the test runner report becomes more diagnostic, and adding new cases becomes safe and fast.
    Open
  • t.Cleanup — guaranteed resource cleanup in tests

    Go SELF
    29 level,3 lecture
    We break down how Go tests “leak” state and why cleanup is mandatory: what t.Cleanup does, when exactly it runs (including subtests), why the call order is LIFO, how it differs from defer, and how to apply the pattern “changed state → immediately registered rollback” for global settings, temporary directories, and resources. At the end: common mistakes and how to avoid them.
    Open
  • Fakes and stubs via interfaces

    Go SELF
    29 level,4 lecture
    We break down how to make unit tests repeatable in Go: move “the outside world” into dependencies via minimal interfaces (TaskStore, Clock), replace them in tests using stub/fake, freeze “time” without time.Time, write table-driven tests, and check errors by meaning via errors.Is when wrapping with %w.
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush