SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Scalable eCommerce Platform Solutions
Component tests.
Let’s do that!
IT Global MeetUp
Saint-Petersburg,
23 July, 2016
Scalable eCommerce Platform Solutions
• Test Levels
• Component tests: howTo(Back end perspective)
• Component tests vs Integration tests
• Skills you need
• Component tests: howTo(Front end perspective)
The goals of today’s talk
2
Scalable eCommerce Platform Solutions
● Unit Tests
● Component Tests
● System Tests
Test levels
3
Scalable eCommerce Platform Solutions
Picture of the app architecture
SUT
4
Scalable eCommerce Platform Solutions
Main flow
{
name: “pikachu”,
age:10,
Id: 0,
externalId: null
}
BE
5
Scalable eCommerce Platform Solutions
Main flow
BE
{
name: “pikachu”,
age:10,
Id: 0,
externalId: superCat1
}
External Service
6
Scalable eCommerce Platform Solutions
Main flow
7
Scalable eCommerce Platform Solutions
Main flow
8
Scalable eCommerce Platform Solutions
@Test @DataProvider("cats")
public void responseContainsExtId(String catJson) {
Response response = restClient.post().content(catJson).thenReturn();
assertNotNull(response.body().jsonPath("externalId"));
}
Integration(system) tests
9
Scalable eCommerce Platform Solutions
@Test @DataProvider("cats")
public void responseContainsExtId(String catJson) {
Response response = restClient.post().content(catJson).thenReturn();
assertNotNull(response.body().jsonPath("externalId"))
}
Component tests
10
Scalable eCommerce Platform Solutions
@Autowired
RestClient restClient;
In Spring Context:
<beans profile = "system-tests">
<bean id = "restClient" class = "com.blah.blah.RestClient">
<beans profile = "component-tests">
<bean id = "restClient" class = "com.our.cool.DirectInvocationRestClient">
But!
11
Scalable eCommerce Platform Solutions
• Implement own dispatcher (RestEasy could be used)
• Set controllers from BE code to ResourceFactory of the Dispatcher
DirectInvocationRestClient
12
Scalable eCommerce Platform Solutions
DirectInvocationRestClient
13
Dispatcher dispatcher = MockDispatcherFactory.createDispatcher();
dispatcher.getRegistry().addResourceFactory(
new SingletonResource(catsController));
@Path("/") @Produces(MediaType.APPLICATION_JSON)
public class CatsController {
@POST @Path("/saveMyCat")
public CatDTO saveMyCat() {
//doSmth
return cat;
}
}
Scalable eCommerce Platform Solutions
• Set up in-memory DB
• Create mock for the external service
• Prepare spring context for easy-run all of this
Finally:
Tell developers how to use that =)
What else we need
14
Allows to run fast and
debug
Scalable eCommerce Platform Solutions
Component tests vs Integration tests
Component tests Integration(System) tests
Speed 3 2
Business logic coverage 3 3
Debug availability 3 1
Deploy/Environment coverage 1 3
Environment dependence 3 1
15
Scalable eCommerce Platform Solutions
@Component({
templateUrl: 'app/components/cat/cat.component.html',
styleUrls: ['app/components/cat/cat.component.css'],
directives: [ROUTER_DIRECTIVES]
})
export class CatComponent {}
Component tests on FE
16
Scalable eCommerce Platform Solutions
describe('Add cat', () => {
beforeEachProviders(() => [
provide(CatService, {useClass: MockCatService}),
//Set up variables you need in mock here
]);
Component tests on FE
17
Scalable eCommerce Platform Solutions
it('Should save cat with received external ID', injectAsync([TestComponentBuilder], (tcb) => {
return tcb.createAsync(CatComponent).then((fixture) => {
fixture.detectChanges();
var form = fixture.debugElement.nativeElement;
updated.querySelector('input').setAttribute('CatName');
form.querySelector('send-button').click();
form.detectChanges();
expect(form.querySelector("cats-list").contains('superCat1');
});
}));
});
Component tests on FE
18
Scalable eCommerce Platform Solutions
Mocked BE
19
import * as express from 'express';
const app = express();
import * as bodyParser from 'body-parser';
import {OnInit} from "../../../build/lib/@angular/core/esm/src/metadata/lifecycle_hooks";
class MockCatService implements OnInit {
ngOnInit() {
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
const port:number = process.env.PORT || 8080;
const router = express.Router();
router.post('/saveMyCat', function (req, res) {
res.json(req.json.externalId("superCat1"));
});
app.use('/api', router);
app.listen(port);
}
}
Scalable eCommerce Platform Solutions
BE component tests require:
Java core; Spring(or any DI framework); Maven(or any build tool);
HSQLDB(or any db) + additional: TestNG, Allure, RestEasy and others…
FE component tests require:
TypeScript; Angular2; gulp; Express + additional: Jasmine; Karma and
others
Skills you need(example)
20
Scalable eCommerce Platform Solutions
Some theory:
http://qala.io/blog/holes-in-test-terminology.html
http://istqbexamcertification.com/what-are-software-testing-levels/
Theory+examples:
http://qala.io/blog/test-pyramid.html
Angular2 unit & component tests:
https://www.youtube.com/watch?v=C0F2E-PRm44
Useful links
21
Scalable eCommerce Platform Solutions
Thank you!
Email: vsevolod.brekelov@gmail.com
Github: https://github.com/volekerb
22

Weitere ähnliche Inhalte

Was ist angesagt?

Integrating SalesforceDX and Test Automation
Integrating SalesforceDX and Test AutomationIntegrating SalesforceDX and Test Automation
Integrating SalesforceDX and Test AutomationRichard Clark
 
Realtime selenium interview questions
Realtime selenium interview questionsRealtime selenium interview questions
Realtime selenium interview questionsKuldeep Pawar
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven TestingMaveryx
 
Codeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiCodeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiFlorent Batard
 
Keyword-driven Test Automation Framework
Keyword-driven Test Automation FrameworkKeyword-driven Test Automation Framework
Keyword-driven Test Automation FrameworkMikhail Subach
 
Illia Seleznov - Integration tests for Spring Boot application
Illia Seleznov - Integration tests for Spring Boot applicationIllia Seleznov - Integration tests for Spring Boot application
Illia Seleznov - Integration tests for Spring Boot applicationAnna Shymchenko
 
"Experiences Of Test Automation At Spotify" with Kristian Karl
"Experiences Of Test Automation At Spotify" with Kristian Karl"Experiences Of Test Automation At Spotify" with Kristian Karl
"Experiences Of Test Automation At Spotify" with Kristian KarlTEST Huddle
 
Как не нужно писать Gherkin сценарии
Как не нужно писать Gherkin сценарииКак не нужно писать Gherkin сценарии
Как не нужно писать Gherkin сценарииAndrii Dzynia
 
Why test automation projects are failing
Why test automation projects are failingWhy test automation projects are failing
Why test automation projects are failingIgor Khrol
 
Btd presentation-2011
Btd presentation-2011Btd presentation-2011
Btd presentation-2011kinow
 
Software Automation Testing Introduction
Software Automation Testing IntroductionSoftware Automation Testing Introduction
Software Automation Testing IntroductionNarayanan Palani
 
Unit & integration testing
Unit & integration testingUnit & integration testing
Unit & integration testingPavlo Hodysh
 
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
Acceptance & Functional Testing with Codeception - SunshinePHP 2016Acceptance & Functional Testing with Codeception - SunshinePHP 2016
Acceptance & Functional Testing with Codeception - SunshinePHP 2016Joe Ferguson
 
Selenium Tutorial for Beginners | Automation framework Basics
Selenium Tutorial for Beginners | Automation framework BasicsSelenium Tutorial for Beginners | Automation framework Basics
Selenium Tutorial for Beginners | Automation framework BasicsTechcanvass
 

Was ist angesagt? (20)

Integrating SalesforceDX and Test Automation
Integrating SalesforceDX and Test AutomationIntegrating SalesforceDX and Test Automation
Integrating SalesforceDX and Test Automation
 
Realtime selenium interview questions
Realtime selenium interview questionsRealtime selenium interview questions
Realtime selenium interview questions
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven Testing
 
Codeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiCodeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansai
 
Automated tests to a REST API
Automated tests to a REST APIAutomated tests to a REST API
Automated tests to a REST API
 
Keyword-driven Test Automation Framework
Keyword-driven Test Automation FrameworkKeyword-driven Test Automation Framework
Keyword-driven Test Automation Framework
 
Illia Seleznov - Integration tests for Spring Boot application
Illia Seleznov - Integration tests for Spring Boot applicationIllia Seleznov - Integration tests for Spring Boot application
Illia Seleznov - Integration tests for Spring Boot application
 
Speed up your tests
Speed up your testsSpeed up your tests
Speed up your tests
 
"Experiences Of Test Automation At Spotify" with Kristian Karl
"Experiences Of Test Automation At Spotify" with Kristian Karl"Experiences Of Test Automation At Spotify" with Kristian Karl
"Experiences Of Test Automation At Spotify" with Kristian Karl
 
Как не нужно писать Gherkin сценарии
Как не нужно писать Gherkin сценарииКак не нужно писать Gherkin сценарии
Как не нужно писать Gherkin сценарии
 
Integration Testing in Python
Integration Testing in PythonIntegration Testing in Python
Integration Testing in Python
 
Python in Test automation
Python in Test automationPython in Test automation
Python in Test automation
 
Why test automation projects are failing
Why test automation projects are failingWhy test automation projects are failing
Why test automation projects are failing
 
The Fitnesse Fix
The Fitnesse FixThe Fitnesse Fix
The Fitnesse Fix
 
Btd presentation-2011
Btd presentation-2011Btd presentation-2011
Btd presentation-2011
 
Software Automation Testing Introduction
Software Automation Testing IntroductionSoftware Automation Testing Introduction
Software Automation Testing Introduction
 
Unit & integration testing
Unit & integration testingUnit & integration testing
Unit & integration testing
 
PL/SQL unit testing with Ruby
PL/SQL unit testing with RubyPL/SQL unit testing with Ruby
PL/SQL unit testing with Ruby
 
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
Acceptance & Functional Testing with Codeception - SunshinePHP 2016Acceptance & Functional Testing with Codeception - SunshinePHP 2016
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
 
Selenium Tutorial for Beginners | Automation framework Basics
Selenium Tutorial for Beginners | Automation framework BasicsSelenium Tutorial for Beginners | Automation framework Basics
Selenium Tutorial for Beginners | Automation framework Basics
 

Andere mochten auch

ITGM8. Алексей Лянгузов (Grid Dinamics) Как я ходил в стартап и чем это все з...
ITGM8. Алексей Лянгузов (Grid Dinamics) Как я ходил в стартап и чем это все з...ITGM8. Алексей Лянгузов (Grid Dinamics) Как я ходил в стартап и чем это все з...
ITGM8. Алексей Лянгузов (Grid Dinamics) Как я ходил в стартап и чем это все з...SPB SQA Group
 
Domain-тестирование
Domain-тестированиеDomain-тестирование
Domain-тестированиеSPB SQA Group
 
Обсуждаем главы из “97 Things Every Programmer Should Know”
Обсуждаем главы из “97 Things Every Programmer Should Know”Обсуждаем главы из “97 Things Every Programmer Should Know”
Обсуждаем главы из “97 Things Every Programmer Should Know”SPB SQA Group
 
Inleiding Sociaal Wetenschappelijk Onderzoek Sociaal Werk Peter Raymaekers
Inleiding Sociaal Wetenschappelijk Onderzoek Sociaal Werk Peter RaymaekersInleiding Sociaal Wetenschappelijk Onderzoek Sociaal Werk Peter Raymaekers
Inleiding Sociaal Wetenschappelijk Onderzoek Sociaal Werk Peter RaymaekersCVO-SSH
 
How to Assess Integrity Risks for a Company ?
How to Assess Integrity Risks for a Company ?How to Assess Integrity Risks for a Company ?
How to Assess Integrity Risks for a Company ?iohann Le Frapper
 
managing your content
managing your contentmanaging your content
managing your contentSamsung
 
Chapter 13: UK Renewable Energy Policy since Privatization
Chapter 13: UK Renewable Energy Policy since PrivatizationChapter 13: UK Renewable Energy Policy since Privatization
Chapter 13: UK Renewable Energy Policy since PrivatizationElectricidad Verde
 
Projek bmm3103 2012
Projek bmm3103 2012Projek bmm3103 2012
Projek bmm3103 2012Amy Azuha
 
Unc Bedrijfspresentatie 2010
Unc Bedrijfspresentatie 2010Unc Bedrijfspresentatie 2010
Unc Bedrijfspresentatie 2010louisa_stern
 
The wichita anti drunk driving campaign-final version
The wichita anti drunk driving campaign-final versionThe wichita anti drunk driving campaign-final version
The wichita anti drunk driving campaign-final versionWilkes University
 
Trip attraction rates of shopping centers in dhanmondi area of dhaka city final
Trip attraction rates of shopping centers in dhanmondi area of dhaka city finalTrip attraction rates of shopping centers in dhanmondi area of dhaka city final
Trip attraction rates of shopping centers in dhanmondi area of dhaka city finalTeletalk Bangladesh Ltd
 
The Maridien MD with DOR
The Maridien MD with DORThe Maridien MD with DOR
The Maridien MD with DORMarifil Ramirez
 
Shannon Smith Cv 201109
Shannon Smith Cv 201109Shannon Smith Cv 201109
Shannon Smith Cv 201109shagsa
 
Новейший обучающий курс по инвестированию
Новейший обучающий курс по инвестированиюНовейший обучающий курс по инвестированию
Новейший обучающий курс по инвестированиюАльберт Коррч
 
The Online Stoning of MD & GT: Manifestations of Patriarchal Microaggressions...
The Online Stoning of MD & GT: Manifestations of Patriarchal Microaggressions...The Online Stoning of MD & GT: Manifestations of Patriarchal Microaggressions...
The Online Stoning of MD & GT: Manifestations of Patriarchal Microaggressions...fariez
 

Andere mochten auch (20)

ITGM8. Алексей Лянгузов (Grid Dinamics) Как я ходил в стартап и чем это все з...
ITGM8. Алексей Лянгузов (Grid Dinamics) Как я ходил в стартап и чем это все з...ITGM8. Алексей Лянгузов (Grid Dinamics) Как я ходил в стартап и чем это все з...
ITGM8. Алексей Лянгузов (Grid Dinamics) Как я ходил в стартап и чем это все з...
 
Domain-тестирование
Domain-тестированиеDomain-тестирование
Domain-тестирование
 
Обсуждаем главы из “97 Things Every Programmer Should Know”
Обсуждаем главы из “97 Things Every Programmer Should Know”Обсуждаем главы из “97 Things Every Programmer Should Know”
Обсуждаем главы из “97 Things Every Programmer Should Know”
 
Inleiding Sociaal Wetenschappelijk Onderzoek Sociaal Werk Peter Raymaekers
Inleiding Sociaal Wetenschappelijk Onderzoek Sociaal Werk Peter RaymaekersInleiding Sociaal Wetenschappelijk Onderzoek Sociaal Werk Peter Raymaekers
Inleiding Sociaal Wetenschappelijk Onderzoek Sociaal Werk Peter Raymaekers
 
How to Assess Integrity Risks for a Company ?
How to Assess Integrity Risks for a Company ?How to Assess Integrity Risks for a Company ?
How to Assess Integrity Risks for a Company ?
 
managing your content
managing your contentmanaging your content
managing your content
 
Chapter 13: UK Renewable Energy Policy since Privatization
Chapter 13: UK Renewable Energy Policy since PrivatizationChapter 13: UK Renewable Energy Policy since Privatization
Chapter 13: UK Renewable Energy Policy since Privatization
 
Nancy gomez 2
Nancy gomez 2Nancy gomez 2
Nancy gomez 2
 
Introduction to LEAN (handout)
Introduction to LEAN (handout)Introduction to LEAN (handout)
Introduction to LEAN (handout)
 
Introduction in java
Introduction in javaIntroduction in java
Introduction in java
 
Projek bmm3103 2012
Projek bmm3103 2012Projek bmm3103 2012
Projek bmm3103 2012
 
Invasive Species Forum: Resources for Landowners and Stewards
Invasive Species Forum: Resources for Landowners and StewardsInvasive Species Forum: Resources for Landowners and Stewards
Invasive Species Forum: Resources for Landowners and Stewards
 
Desenhos
DesenhosDesenhos
Desenhos
 
Unc Bedrijfspresentatie 2010
Unc Bedrijfspresentatie 2010Unc Bedrijfspresentatie 2010
Unc Bedrijfspresentatie 2010
 
The wichita anti drunk driving campaign-final version
The wichita anti drunk driving campaign-final versionThe wichita anti drunk driving campaign-final version
The wichita anti drunk driving campaign-final version
 
Trip attraction rates of shopping centers in dhanmondi area of dhaka city final
Trip attraction rates of shopping centers in dhanmondi area of dhaka city finalTrip attraction rates of shopping centers in dhanmondi area of dhaka city final
Trip attraction rates of shopping centers in dhanmondi area of dhaka city final
 
The Maridien MD with DOR
The Maridien MD with DORThe Maridien MD with DOR
The Maridien MD with DOR
 
Shannon Smith Cv 201109
Shannon Smith Cv 201109Shannon Smith Cv 201109
Shannon Smith Cv 201109
 
Новейший обучающий курс по инвестированию
Новейший обучающий курс по инвестированиюНовейший обучающий курс по инвестированию
Новейший обучающий курс по инвестированию
 
The Online Stoning of MD & GT: Manifestations of Patriarchal Microaggressions...
The Online Stoning of MD & GT: Manifestations of Patriarchal Microaggressions...The Online Stoning of MD & GT: Manifestations of Patriarchal Microaggressions...
The Online Stoning of MD & GT: Manifestations of Patriarchal Microaggressions...
 

Ähnlich wie ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!

Guide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in KotlinGuide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in KotlinRapidValue
 
E catt tutorial
E catt tutorialE catt tutorial
E catt tutorialNaveen Raj
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Comunidade NetPonto
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Fwdays
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinSigma Software
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'sAntônio Roberto Silva
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slidesDavid Barreto
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power pointjustmeanscsr
 
Automated integration tests for ajax applications (с. карпушин, auriga)
Automated integration tests for ajax applications (с. карпушин, auriga)Automated integration tests for ajax applications (с. карпушин, auriga)
Automated integration tests for ajax applications (с. карпушин, auriga)Mobile Developer Day
 
From System Modeling to Automated System Testing
From System Modeling to Automated System TestingFrom System Modeling to Automated System Testing
From System Modeling to Automated System TestingFlorian Lier
 
Acceptance Testing With Selenium
Acceptance Testing With SeleniumAcceptance Testing With Selenium
Acceptance Testing With Seleniumelliando dias
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web developmentalice yang
 
Appium Automation with Kotlin
Appium Automation with KotlinAppium Automation with Kotlin
Appium Automation with KotlinRapidValue
 
Test Automation Frameworks Final
Test Automation Frameworks   FinalTest Automation Frameworks   Final
Test Automation Frameworks FinalMargaret_Dickman
 
Testing your application on Google App Engine
Testing your application on Google App EngineTesting your application on Google App Engine
Testing your application on Google App EngineInphina Technologies
 
Testing Your Application On Google App Engine
Testing Your Application On Google App EngineTesting Your Application On Google App Engine
Testing Your Application On Google App EngineIndicThreads
 

Ähnlich wie ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that! (20)

Guide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in KotlinGuide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in Kotlin
 
E catt tutorial
E catt tutorialE catt tutorial
E catt tutorial
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita Galkin
 
Gowtham_resume
Gowtham_resumeGowtham_resume
Gowtham_resume
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slides
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Automated integration tests for ajax applications (с. карпушин, auriga)
Automated integration tests for ajax applications (с. карпушин, auriga)Automated integration tests for ajax applications (с. карпушин, auriga)
Automated integration tests for ajax applications (с. карпушин, auriga)
 
About QTP 9.2
About QTP 9.2About QTP 9.2
About QTP 9.2
 
About Qtp_1 92
About Qtp_1 92About Qtp_1 92
About Qtp_1 92
 
About Qtp 92
About Qtp 92About Qtp 92
About Qtp 92
 
From System Modeling to Automated System Testing
From System Modeling to Automated System TestingFrom System Modeling to Automated System Testing
From System Modeling to Automated System Testing
 
Acceptance Testing With Selenium
Acceptance Testing With SeleniumAcceptance Testing With Selenium
Acceptance Testing With Selenium
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web development
 
Appium Automation with Kotlin
Appium Automation with KotlinAppium Automation with Kotlin
Appium Automation with Kotlin
 
Test Automation Frameworks Final
Test Automation Frameworks   FinalTest Automation Frameworks   Final
Test Automation Frameworks Final
 
Testing your application on Google App Engine
Testing your application on Google App EngineTesting your application on Google App Engine
Testing your application on Google App Engine
 
Testing Your Application On Google App Engine
Testing Your Application On Google App EngineTesting Your Application On Google App Engine
Testing Your Application On Google App Engine
 

Mehr von SPB SQA Group

ITGM8. Илья Коробицын (Grid Dinamics) Автоматизатор, копай глубже, копай шире!
ITGM8. Илья Коробицын (Grid Dinamics) Автоматизатор, копай глубже, копай шире!ITGM8. Илья Коробицын (Grid Dinamics) Автоматизатор, копай глубже, копай шире!
ITGM8. Илья Коробицын (Grid Dinamics) Автоматизатор, копай глубже, копай шире!SPB SQA Group
 
ITGM8. Юлия Атлыгина (ALM Works) Инструменты, облегчающее тестирование
ITGM8. Юлия Атлыгина (ALM Works) Инструменты, облегчающее тестированиеITGM8. Юлия Атлыгина (ALM Works) Инструменты, облегчающее тестирование
ITGM8. Юлия Атлыгина (ALM Works) Инструменты, облегчающее тестированиеSPB SQA Group
 
ITGM8. Сергей Атрощенков (Еpam) Buzzword driven development и место тестировщ...
ITGM8. Сергей Атрощенков (Еpam) Buzzword driven development и место тестировщ...ITGM8. Сергей Атрощенков (Еpam) Buzzword driven development и место тестировщ...
ITGM8. Сергей Атрощенков (Еpam) Buzzword driven development и место тестировщ...SPB SQA Group
 
Какая польза от метрик?
Какая польза от метрик?Какая польза от метрик?
Какая польза от метрик?SPB SQA Group
 
Автоматизируем тестирование интерфейса мобильных приложений
Автоматизируем тестирование интерфейса мобильных приложенийАвтоматизируем тестирование интерфейса мобильных приложений
Автоматизируем тестирование интерфейса мобильных приложенийSPB SQA Group
 
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)"Опыт создания системы управления сборкой и тестированием" (слайдкаст)
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)SPB SQA Group
 
"Опыт создания системы управления сборкой и тестированием" (полная)
"Опыт создания системы управления сборкой и тестированием" (полная)"Опыт создания системы управления сборкой и тестированием" (полная)
"Опыт создания системы управления сборкой и тестированием" (полная)SPB SQA Group
 
Нагрузочное тестирование
Нагрузочное тестированиеНагрузочное тестирование
Нагрузочное тестированиеSPB SQA Group
 
Долой отмазки в тестировании!
Долой отмазки в тестировании!Долой отмазки в тестировании!
Долой отмазки в тестировании!SPB SQA Group
 
Вместе весело шагать, или как собрать тестировщиков в своем городе
Вместе весело шагать, или как собрать тестировщиков в своем городеВместе весело шагать, или как собрать тестировщиков в своем городе
Вместе весело шагать, или как собрать тестировщиков в своем городеSPB SQA Group
 
Automating JFC UI application testing with Jemmy
Automating JFC UI application testing with JemmyAutomating JFC UI application testing with Jemmy
Automating JFC UI application testing with JemmySPB SQA Group
 
Оптимизация интерактивного тестирования с использованием метрики Покрытие кода
Оптимизация интерактивного тестирования с использованием метрики Покрытие кодаОптимизация интерактивного тестирования с использованием метрики Покрытие кода
Оптимизация интерактивного тестирования с использованием метрики Покрытие кодаSPB SQA Group
 

Mehr von SPB SQA Group (13)

ITGM8. Илья Коробицын (Grid Dinamics) Автоматизатор, копай глубже, копай шире!
ITGM8. Илья Коробицын (Grid Dinamics) Автоматизатор, копай глубже, копай шире!ITGM8. Илья Коробицын (Grid Dinamics) Автоматизатор, копай глубже, копай шире!
ITGM8. Илья Коробицын (Grid Dinamics) Автоматизатор, копай глубже, копай шире!
 
ITGM8. Юлия Атлыгина (ALM Works) Инструменты, облегчающее тестирование
ITGM8. Юлия Атлыгина (ALM Works) Инструменты, облегчающее тестированиеITGM8. Юлия Атлыгина (ALM Works) Инструменты, облегчающее тестирование
ITGM8. Юлия Атлыгина (ALM Works) Инструменты, облегчающее тестирование
 
ITGM8. Сергей Атрощенков (Еpam) Buzzword driven development и место тестировщ...
ITGM8. Сергей Атрощенков (Еpam) Buzzword driven development и место тестировщ...ITGM8. Сергей Атрощенков (Еpam) Buzzword driven development и место тестировщ...
ITGM8. Сергей Атрощенков (Еpam) Buzzword driven development и место тестировщ...
 
Agile testing
Agile testingAgile testing
Agile testing
 
Какая польза от метрик?
Какая польза от метрик?Какая польза от метрик?
Какая польза от метрик?
 
Автоматизируем тестирование интерфейса мобильных приложений
Автоматизируем тестирование интерфейса мобильных приложенийАвтоматизируем тестирование интерфейса мобильных приложений
Автоматизируем тестирование интерфейса мобильных приложений
 
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)"Опыт создания системы управления сборкой и тестированием" (слайдкаст)
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)
 
"Опыт создания системы управления сборкой и тестированием" (полная)
"Опыт создания системы управления сборкой и тестированием" (полная)"Опыт создания системы управления сборкой и тестированием" (полная)
"Опыт создания системы управления сборкой и тестированием" (полная)
 
Нагрузочное тестирование
Нагрузочное тестированиеНагрузочное тестирование
Нагрузочное тестирование
 
Долой отмазки в тестировании!
Долой отмазки в тестировании!Долой отмазки в тестировании!
Долой отмазки в тестировании!
 
Вместе весело шагать, или как собрать тестировщиков в своем городе
Вместе весело шагать, или как собрать тестировщиков в своем городеВместе весело шагать, или как собрать тестировщиков в своем городе
Вместе весело шагать, или как собрать тестировщиков в своем городе
 
Automating JFC UI application testing with Jemmy
Automating JFC UI application testing with JemmyAutomating JFC UI application testing with Jemmy
Automating JFC UI application testing with Jemmy
 
Оптимизация интерактивного тестирования с использованием метрики Покрытие кода
Оптимизация интерактивного тестирования с использованием метрики Покрытие кодаОптимизация интерактивного тестирования с использованием метрики Покрытие кода
Оптимизация интерактивного тестирования с использованием метрики Покрытие кода
 

Kürzlich hochgeladen

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profileakrivarotava
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Anthony Dahanne
 

Kürzlich hochgeladen (20)

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profile
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024
 

ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!

  • 1. Scalable eCommerce Platform Solutions Component tests. Let’s do that! IT Global MeetUp Saint-Petersburg, 23 July, 2016
  • 2. Scalable eCommerce Platform Solutions • Test Levels • Component tests: howTo(Back end perspective) • Component tests vs Integration tests • Skills you need • Component tests: howTo(Front end perspective) The goals of today’s talk 2
  • 3. Scalable eCommerce Platform Solutions ● Unit Tests ● Component Tests ● System Tests Test levels 3
  • 4. Scalable eCommerce Platform Solutions Picture of the app architecture SUT 4
  • 5. Scalable eCommerce Platform Solutions Main flow { name: “pikachu”, age:10, Id: 0, externalId: null } BE 5
  • 6. Scalable eCommerce Platform Solutions Main flow BE { name: “pikachu”, age:10, Id: 0, externalId: superCat1 } External Service 6
  • 7. Scalable eCommerce Platform Solutions Main flow 7
  • 8. Scalable eCommerce Platform Solutions Main flow 8
  • 9. Scalable eCommerce Platform Solutions @Test @DataProvider("cats") public void responseContainsExtId(String catJson) { Response response = restClient.post().content(catJson).thenReturn(); assertNotNull(response.body().jsonPath("externalId")); } Integration(system) tests 9
  • 10. Scalable eCommerce Platform Solutions @Test @DataProvider("cats") public void responseContainsExtId(String catJson) { Response response = restClient.post().content(catJson).thenReturn(); assertNotNull(response.body().jsonPath("externalId")) } Component tests 10
  • 11. Scalable eCommerce Platform Solutions @Autowired RestClient restClient; In Spring Context: <beans profile = "system-tests"> <bean id = "restClient" class = "com.blah.blah.RestClient"> <beans profile = "component-tests"> <bean id = "restClient" class = "com.our.cool.DirectInvocationRestClient"> But! 11
  • 12. Scalable eCommerce Platform Solutions • Implement own dispatcher (RestEasy could be used) • Set controllers from BE code to ResourceFactory of the Dispatcher DirectInvocationRestClient 12
  • 13. Scalable eCommerce Platform Solutions DirectInvocationRestClient 13 Dispatcher dispatcher = MockDispatcherFactory.createDispatcher(); dispatcher.getRegistry().addResourceFactory( new SingletonResource(catsController)); @Path("/") @Produces(MediaType.APPLICATION_JSON) public class CatsController { @POST @Path("/saveMyCat") public CatDTO saveMyCat() { //doSmth return cat; } }
  • 14. Scalable eCommerce Platform Solutions • Set up in-memory DB • Create mock for the external service • Prepare spring context for easy-run all of this Finally: Tell developers how to use that =) What else we need 14 Allows to run fast and debug
  • 15. Scalable eCommerce Platform Solutions Component tests vs Integration tests Component tests Integration(System) tests Speed 3 2 Business logic coverage 3 3 Debug availability 3 1 Deploy/Environment coverage 1 3 Environment dependence 3 1 15
  • 16. Scalable eCommerce Platform Solutions @Component({ templateUrl: 'app/components/cat/cat.component.html', styleUrls: ['app/components/cat/cat.component.css'], directives: [ROUTER_DIRECTIVES] }) export class CatComponent {} Component tests on FE 16
  • 17. Scalable eCommerce Platform Solutions describe('Add cat', () => { beforeEachProviders(() => [ provide(CatService, {useClass: MockCatService}), //Set up variables you need in mock here ]); Component tests on FE 17
  • 18. Scalable eCommerce Platform Solutions it('Should save cat with received external ID', injectAsync([TestComponentBuilder], (tcb) => { return tcb.createAsync(CatComponent).then((fixture) => { fixture.detectChanges(); var form = fixture.debugElement.nativeElement; updated.querySelector('input').setAttribute('CatName'); form.querySelector('send-button').click(); form.detectChanges(); expect(form.querySelector("cats-list").contains('superCat1'); }); })); }); Component tests on FE 18
  • 19. Scalable eCommerce Platform Solutions Mocked BE 19 import * as express from 'express'; const app = express(); import * as bodyParser from 'body-parser'; import {OnInit} from "../../../build/lib/@angular/core/esm/src/metadata/lifecycle_hooks"; class MockCatService implements OnInit { ngOnInit() { app.use(bodyParser.urlencoded({extended: true})); app.use(bodyParser.json()); const port:number = process.env.PORT || 8080; const router = express.Router(); router.post('/saveMyCat', function (req, res) { res.json(req.json.externalId("superCat1")); }); app.use('/api', router); app.listen(port); } }
  • 20. Scalable eCommerce Platform Solutions BE component tests require: Java core; Spring(or any DI framework); Maven(or any build tool); HSQLDB(or any db) + additional: TestNG, Allure, RestEasy and others… FE component tests require: TypeScript; Angular2; gulp; Express + additional: Jasmine; Karma and others Skills you need(example) 20
  • 21. Scalable eCommerce Platform Solutions Some theory: http://qala.io/blog/holes-in-test-terminology.html http://istqbexamcertification.com/what-are-software-testing-levels/ Theory+examples: http://qala.io/blog/test-pyramid.html Angular2 unit & component tests: https://www.youtube.com/watch?v=C0F2E-PRm44 Useful links 21
  • 22. Scalable eCommerce Platform Solutions Thank you! Email: vsevolod.brekelov@gmail.com Github: https://github.com/volekerb 22

Hinweis der Redaktion

  1. BE logic with DB and external services and FE
  2. Going to discuss approach for testing functionality in the most interesting points for us: functionality. Let’s say we have unit tests. What’s next? Let’s compare two approaches: creation integration tests(like system ones) and component.
  3. Going to discuss approach for testing functionality in the most interesting points for us: functionality. Let’s say we have unit tests. What’s next? Let’s compare two approaches: creation integration tests(like system ones) and component.
  4. Going to discuss approach for testing functionality in the most interesting points for us: functionality. Let’s say we have unit tests. What’s next? Let’s compare two approaches: creation integration tests(like system ones) and component.
  5. Going to discuss approach for testing functionality in the most interesting points for us: functionality. Let’s say we have unit tests. What’s next? Let’s compare two approaches: creation integration tests(like system ones) and component.
  6. Going to discuss approach for testing functionality in the most interesting points for us: functionality. Let’s say we have unit tests. What’s next? Let’s compare two approaches: creation integration tests(like system ones) and component.