AMA: Learning JavaScript automation & starting e2e tests

Edwin asks…

How should someone approach learning JavaScript strictly for the purpose of test automation? Should they learn it the way a front-end developer would or is there a better way to learn it for purposes of writing automation?

anil also asks…

I need to do automation by using mocha chai framework with selenum webdriver. can you please guide me or suggest any site or video on how to start and what are the basic things need to know.

My response…

Writing JavaScript automated tests in Node is a bit different than writing client side JavaScript that runs in a browser: most of the programming features are the same, but the toolsets like npm, nvm etc. are often not used for client side development by a front-end developer.

I am not sure of any resources, or videos, to learn test automation in JavaScript Node, since it’s fairly new and some of the tools aren’t that mature yet. I learn best by actually doing things, so I taught myself how these tools work, and built out a sample repository which you can easily clone and get running straightaway to get started. I’d recommend trying to add some new tests to that codebase for maybe a common public site that you use and see how you go.

Thinking about QA asks…

When should QA start to create e2e automation tests? e2e test results can be used as a measure of “product quality”?

My response…

I think you should start them as soon as possible – particularly if you have an existing system – work out what your most common or critical end user flow or journey is and automate that. Then automate another. Don’t worry too much about depth or slight variances, aim for breadth.

If you’re building a new system you can progressively write e2e automated tests as more functionality is built, so start where you can and keep adding breath as you get access to new functionality.

People perceive product quality in many different ways; I don’t believe automated end-to-end tests alone can tell you that you have a high quality product: they can give you assurance you have a baseline level of quality of functionality, but there’s many other factors that contribute to product quality like look-and-feel and responsiveness which these tests won’t measure. I like the GQM approach to metrics like product quality: you start by defining a goal, eg. high quality, then defining questions that you can ask for that goal, and finally metrics that answer your questions. You could try that.

Update: please see Autumnator’s comment below for a resource.

Author: Alister Scott

Alister is an Excellence Wrangler for Automattic.

3 thoughts on “AMA: Learning JavaScript automation & starting e2e tests”

  1. And on the question about learning javascript: provided one has time and/or dedication, I personally would suggest one to also learn javascript the way it’s actually used – that is, web-based javascript in the browser (core javascript along with jQuery, etc.) and/or server side javascript as in node.js how it’s used in (web) server or REST/web services frameworks along with command line node.js scripts/tooling – beyond the node.js and/or browser-based javascript test frameworks. Doing so gives one insight, context, and domain expertise around what they test and how to test, and at the same time, make one more proficient with javascript for their testing work. I elaborate more on this on the front-end browser based aspect in an old blog post:

    Liked by 1 person

Comments are closed.