# table driven tests

Published articles for table driven tests.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Parametrised tests in Rust with named parameters

DevFeed: [Parametrised tests in Rust with named parameters](<https://devfeed.tech/articles/parametrised-tests-in-rust-with-named-parameters-60386.md>)

Original publisher: [Read original article](<https://alexwlchan.net/2026/table-driven-rust/>)

Published: 2026-09-26T08:43:00Z

Content type: tutorial

Language: en

Sources: [alexwlchan](<https://devfeed.tech/sources/alexwlchan.md>)

Topics: [Rust](<https://devfeed.tech/topics/rust.md>), [table driven tests](<https://devfeed.tech/topics/table-driven-tests.md>), [test](<https://devfeed.tech/topics/test.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [rust](<https://devfeed.tech/tags/rust.md>), [software-testing](<https://devfeed.tech/tags/software-testing.md>), [table-driven-tests](<https://devfeed.tech/tags/table-driven-tests.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

The article explains how to write table-driven tests in Rust using named parameters. It compares loops, positional-argument macros, and third-party testing libraries, then describes a custom macro designed to reduce repetition while preserving readability.

### Source excerpt

I wrote a macro that lets me define test cases with labelled inputs and outputs, so I can reduce repetition without affecting readability.

## if got, want: A Simple Way to Write Better Go Tests

DevFeed: [if got, want: A Simple Way to Write Better Go Tests](<https://devfeed.tech/articles/if-got-want-a-simple-way-to-write-better-go-tests-52783.md>)

Original publisher: [Read original article](<https://mtlynch.io/if-got-want-improve-go-tests/>)

Author: Michael Lynch

Published: 2025-01-08T00:00:00Z

Content type: tutorial

Language: en

Sources: [Mtlynch](<https://devfeed.tech/sources/mtlynch-io.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [table driven tests](<https://devfeed.tech/topics/table-driven-tests.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [go](<https://devfeed.tech/tags/go.md>), [table-driven-tests](<https://devfeed.tech/tags/table-driven-tests.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

### AI overview

A tutorial on using the `if got, want :=` pattern in Go tests. The pattern makes expected and actual values clearer, simplifies copied assertions, and separates assertions from test control flow.

### Source excerpt

There's an excellent Go testing pattern that too few people know. I can teach it to you in 30 seconds. Instead of writing Go tests like this: // The common, unrefined way. username := GetUser() if username != "dummyUser" { t.Errorf("unexpected username: got %s, want: %s", username, "dummyUser") } Write your tests like this, beginning each assertion with if got, want :=: // The underused, elegant way. if got, want := GetUser(), "dummyUser"; got != want { t.Errorf("username=%s, want=%s", got, want) } The if got, want :=: pattern works even better in table-driven tests. Here's an example from my library for parsing social media handles:

## Table driven tests in Go

DevFeed: [Table driven tests in Go](<https://devfeed.tech/articles/table-driven-tests-in-go-22198.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/01/table-driven-tests-in-go.html>)

Published: 2023-01-19T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [table driven tests](<https://devfeed.tech/topics/table-driven-tests.md>)

Tags: [documentation](<https://devfeed.tech/tags/documentation.md>), [go](<https://devfeed.tech/tags/go.md>), [go-test](<https://devfeed.tech/tags/go-test.md>), [golang](<https://devfeed.tech/tags/golang.md>), [table-driven-tests](<https://devfeed.tech/tags/table-driven-tests.md>), [tests](<https://devfeed.tech/tags/tests.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

### AI overview

Go table-driven tests store input cases and expected outcomes in a slice, then run the function against each case. As the case set grows, locating a failure becomes harder. The excerpt describes using sub-tests: each test function receives a name and test logic, and the Go test output shows that name when the case fails, making it easier to identify the failing case.

### Source excerpt

Introduction Table tests are a great way to test different inputs and associated outputs for a function in Go. To write a table test, you define a slice of some data struct with fields of the input data you'll need and the expected outcome. Then you can loop through this slice and pass the data stored for each element to your function. One disadvantage of table tests is as the data set in your slice grows, the harder it is to find the failing case. Luckily, Miki will share some tips to manage this with the Go test suite.