Code Testing + TDD

Code Testing + TDD

Created
May 9, 2022 2:58 PM
Tags
🔧 Developer Tools🗄 Backend Development
Library
🛠 Engineer: Tech | Engineering | Development
Last edited time
Nov 30, 2023 3:31 PM
Published?
Upcase : Test Doubles | RSpec Stub Online Tutorial by thoughtbot

Explore thoughtbot's video tutorials, exercises, and forum discussions on Test Doubles

Upcase : Test Doubles | RSpec Stub Online Tutorial by thoughtbot
Upcase : Stubs, Mocks, Spies, and Fakes | Online Video Tutorial by thoughtbot

Joe and Gabe review the four types of test doubles: stubs, mocks, spies and fakes. Learn what the key differences are between each type, as well as when you'd want to consider using them. See examples written using rspec-mocks, as well as an example of a robust fake for braintree.

Upcase : Stubs, Mocks, Spies, and Fakes | Online Video Tutorial by thoughtbot
Make Your Jest Tests up to 20% Faster by Changing a Single Setting

When you have Jest as your test runner, passing the --maxWorkers=50% option will make the tests faster in most cases. For watch mode, use --maxWorkers=25%, and for CI disable Jest workers with --runInBand. You can experiment with the percentage and fine-tune for your particular setup.

Make Your Jest Tests up to 20% Faster by Changing a Single Setting
image
Mocks Aren't Stubs

I'll begin by illustrating the two styles with a simple example. (The example is in Java, but the principles make sense with any object-oriented language.) We want to take an order object and fill it from a warehouse object. The order is very simple, with only one product and a quantity.

Mocks Aren't Stubs
Let's Not

RSpec is an excellent test framework with a large community and an active team of maintainers. It sports a powerful DSL that can make testing certain things much easier and more pleasant. However, there are a few features of RSpec's DSL that are frequently overused, leading to an increase in test maintenance and a decrease in test readability.

Let's Not
Common mistakes with React Testing Library

Some mistakes I frequently see people making with React Testing Library.

Common mistakes with React Testing Library
Mocking JavaScript Requests During Tests - FastRuby.io | Rails Upgrade Service

When we run tests, we don't want to hit external services in most cases, so our tests don't depend on external services and are more stable. We can use gems like VCR or WebMock to stub the requests that are done by the Rails application, but when the request is...

Mocking JavaScript Requests During Tests - FastRuby.io | Rails Upgrade Service
Integrated Tests Are A Scam

UPDATE. It's 2021 and although I still broadly agree with the content of this article, I don't like the style of it any more. I find it too abrasive and judgmental. I'm sorry about that. I leave this article here because I'm not ready to rewrite it just yet.

Integrated Tests Are A Scam
Thread by @GeePawHill: "TDD Pro-Tip: What we TDD most rigorously and faithfully is *our* *branching* *logic*. This is the insight one needs to start gaining TDD's m [...]"

TDD Pro-Tip: What we TDD most rigorously and faithfully is *our* *branching* *logic*. This is the insight one needs to start gaining TDD's massive productivity benefit. All three terms are important, "our", "branching", and "logic", so let's take them one at a time.

Thread by @GeePawHill: "TDD Pro-Tip: What we TDD most rigorously and faithfully is *our* *branching* *logic*. This is the insight one needs to start gaining TDD's m [...]"
frontendtestfest.com
image