DEV Community

Cover image for Getting into software testing with Jest

Getting into software testing with Jest

Aniket Pal on March 01, 2022

Starting from open-source projects to enterprise software, most softwares have a huge codebase. Don't believe me? Here is a fact! Some of the Googl...
Collapse
 
liviufromendtest profile image
Liviu Lupei

Worth mentioning that Jest will only test your JavaScript.
But don't rely only on Jest.
A real browser is more than just a JavaScript interpreter.

The best practices mention that you should run automated tests in all major browsers, including Safari (which is used by 20% of users, including myself).

A few weeks ago, I wrote a small article:
What Happens When You Don't Test in Safari

Even using clean vanilla code can lead to major cross-browser issues.

Collapse
 
zarausto profile image
Fausto

Users can choose the best browser, Safari is becoming the new Internet Explorer, users insist to use it relying on thought about performance/battery and other stuff. Of course performance is important, but new technologies require new behaviors. If you choose Safari you're choosing not to have new technologies. 🤷‍♂️

Collapse
 
liviufromendtest profile image
Liviu Lupei • Edited

That's how democracy works, and I think it's great that users can choose from a number of browsers that are decent.

You have to test in the browsers used by your users, that's why it's important to get that information from your analytics.

Accessibility means making your website work for as many users as possible.

In some cases, that could mean supporting small screen resolutions or certain browsers.

Now, even if we will live in a totalitarian world where Chrome will be the only browser, you'll still have Chrome on Windows and Chrome on Mac.

Ever noticed that the select elements look different on Chrome on Mac vs. Chrome on Windows?
That's just one of the many differences you'll encounter.

Testing on different browsers can be painful, but it's a best practice, there is no workaround.

Collapse
 
reikrom profile image
Rei Krom

combine with Playwright to do actions and Jest to assert

Collapse
 
liviufromendtest profile image
Liviu Lupei

Some folks are complaining that Playwright, Puppeteer and others are not following any open standards.

That means there's a risk they might stop working out of the blue with certain browsers or other components.

What will happen then?

Collapse
 
aniket762 profile image
Aniket Pal

You have written a masterpiece, thanks for commenting otherwise I would have missed it. Specially taking Safari as the corner case is genius never actually thought what happens in it.

Collapse
 
aabhassao profile image
Aabhas Sao

To be honest the most beginner friendly testing article I have read so far. The way you have explained what is jest and how to do write tests are just amazing. Ultimately, the demo makes it more surreal and useful 😍

Collapse
 
aniket762 profile image
Aniket Pal

Thanks for your time and your comments means a lot 💕

Collapse
 
sumana2001 profile image
Sumana Basu

Wow! This made testing so much easier for me. Will definitely try the demo myself🔥

Collapse
 
aniket762 profile image
Aniket Pal

Thanks for your time and your comments means a lot 💕

Collapse
 
brajesh071989 profile image
BRAJESH KUMAR

Very nice document to start with Jest :)

Collapse
 
aniket762 profile image
Aniket Pal

Thanks for your time and your comments means a lot 💕

Collapse
 
alexbrown40 profile image
Alex Brown

Great quick intro for beginners getting into Jest 💪

Collapse
 
aniket762 profile image
Aniket Pal

Hearing this for you means a lot. Let me know if this gets a place in your newsletter 😛

Collapse
 
jack94507501 profile image
Jack

Very interesting post

Collapse
 
aniket762 profile image
Aniket Pal

Thanks Jack

Collapse
 
kumarshantanu01 profile image
Kumar Shantanu

A great and useful blog ✨🔥
Got to learn about testing🧪

Collapse
 
aniket762 profile image
Aniket Pal

Thanks for your time and your comments means a lot 💕

Collapse
 
irsayvid profile image
Divya Sri Darimisetti

Simple and insightful blog ✨ Really liked it

Collapse
 
aniket762 profile image
Aniket Pal

Thanks for your time and your comments means a lot 💕

Collapse
 
asambhab profile image
a-sambhab

Love the work

Collapse
 
aniket762 profile image
Aniket Pal

Thanks for your time and your comments means a lot 💕

Collapse
 
sayantanmaiti profile image
Sayantan Maiti

The article is informative and easy to understand. Keep up the good work!! 🔥

Collapse
 
aniket762 profile image
Aniket Pal

Thanks for your time and your comments means a lot 💕

Collapse
 
iamakl profile image
Ankush Lohani

Every bit of this blog is so insightful, Kudos man. Got to know many things about testing.

Collapse
 
aniket762 profile image
Aniket Pal

Thanks for your time and your comments means a lot 💕

Collapse
 
divyamojas profile image
Divyam Ojas

One of the most beginner friendly articles I've come across. Nice work bro 🙌

Collapse
 
aniket762 profile image
Aniket Pal

Thanks for your time and your comments means a lot 💕

Collapse
 
uditanshu23 profile image
Uditanshu Satpathy

Great writing man!! Got to learn few new things!
Keep up the good work 👏🏻

Collapse
 
aniket762 profile image
Aniket Pal

Thanks for your time and your comments means a lot 💕

Collapse
 
mickyjoseph profile image
Micky Joseph

Nice post :) I learn about testing from this article.
Again very nice article.

Collapse
 
aniket762 profile image
Aniket Pal

Thanks a lot Micky means a lot✨

Collapse
 
mrahdev profile image
RAHMANI Mohammad

Thanks chef