SlideShare a Scribd company logo
No excuses for
not writing tests
Andrii
Shumada
Summer. Sea. JavaScript.
They take time to write
Why do you not write test?
Management asks for
features, not tests
I don’t know how to write
tests
I don’t know why I need to
write test
Agenda
1. What are the “tests” or “autotests”
2. Why do we need to write [auto]tests
3. Kinds of tests
4. What technologies I recommend for writing tests
5. F.A.Q.
What are the tests
or “autotests”
function validateEmail1(email) {
const re =
/^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"
]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1
,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2
,}))$/;
return re.test(String(email).toLowerCase());
}
function validateEmail2(email) {
const re =
/^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"
]+)*)|(".+"))@(([[0-9]{1,3},[0-9]{1,3}.[0-9]{1
,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2
,}))$/;
return re.test(String(email).toLowerCase());
}
function validateEmail(email) {
const re =
/^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"]+)*)|(".+"))@(([[0-9]{1
,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,
}))$/;
return re.test(String(email).toLowerCase());
}
function testValidateEmail() {
if (validateEmail('525235235235') === false) {
console.log('Negative test 1 passed');
} else {
console.log('Negative test 1 failed');
}
if (validateEmail('eagleeyes91@gmail.com') === true) {
console.log('Positive test 1 passed');
} else {
console.log('Positive test 1 failed');
}
}
testValidateEmail();
Why do we need to write [auto]tests
UI
POST /login
http
Server
C
O
M
M
O
N
C
O
M
M
O
N
C
O
M
M
O
N
C
O
M
M
O
N
C
O
M
M
O
N
C
O
M
M
O
N
How to test it?
Money-driven decision maker**
OR
AutoTests!
`npm i` changes everything!
➜ nest-sandbox git:(master) ✗ npm ls
nest-sandbox@0.0.1 /Users/ukr-andriishumada/prj/nest-sandbox
├─┬ @nestjs/cli@7.1.2
│ ├─┬ @angular-devkit/core@9.1.0
│ │ ├── ajv@6.12.0 deduped
│ │ ├── fast-json-stable-stringify@2.1.0 deduped
│ │ ├─┬ magic-string@0.25.7
│ │ │ └── sourcemap-codec@1.4.8
│ │ ├─┬ rxjs@6.5.4
│ │ │ └── tslib@1.11.1 deduped
│ │ └── source-map@0.7.3
│ ├─┬ @angular-devkit/schematics@9.1.0
│ │ ├── @angular-devkit/core@9.1.0 deduped
│ │ ├── ora@4.0.3 deduped
│ │ └─┬ rxjs@6.5.4
│ │ └── tslib@1.11.1 deduped
➜ nest-sandbox git:(master) ✗ npm audit
found 4716 vulnerabilities (4713 low, 3 high) in 1271scanned packages
"dependencies": {
"@nestjs/common": "^7.0.0",
"@nestjs/core": "^7.0.0",
"@nestjs/platform-express": "^7.0.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^6.5.4"
},
"devDependencies": {
"@nestjs/cli": "^7.0.0",
"@nestjs/schematics": "^7.0.0",
"@nestjs/testing": "^7.0.0",
"@types/supertest": "^2.0.8",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"@typescript-eslint/parser": "^2.23.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"jest": "^25.1.0",
"prettier": "^1.19.1",
"supertest": "^4.0.2",
"ts-jest": "25.2.1",
"ts-loader": "^6.2.1",
"ts-node": "^8.6.2",
"tsconfig-paths": "^3.9.0",
"typescript": "^3.7.4"
},
OR
AutoTests!
OR
AutoTests!
What else can change
- Node.js version!!!
- Any package version!!!
- Linux version!!
- Database version!!
- Whatever in infrastructure version!!
OR
AutoTests!
BDD
Bablo Driven
Development
Another good reason: TDD
(Test Driven Development)
Flow 1: No
tests
1. Write or adjust code
2. Restart app
[okay, maybe you have
live reload]
3. Repeat user flow
click by click
4. Check result
5. Repeat from step 1
Flow 2: TDD
1. Write tests
2. Write or adjust code
3. Restart test
4. Repeat from step 2
BDD
Bablo Driven
Development
Kinds of tests
UI Integration Unit
Unit testsfunction validateEmail(email) {
const re =
/^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"]+)*)|(".+"))@(([[0-9]
{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z
]{2,}))$/;
return re.test(String(email).toLowerCase());
}
function testValidateEmail() {
console.log('Start negative test 1');
if (validateEmail('525235235235') === false) {
console.log('Negative test 1 passed');
} else {
console.log('Negative test 1 failed');
}
console.log('Start negative test 2');
if (validateEmail('eagleeyes91@gmail.com') === true) {
console.log('Positive test 1 passed');
} else {
console.log('Positive test 1 failed');
}
}
testValidateEmail();
Integration tests
Send HTTP
request
get response
- Check status code
- Check response code
const app = require('express');
const request = require('request');
app.post('/', (req, res, next) => {
res.json({message: 'success'});
});
app.listen(3533, () => {
request.post('http://localhost:3533/', {json: true},
(err, res) => {
if(err) throw err;
if(resp.statusCode === 200 && resp.body.message ===
'success') {
console.log('Integration test ok!');
} else {
console.log('Integration test failed!');
}
process.exit(0);
});
});
Not a
production-grade
code!
UI tests
Mobile
http://appium.io/
UI tests
Selenium based
e.g https://webdriver.io/
Puppeteer or puppeteer based frameworks
How Selenium works
When use Selenium (Webdriver.io)
- Your app has problems in different browsers (IE, Safari)
- Your manager is VERY afraid, that something will not work in particular
browser
- Without automation your QA’s are always doing regression tests in different
browsers
Pros:
- Supports all major
browsers
Cons:
- Needs Java runtime
- More complicated setup
How Puppeteer works
Chrome DevTools Protocol
When use Puppeteer
- In all other cases
- You don’t need Java
Runtime
- Faster setup
- Works faster
Pros Cons
- Supports only
Chromium and
Firefox
(experimental)
Test example on Puppeteer
const puppeteer = require('puppeteer');
browser = await puppeteer.launch({headless: false});
page = await browser.newPage();
const randEmail =
`testUser_${Math.random().toString().split('.')[1]}@zail.com`;
await page.goto('google.com/registration', {waitUntil: 'networkidle2'});
await page.type('form input[name="first_name]', 'Ololosha');
await page.type('form input[name="last_name] ', 'Petrovych');
await page.type('form input[name="emair] ', randEmail);
await page.type('form.reg—form form input[name="password"', '123456');
await page.click('form.reg—form form button[type="submit1');
await page.waitFor('[href="/account"');
await page.click('[href="/account"');
await page.waitFor('.personal—banner');
How to choose test framework?
Mocha:
- Mature
- Stable
- No assertion
framework
Jest:
- Mature
- Stable
- Bundled with CreateReactApp
Tap, Cucumber, Jasmine:
- less functional
- Less maintable
- Require more work from development
My choice
Mocha + Chai, because it’s stable, functional
and works
If you just starting writing tests - stick to Jest,
it’a a bit faster
Test structure in test frameworks
describe('feature 1', () => {
before(() => {
//test setup here
})
it('should ', () => {
//check expectations
});
});
Which test to write,
unit, integration, UI
UI
Integration
Unit
Better emulates
User experience
Harder to write and
maintain
Which test to write,
unit, integration, UI
UI
Unit
Integration
Integrations tests work as a contract between frontend and
backend, your API should be more stable than
implementation behind them
Tests as a part of CI CD
- Always run tests on CI
- Only CI will guarantee, that tests keep green on master
- Make a CI process that merges master into your branch, run tests and after
pushes to origin/master
F.A.Q.
Business is not giving time to write tests..
And business has right!
Just tests are not bringing value as tests!
Eighter show, how much money they lose without tests or just
include tests in code writing time! Tests are also code
Business understands only money!
BDD
Bablo Driven
Development
Who needs to write tests - AutomationQA or developer
If you have dedicated AutomationQA - then probably Automation QA with help of
developers
Otherwise - developers should write tests.
Useful links:
http://appium.io/
https://pptr.dev/
https://eagleeye.github.io
Highload, BigData, Node.js, AWS
Andrii Shumada
@eagleeye

More Related Content

Similar to 'NO EXCUSES FOR NOT WRITING TESTS!' by ANDRII SHUMADA @OdessaJS'2020

Andrii Shumada "No excuses for not writing tests"
Andrii Shumada "No excuses for not writing tests"Andrii Shumada "No excuses for not writing tests"
Andrii Shumada "No excuses for not writing tests"
Fwdays
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
Ben Hall
 
An introduction to unit testing
An introduction to unit testingAn introduction to unit testing
An introduction to unit testing
Adam Stephensen
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
rajnexient
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
ssuser7b4894
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
AmenSheikh
 
Automation frameworks
Automation frameworksAutomation frameworks
Automation frameworks
Vishwanath KC
 
Test studiowebinaraugcodedstep
Test studiowebinaraugcodedstepTest studiowebinaraugcodedstep
Test studiowebinaraugcodedstep
Dhananjay Kumar
 
Acceptance Testing With Selenium
Acceptance Testing With SeleniumAcceptance Testing With Selenium
Acceptance Testing With Selenium
elliando dias
 
Clean tests good tests
Clean tests   good testsClean tests   good tests
Clean tests good tests
Shopsys Framework
 
Unit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and HowsUnit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and Hows
atesgoral
 
I one aolpage-test-2010
I one aolpage-test-2010I one aolpage-test-2010
I one aolpage-test-2010
Nicholas Tang
 
Appium TestNG Framework and Multi-Device Automation Execution
Appium TestNG Framework and Multi-Device Automation ExecutionAppium TestNG Framework and Multi-Device Automation Execution
Appium TestNG Framework and Multi-Device Automation Execution
pCloudy
 
Building frameworks over Selenium
Building frameworks over SeleniumBuilding frameworks over Selenium
Building frameworks over Selenium
Cristian COȚOI
 
Advanced Django
Advanced DjangoAdvanced Django
Advanced Django
Simon Willison
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testing
pleeps
 
Selenium
SeleniumSelenium
Selenium
Sun Technlogies
 
Selenium
SeleniumSelenium
Automate test, tools, advantages, and disadvantages
Automate test, tools, advantages,  and disadvantagesAutomate test, tools, advantages,  and disadvantages
Automate test, tools, advantages, and disadvantages
Majid Hosseini
 
Запускаем тесты в Continuous Integration - Сергей Пак (JetBrains)
Запускаем тесты в Continuous Integration - Сергей Пак (JetBrains)Запускаем тесты в Continuous Integration - Сергей Пак (JetBrains)
Запускаем тесты в Continuous Integration - Сергей Пак (JetBrains)
AvitoTech
 

Similar to 'NO EXCUSES FOR NOT WRITING TESTS!' by ANDRII SHUMADA @OdessaJS'2020 (20)

Andrii Shumada "No excuses for not writing tests"
Andrii Shumada "No excuses for not writing tests"Andrii Shumada "No excuses for not writing tests"
Andrii Shumada "No excuses for not writing tests"
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
An introduction to unit testing
An introduction to unit testingAn introduction to unit testing
An introduction to unit testing
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
 
Automation frameworks
Automation frameworksAutomation frameworks
Automation frameworks
 
Test studiowebinaraugcodedstep
Test studiowebinaraugcodedstepTest studiowebinaraugcodedstep
Test studiowebinaraugcodedstep
 
Acceptance Testing With Selenium
Acceptance Testing With SeleniumAcceptance Testing With Selenium
Acceptance Testing With Selenium
 
Clean tests good tests
Clean tests   good testsClean tests   good tests
Clean tests good tests
 
Unit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and HowsUnit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and Hows
 
I one aolpage-test-2010
I one aolpage-test-2010I one aolpage-test-2010
I one aolpage-test-2010
 
Appium TestNG Framework and Multi-Device Automation Execution
Appium TestNG Framework and Multi-Device Automation ExecutionAppium TestNG Framework and Multi-Device Automation Execution
Appium TestNG Framework and Multi-Device Automation Execution
 
Building frameworks over Selenium
Building frameworks over SeleniumBuilding frameworks over Selenium
Building frameworks over Selenium
 
Advanced Django
Advanced DjangoAdvanced Django
Advanced Django
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testing
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Automate test, tools, advantages, and disadvantages
Automate test, tools, advantages,  and disadvantagesAutomate test, tools, advantages,  and disadvantages
Automate test, tools, advantages, and disadvantages
 
Запускаем тесты в Continuous Integration - Сергей Пак (JetBrains)
Запускаем тесты в Continuous Integration - Сергей Пак (JetBrains)Запускаем тесты в Continuous Integration - Сергей Пак (JetBrains)
Запускаем тесты в Continuous Integration - Сергей Пак (JetBrains)
 

More from OdessaJS Conf

'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
OdessaJS Conf
 
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
OdessaJS Conf
 
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
OdessaJS Conf
 
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
OdessaJS Conf
 
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
OdessaJS Conf
 
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
OdessaJS Conf
 
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
OdessaJS Conf
 
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
OdessaJS Conf
 
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні..."NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
OdessaJS Conf
 
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
OdessaJS Conf
 
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by Dmytro Gusev
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by  Dmytro Gusev'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by  Dmytro Gusev
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by Dmytro Gusev
OdessaJS Conf
 
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
OdessaJS Conf
 
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
OdessaJS Conf
 
'MICROFRONTENDS WITH REACT' by Liliia Karpenko
 'MICROFRONTENDS WITH REACT' by Liliia Karpenko 'MICROFRONTENDS WITH REACT' by Liliia Karpenko
'MICROFRONTENDS WITH REACT' by Liliia Karpenko
OdessaJS Conf
 
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
OdessaJS Conf
 
'STORY OF ANOTHER ANIMATION' by YURII ARTYUKH at OdessaJS'2020
'STORY OF ANOTHER ANIMATION' by  YURII ARTYUKH at OdessaJS'2020'STORY OF ANOTHER ANIMATION' by  YURII ARTYUKH at OdessaJS'2020
'STORY OF ANOTHER ANIMATION' by YURII ARTYUKH at OdessaJS'2020
OdessaJS Conf
 
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
OdessaJS Conf
 
'Why svelte' by BORYS MOHYLA at OdessaJS'2020
'Why svelte' by BORYS MOHYLA at OdessaJS'2020'Why svelte' by BORYS MOHYLA at OdessaJS'2020
'Why svelte' by BORYS MOHYLA at OdessaJS'2020
OdessaJS Conf
 
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
OdessaJS Conf
 
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
OdessaJS Conf
 

More from OdessaJS Conf (20)

'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
 
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
 
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
 
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
 
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
 
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
 
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
 
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
 
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні..."NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
 
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
 
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by Dmytro Gusev
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by  Dmytro Gusev'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by  Dmytro Gusev
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by Dmytro Gusev
 
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
 
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
 
'MICROFRONTENDS WITH REACT' by Liliia Karpenko
 'MICROFRONTENDS WITH REACT' by Liliia Karpenko 'MICROFRONTENDS WITH REACT' by Liliia Karpenko
'MICROFRONTENDS WITH REACT' by Liliia Karpenko
 
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
 
'STORY OF ANOTHER ANIMATION' by YURII ARTYUKH at OdessaJS'2020
'STORY OF ANOTHER ANIMATION' by  YURII ARTYUKH at OdessaJS'2020'STORY OF ANOTHER ANIMATION' by  YURII ARTYUKH at OdessaJS'2020
'STORY OF ANOTHER ANIMATION' by YURII ARTYUKH at OdessaJS'2020
 
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
 
'Why svelte' by BORYS MOHYLA at OdessaJS'2020
'Why svelte' by BORYS MOHYLA at OdessaJS'2020'Why svelte' by BORYS MOHYLA at OdessaJS'2020
'Why svelte' by BORYS MOHYLA at OdessaJS'2020
 
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
 
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
 

Recently uploaded

Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
christinelarrosa
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
christinelarrosa
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024
Vadym Kazulkin
 

Recently uploaded (20)

Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024
 

'NO EXCUSES FOR NOT WRITING TESTS!' by ANDRII SHUMADA @OdessaJS'2020

  • 1. No excuses for not writing tests Andrii Shumada Summer. Sea. JavaScript.
  • 2. They take time to write Why do you not write test? Management asks for features, not tests I don’t know how to write tests I don’t know why I need to write test
  • 3. Agenda 1. What are the “tests” or “autotests” 2. Why do we need to write [auto]tests 3. Kinds of tests 4. What technologies I recommend for writing tests 5. F.A.Q.
  • 4. What are the tests or “autotests”
  • 5. function validateEmail1(email) { const re = /^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@" ]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1 ,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2 ,}))$/; return re.test(String(email).toLowerCase()); } function validateEmail2(email) { const re = /^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@" ]+)*)|(".+"))@(([[0-9]{1,3},[0-9]{1,3}.[0-9]{1 ,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2 ,}))$/; return re.test(String(email).toLowerCase()); }
  • 6.
  • 7. function validateEmail(email) { const re = /^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"]+)*)|(".+"))@(([[0-9]{1 ,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2, }))$/; return re.test(String(email).toLowerCase()); } function testValidateEmail() { if (validateEmail('525235235235') === false) { console.log('Negative test 1 passed'); } else { console.log('Negative test 1 failed'); } if (validateEmail('eagleeyes91@gmail.com') === true) { console.log('Positive test 1 passed'); } else { console.log('Positive test 1 failed'); } } testValidateEmail();
  • 8. Why do we need to write [auto]tests
  • 10.
  • 11.
  • 13.
  • 14. How to test it?
  • 15.
  • 16.
  • 17.
  • 20. `npm i` changes everything!
  • 21. ➜ nest-sandbox git:(master) ✗ npm ls nest-sandbox@0.0.1 /Users/ukr-andriishumada/prj/nest-sandbox ├─┬ @nestjs/cli@7.1.2 │ ├─┬ @angular-devkit/core@9.1.0 │ │ ├── ajv@6.12.0 deduped │ │ ├── fast-json-stable-stringify@2.1.0 deduped │ │ ├─┬ magic-string@0.25.7 │ │ │ └── sourcemap-codec@1.4.8 │ │ ├─┬ rxjs@6.5.4 │ │ │ └── tslib@1.11.1 deduped │ │ └── source-map@0.7.3 │ ├─┬ @angular-devkit/schematics@9.1.0 │ │ ├── @angular-devkit/core@9.1.0 deduped │ │ ├── ora@4.0.3 deduped │ │ └─┬ rxjs@6.5.4 │ │ └── tslib@1.11.1 deduped
  • 22. ➜ nest-sandbox git:(master) ✗ npm audit found 4716 vulnerabilities (4713 low, 3 high) in 1271scanned packages
  • 23. "dependencies": { "@nestjs/common": "^7.0.0", "@nestjs/core": "^7.0.0", "@nestjs/platform-express": "^7.0.0", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", "rxjs": "^6.5.4" }, "devDependencies": { "@nestjs/cli": "^7.0.0", "@nestjs/schematics": "^7.0.0", "@nestjs/testing": "^7.0.0", "@types/supertest": "^2.0.8", "@typescript-eslint/eslint-plugin": "^2.23.0", "@typescript-eslint/parser": "^2.23.0", "eslint": "^6.8.0", "eslint-config-prettier": "^6.10.0", "eslint-plugin-import": "^2.20.1", "jest": "^25.1.0", "prettier": "^1.19.1", "supertest": "^4.0.2", "ts-jest": "25.2.1", "ts-loader": "^6.2.1", "ts-node": "^8.6.2", "tsconfig-paths": "^3.9.0", "typescript": "^3.7.4" },
  • 26.
  • 27. What else can change - Node.js version!!! - Any package version!!! - Linux version!! - Database version!! - Whatever in infrastructure version!!
  • 30. Another good reason: TDD (Test Driven Development)
  • 31. Flow 1: No tests 1. Write or adjust code 2. Restart app [okay, maybe you have live reload] 3. Repeat user flow click by click 4. Check result 5. Repeat from step 1 Flow 2: TDD 1. Write tests 2. Write or adjust code 3. Restart test 4. Repeat from step 2
  • 33. Kinds of tests UI Integration Unit
  • 34. Unit testsfunction validateEmail(email) { const re = /^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"]+)*)|(".+"))@(([[0-9] {1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z ]{2,}))$/; return re.test(String(email).toLowerCase()); } function testValidateEmail() { console.log('Start negative test 1'); if (validateEmail('525235235235') === false) { console.log('Negative test 1 passed'); } else { console.log('Negative test 1 failed'); } console.log('Start negative test 2'); if (validateEmail('eagleeyes91@gmail.com') === true) { console.log('Positive test 1 passed'); } else { console.log('Positive test 1 failed'); } } testValidateEmail();
  • 35. Integration tests Send HTTP request get response - Check status code - Check response code
  • 36. const app = require('express'); const request = require('request'); app.post('/', (req, res, next) => { res.json({message: 'success'}); }); app.listen(3533, () => { request.post('http://localhost:3533/', {json: true}, (err, res) => { if(err) throw err; if(resp.statusCode === 200 && resp.body.message === 'success') { console.log('Integration test ok!'); } else { console.log('Integration test failed!'); } process.exit(0); }); }); Not a production-grade code!
  • 39. UI tests Selenium based e.g https://webdriver.io/ Puppeteer or puppeteer based frameworks
  • 41. When use Selenium (Webdriver.io) - Your app has problems in different browsers (IE, Safari) - Your manager is VERY afraid, that something will not work in particular browser - Without automation your QA’s are always doing regression tests in different browsers Pros: - Supports all major browsers Cons: - Needs Java runtime - More complicated setup
  • 42. How Puppeteer works Chrome DevTools Protocol
  • 43. When use Puppeteer - In all other cases - You don’t need Java Runtime - Faster setup - Works faster Pros Cons - Supports only Chromium and Firefox (experimental)
  • 44. Test example on Puppeteer const puppeteer = require('puppeteer'); browser = await puppeteer.launch({headless: false}); page = await browser.newPage(); const randEmail = `testUser_${Math.random().toString().split('.')[1]}@zail.com`; await page.goto('google.com/registration', {waitUntil: 'networkidle2'}); await page.type('form input[name="first_name]', 'Ololosha'); await page.type('form input[name="last_name] ', 'Petrovych'); await page.type('form input[name="emair] ', randEmail); await page.type('form.reg—form form input[name="password"', '123456'); await page.click('form.reg—form form button[type="submit1'); await page.waitFor('[href="/account"'); await page.click('[href="/account"'); await page.waitFor('.personal—banner');
  • 45. How to choose test framework? Mocha: - Mature - Stable - No assertion framework Jest: - Mature - Stable - Bundled with CreateReactApp Tap, Cucumber, Jasmine: - less functional - Less maintable - Require more work from development
  • 46. My choice Mocha + Chai, because it’s stable, functional and works If you just starting writing tests - stick to Jest, it’a a bit faster
  • 47. Test structure in test frameworks describe('feature 1', () => { before(() => { //test setup here }) it('should ', () => { //check expectations }); });
  • 48. Which test to write, unit, integration, UI UI Integration Unit Better emulates User experience Harder to write and maintain
  • 49. Which test to write, unit, integration, UI UI Unit Integration Integrations tests work as a contract between frontend and backend, your API should be more stable than implementation behind them
  • 50. Tests as a part of CI CD - Always run tests on CI - Only CI will guarantee, that tests keep green on master - Make a CI process that merges master into your branch, run tests and after pushes to origin/master
  • 52. Business is not giving time to write tests.. And business has right! Just tests are not bringing value as tests!
  • 53. Eighter show, how much money they lose without tests or just include tests in code writing time! Tests are also code Business understands only money! BDD Bablo Driven Development
  • 54. Who needs to write tests - AutomationQA or developer If you have dedicated AutomationQA - then probably Automation QA with help of developers Otherwise - developers should write tests.