DEV Community

Arlene Andrews
Arlene Andrews

Posted on • Originally published at on

Learning to add tests to a program

In order to increase my knowledge, as well as make sure that I can apply the concepts -- I should apply it, correct? I know this is good advice as a generic, but it didn't work well, in this particular case.

Things started off well:

  • I got permission from someone to add tests to their React app.

  • I got encouragement to add tests to something else,as well (which made me both delighted and a bit scared).

  • I forked the repositories, with promises that I wouldn't add things that would break.

  • Scanned both the code and what the person wanted it to be to used for

  • Chose Jest to get things started - I'd used this before, so it should be easy.

And at this point, I've been stuck.

Do you, dear coder, recognize how many things there are to test in even simple applications? How does one figure out where to start testing, much less make sure that what tests you are doing are effective? And where to start?

Take a deep breath - there are answers out there, and they are good ones, at least to let you figure out what is best for you.

A few acronyms that you are likely going to run into are simple - there are a few that always confuse me before I'm fully in tester mode - AUT is one of them. It's just close enough to a word that the brain tries to make it into a word - then the rest of the sentence is confusing. Most of these can be figured out with a few moments and your favorite search engine (especially if you've been looking at testing topics recently).

My favorite answer is to put myself in the mindset of the person that is going to be using this: What else are they doing? Is this going to be a primary activity, or a quick visit?

And with the advent of foldable phones on the horizon, and three active applications that might exist - where might this be? And is is going to need things that other applications might?

As we have seen, recently, there are many areas of concern that should be tested - and it's good to be aware of them. If you have the time and budget, many of these could be tested. But few have that level of resources and time. So the plan is to get the most important areas tested, and then add as needed.

Simple tools, like Google's Lighthouse and aXe can add a basic level of accessibility confirmation to your work - but these are designed for web pages, and are not always the best tools to use. I use the scales they offer in some contexts to insure that the inward-facing dashboards and alerts are readable.

Working with your security team, or finding those with that skill is becoming a more-vital part of all programs. Everything from injections to securing the code itself in the cloud is now a potential issue: these need to be looked at as important risks to be evaluated.

Now, get into the mindset of your user - what are possibilities that might happen that you don't plan for? Some of these things might be buttons that are close together, or pop-ups that block someone selecting an option they want. And if a finger slides as an option is shown, might the user end up in a place they don't want to be, and can't get out of?

I find myself using April Wenzel's statement of "How can the tech I'm working on be abused?" as a basis for finding things to test - even if the abuse is simply someone tired, distracted, and needing the product _now. _

All of these things need looked at - even if they aren't going to have an influence on your application. You may find yourself with a standard list of things to think about as you continue to test - and this isn't bad: just make sure that it continues to grow and change as you do.

Discussion (0)