Software testing has been damaged by strict names. Specifically unit test and integration test.

Use scopes that make sense for the project.

Make tests fast to run and easy to write

Why avoid "unit" or "integration"? And 3 steps to improve tests👇

#100DaysOfCode #freeCodeCamp
"Unit" in unit test is defined as the smallest testable part of any software.

We can go as small as a method in a class. We can end up with one test per method on every class we create (or functions).

We have high code coverage.

This sounds great, what's wrong with this?

👇
Writing one test per method/function you end up with highly coupled tests and tests that need a lot of code to be setup (e.g. mocks)

Consequently, reading and modifying existing tests becomes difficult.

Refactoring something has the extra work of fixing a lot of tests.

👇
Highly coupled tests and tests with high setup overhead turns into a team who dislike writing tests or doing anything related to tests and the testing pipeline.

👇
"Integration Testing" is defined as combining individual software modules to test them

We can go as big as using every external service/API, testing every single call

But, we end up with slow tests and a complicated pipeline

And, we need to setup and teardown a lot of data.
👇
Integrating every single par of an ecosystem and testing it also creates an environment where the team sees tests as a bottleneck rather than a helpful feature of development.

How can we fix this? 👇
Setting up a good testing strategy is no small task.

But, you can start with these three simple-ish steps! 👇
1️⃣ Understand testing scope.

The scope has to be different depending on the service/project you are working on.

If it's a service that relies heavily on an ORM, then tests should use an actual DB, not only integration tests.

👇
2️⃣Run tests as often as possible.

If you're doing TDD, that's great!
If you're not, don't worry, that's also great!

Create hooks to run tests on:
- Commits
- Push
- PRs
- Deployment

Isn't that too much?
👇
Not really. By running tests often you force the team to make sure tests are fast.

Running tests often should not be a bottle neck.

👇
3️⃣Test's code should have the same quality as the application code.

Do as much as possible to make tests readable and easily maintainable.

Document what each test is testing.

Keep set up and tear down code as simple and documented as possible.
If you like this thread please share and follow.

I write threads on the technical and human side of software, at least, twice a week.

Hope this thread helps you.

Thanks for reading!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Josue🧪

Josue🧪 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @rmcomplexity

10 Jan
Do you know what Python descriptors are?

Descriptor is a protocol in python that enables data to have a saying about what happens on lookup, storage and deletion.

A great use case for descriptors are data validation.

#100DaysOfCode #freeCodeCamp

🧵👇
When a class defines `__get__`, `__set__` or `__delete__` it becomes a descriptor and is called with the `.` (dot) operator.

By implementing validators as descriptors we push everything validation-related outside the class that holds data.
👇
Let's define two validators as descriptors.

They both store the actual value assigned in a private variable and run a validation function when a value is assigned.

Let's go over the special methods implemented 👇 class SkuValidator:     """Validates that a sclass PositiveIntValidator:     """Validates
Read 13 tweets
8 Jan
Do you know how `self` gets injected into a method in Python?

Methods defined in a class are function objects.

Methods in a class instance are **bound methods**

A thread 👇
#100DaysOfCode #freeCodeCamp  import logging from datacl...
A function object is implemented as a descriptor.

Which means when we access its value we are calling the __get__method in the function object.

👇  A method in an instance is...
When you call a method in an object instance the function descriptor injects the instance as the first argument.

In fact, we can manually call the descriptor from the class definition to show how it's actually being called:

👇 And, we can double check th...
Read 4 tweets
30 Nov 20
👩‍🏫 Are you mentoring?
🧑‍🎓Do you have a mentor?

Teaching others reinforces what you know!

A mentor can help you identify the things you need to work on to become better at your job

7 key things about finding a mentor and being a mentor

🧵👇
1⃣What is a mentor?

A person who help you improve professionally and personally

Sometimes is someone with whom you can have an honest conversation about anything

In a Mentor - Mentee relationship both parties benefit. But as a mentee always be respectful of your mentor's time.
2⃣How do I find a mentor?

You first have to show interest in growing and you have to be patient

Find people with experience in the fields you want to grow and make yourself noticed

You can contribute to some body else's work, ask questions or volunteer

Remember to be patient
Read 8 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!