Cant concentrate on codding, so starting twitter thread with JS testing tools that i recommend. Mostly e2e/ui and API stuff
#MochaJS if you don't know what runner to take. Has almost everything you need for UI and API tests. And recently parallelization out of the box was added! But also has hundreds of different reporters and plugins
mochajs.org
chaijs.com
But there are a lot of alternatives as well.
It has rich built-in assertions, parallelization and mocking.
Other test runner to look at:
github.com/cucumber/cucum…
Unfortunately JS version has pretty poor documentation, and very unusual API comparing to other test runners. But human-readable tests attracts people a lot.
Instead of writing Gherkin syntax, with gauge you can write regular markdown. Also has very tight integration with browser controlling lib - taiko.dev
But regular gherkin is more widely used.
Killer feature - massive parallelization not only by files(usual for tests in js), but by separate tests inside one file as well. But be aware of his reporter API!
It promises very small resources overhead for running your unit tests. This might be important if you run unit tests. But this speed will not be noticeable because of general slowness of e2e tests.
My favorite one, of course @webdriverio
Awesome sync mode which makes switching from other languages much easier. Good TS support. A lot of points to extend every aspect. Rich ecosystem around. Familiar API.
1) How to deal with 3rd party async code (webdriver.io/docs/api/brows…)
@ProtractorTest - protractortest.org
Has good implementation of LazyElements pattern, even for collections of elements. Still has a lot of tools around. Community is huge. But updates comes rarely.
Definitely must-read if you planning to start project with protractor in 2020
2 new contributors noticed in commits history
github.com/kyliau
and
github.com/alan-agius4
both from angular team. Fresh release v7 was made (dependencies versions bumps) - github.com/angular/protra…
Is this a reborn?
It is not so widely known as webdriverio or protractor, but has very rich API with assertions, lazy-elements and automatic waits, and can be combined with almost every test runner.
Inspired by java @jselenide
By default it is wraps mochajs, but can be used with cucumberjs as well.
@Cypress_io is a king in this kind. Super-rich set of possibilities to control almost every aspect of your application. Easy to start, hard to break up. Stunning visualization of your tests execution, with time-travel (no Delorean needed)
docs.cypress.io/guides/referen…
Must-read before choosing between cypress and webdriver.
Uses proxy to intercept requests and inject code into pages.
Supports cross-browser, and some other sweet things.
Unfortunately i haven't used it in real projects, and community is small (no one knows why)
A lot of people are predicting that they will eventually replace webdriver-protocol based tools.
I personally think that this is possible, since devtools protocol has much wider API, and bi-directional
github.com/puppeteer/pupp…
Huge API! Just take a look at possibilities that webdriver cant even dream about:
- request intercepting
- events listening
And much more: pptr.dev
And it is blazing fast, commands are executed much faster than webdriver
I used it a lot for some scrapping/page manipulating stuff in browser. Once i created bot that completed tests for me!
But anyway keep in mind, puppeteer is not a testing tool, you need to choose test runner, integrate it with puppeteer, think about reporting, and so on. You can try codecept+puppeteer instead codecept.io/helpers/Puppet…
It has similar API, but has different approach in supporting browsers. @brekelov wrote a nice article with comparing puppeteer vs playwright - habr.com/ru/company/jug…
docs.google.com/spreadsheets/d…
It is not perfect, and your comments and ideas are welcome, but at least some place to start.
Next time will have a thread about tests infrastructure!