2020-02-21
1852
#react
Rafael Quintanilha
14261
Feb 21, 2020 â‹… 6 min read

Semantic tests with react-testing-library

Rafael Quintanilha Rafael Quintanilha is a frontend engineer focused on developing intuitive and accessible interfaces with React. You can read Rafael's articles on rafaelquintanilha.com, a blog where he talks about technology, web development, mathematics, and whatever comes to his mind.

Recent posts:

react native's new architecture: sync and async rendering

React Native’s New Architecture: Sync and async rendering

React Native’s New Architecture offers significant performance advantages. In this article, you’ll explore synchronous and asynchronous rendering in React Native through practical use cases.

Emmanuel John
Dec 24, 2024 â‹… 8 min read
Building a Full-Featured Laravel Admin Dashboard with Filament

Building a full-featured Laravel admin dashboard with Filament

Build scalable admin dashboards with Filament and Laravel using Form Builder, Notifications, and Actions for clean, interactive panels.

Kayode Adeniyi
Dec 20, 2024 â‹… 5 min read
Working With URLs In JavaScript

Working with URLs in JavaScript

Break down the parts of a URL and explore APIs for working with them in JavaScript, parsing them, building query strings, checking their validity, etc.

Joe Attardi
Dec 19, 2024 â‹… 6 min read
Lazy Loading Vs. Eager Loading

Lazy loading vs. Eager loading

In this guide, explore lazy loading and error loading as two techniques for fetching data in React apps.

Njong Emy
Dec 18, 2024 â‹… 5 min read
View all posts

One Reply to "Semantic tests with react-testing-library"

  1. Hi,
    Interesting article but I disagree on some aspects, here are 2 cents of mine to be added to the thinking …
    Each story needs to carry ‘acceptance criteria’ on which tests will be based.
    You don’t create your tests solely based on the story description “as a X I need to do Y so that I get Z”, and you don’t rely on the PM blindly deciding which tests are to be executed.
    How do you know 25 = 77 is representative of the test data you need to use to verify your converter result?
    What about 0, what about -1, what about 12.3 (or is it 12,3 that is accepted as valid input), what about 2.345,67 (or 2,345.67) ? How many decimals are required on the visual or during calculation? Do we use rounding or truncation?
    e.g. convert -17.77777 C to F : is that giving 1,4e-5°F as correct result ? or is it 1.399999998e-5 or 0.0000140000000001805 (sample taken from google search converter) ?
    Also you can’t skip implementation from your tests.
    Let’s imagine a developer detects numeric/alphabetic values in code by testing the keyboard key nrs, that is not good because not all keyboards have same layout and we want to test that (yes, I saw this being done by a developer)
    For ‘clear rules’, you’d maybe like to look at techniques such as equivalence partitioning, boundary value analysis, decision tree …

    Philippe.

Leave a Reply