The Testing Introduction I Wish I Had

Max Antonucci on February 12, 2019

Seeing as there's no shortage of topics I should've learned about earlier, I'm surprised it took so long to write another "Introduction I Wish I ... [Read Full]
markdown guide
 

Writing a test that passes isn't always good. There's been cases where I get a test passing, but when I deliberately change it to fail, it still passed and I realized it was busted.

Always, always, always beware of False Positive.

Awesome introduction to Testing @maxwell_dev . Didn't knew about Percy. i will surely check it out

 

I have a few False Positive horror stories, and I actually wish I'd called them that since it's a great way to sum up that testing issue!

And definitely check out Percy, part of me hopes it can be a more reliable, mainstream VR tester for programmers someday.

 

Great summary for testing but you may have forgotten performance and stress tests.
Regarding unit tests, it can become very complex when it comes to mocking dependencies or testing asynchronous functions.

Thanks for your post!

 

Ah good catch with the performance and stress tests. Sadly right now in my career I haven't had much exposure to those, so those slipped through my focus. I'll need to do some more research later, thank you for bringing those up!

 

Great introduction. I would add two - often underrated - items to your Why Testing Matters section:

  • Unit and integration tests promote modular software design. Designing for testability makes code easier to understand and maintain.

  • Tests can serve as an additional documentation, especially to help other developers familiarize themselves with the code. Tests define what the software is supposed to do and what not.

 

These are good points and I thank you for bringing them up here! Especially the point about tests serving as extra documentation. I had planned to include a "tests make your code's aims explicit" section but that header felt too wishy-washy to me and I removed it. But if I'd framed it as documentation I likely would have kept it since it gets more to the point of how it adds value.

 

Absolutely nailed the article! Thanks for this!

I just happened to write an article about testing myself and stumbled onto this gem. (get it?)

dev.to/jtenner/testing-with-assemb...

I managed to develop a testing framework from scratch for the new AssemblyScript language (TypeScript subset compiled to Web Assembly) and would love your thoughts on how it is written.

Thanks a bunch, and cheers on your endeavors! 🎉

 

Love this article Max! Very helpful overview of the different types of testing - it can feel a bit overwhelming when one just sees a list of the different code tests without any succinct explanations. Added this to my "core articles" list (a list I maintain on Diigo of all the articles I think are really essentialy on various topics).

 

Loved your article! I've been always bothered by how little emphasis there is on testing. I just finished my degree in CS and just started hearing about testing in my penultimate semester. Had to take a course from another career (IT) to get an introduction to testing! So hadn't I gone out of my way to take that particular class I may have never heard about it up to this point.

 

I been learning testing for the past 2 weeks and it's hard but I'm trying to get into the TDD mindset. I do agree that testing React apps is really hard but little by little I'm getting it.

 

The React testing struggle is definitely real. I've been spoiled by Ember testing, and the big tradeoff with that is I've gotten much less experience adding my own tests or customizing them when needed. All the more reason it matters to build up a few apps from nothing for better understanding.

 
 

When I was doing internship as backend developer (ruby on rails), one of my first task was to test the existing apis. My senior fellow recommend me to use 2 gems, factory bot and faker. Factory bot helped me in automatically injecting dummy data for testing. For dummy data itself, Faker played its role. It's a powerful gem that can mock almost all types of data (dates, phone number, coordinates, names etc). These 2 gems really eased the testing process.

P.S awesome article

 

Good recommendations, and we actually use those same two gems for testing in our own Rails app! Plus the RSpec testing library, since it does so much to make the tests explicit, readable, and even fun to write in classic Ruby fashion.

 

Interesting article! Definitely recommend checking out WireMock as a useful data stubbing solution: wiremock.org/

 

What about System Testing?

  • End to end testing scenarios involves testing the fully integrated application in order to check the interaction between different components of the system.
  • Involves verifying thorough testing of every input in the application to check for expected results.
 

I think system testing or end-to-end testing is a kind of integration test at a large scale.

 

Can someone advise me a suitable article on the ABC of testing for a newbie like me?

 

This is an amazing article, and I greatly appreciate it. It makes me bitter/sad/reflective of just how little I know in regards to mature and well-developed programming skills.

I've been developing websites / online software for 14 years (completely self-taught). Company after company (minus one amazing startup) never put any investment into testing, and it's sadly taken me this long to finally be serious about learning how to properly test c
ode.

I imagine even now, as a single developer on a very complex and massive enterprise project if I were to ask for time to implement proper testing (and re-write my code to be testable), I'd be replaced with contractors whose only goal is to write code quick and deploy.

 

It is a sad reality, and honestly if I didn't work with good programmers in my current job who knew to emphasize testing I likely would have not learned it myself at this point. It's tough because a lack of tests are like working near a nuclear waste spill - it doesn't do any immediate damage, but the damage it does is slow, gradual, and by the time you notice the damage it's likely too late and you're incapable of having children.

So for the sake of future generations, extra focus on tests is needed!

 

I can wholeheartedly recommend Obey the Testing Goat!: obeythetestinggoat.com/. It covers all of this in great and practical detail. We have all our juniors work through it during onboarding.

 

I love that! That's a great onboarding topic, it must really help keep the codebase consistently strong.

That would make an amazing t-shirt to, "Obey the Testing Goat."

 

I have always thought that tests are unskipable and those who did were lazy people.

Excellent article!

 

Bots are a big problem today. Major platforms protect against them and you can't test them.

If your app is breaking on refactor, scrap it and pay for an api, or decouple it into components.

Monitoring and analytics helped me more. If tests are a problem in implementation, it's a sign I've overreached on the features for launch.

Edge cases and corner cases are often talked about, but no one really knows what it takes to write them. They think it's just a million rows in a database, or running them under a server load test. It's more like:

This messed up last time.
I stopped it by doing this.
So do this from now on.

 

For VR testing I have tried BackstopJS seemed easy to setup and provide what I needed for a small site.

code of conduct - report abuse