codecept.js introduce - front end test e2e tool introduce

67
E2E tool introduce @Caesar

Upload: caesar-chi

Post on 13-Jan-2017

390 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: codecept.js introduce - front end test E2E tool introduce

E2E tool introduce@Caesar

Page 2: codecept.js introduce - front end test E2E tool introduce

Caesar Chi

clonncd

Page 3: codecept.js introduce - front end test E2E tool introduce

Caesar Chi 2.0

clonncd

Page 4: codecept.js introduce - front end test E2E tool introduce

Do you have e2e test?

Page 5: codecept.js introduce - front end test E2E tool introduce
Page 6: codecept.js introduce - front end test E2E tool introduce
Page 7: codecept.js introduce - front end test E2E tool introduce

Maybe QA team in E2E?

Page 8: codecept.js introduce - front end test E2E tool introduce

How many resource do you have?

Page 9: codecept.js introduce - front end test E2E tool introduce

Test UI by yourself. Stand out DRY principle

Page 10: codecept.js introduce - front end test E2E tool introduce

There are so many UI auto test tool.

Page 11: codecept.js introduce - front end test E2E tool introduce
Page 12: codecept.js introduce - front end test E2E tool introduce
Page 13: codecept.js introduce - front end test E2E tool introduce

that sounds great, lets code for e2e test

Page 14: codecept.js introduce - front end test E2E tool introduce

But e2e test so hard

Page 15: codecept.js introduce - front end test E2E tool introduce

Less

• hard to code

• assertion is bad

• have to know deeply flow control

• big gap for newbie

Page 16: codecept.js introduce - front end test E2E tool introduce

Protractor

Page 17: codecept.js introduce - front end test E2E tool introduce

Protractor

Go to target Url

Page 18: codecept.js introduce - front end test E2E tool introduce

Protractor

An assertion

Page 19: codecept.js introduce - front end test E2E tool introduce

Protractor

Selector and do something

Page 20: codecept.js introduce - front end test E2E tool introduce

Protractor

Another assertion

Page 21: codecept.js introduce - front end test E2E tool introduce

Protractor

Another assertion

What the …

Page 22: codecept.js introduce - front end test E2E tool introduce

E2E codecept.io

Page 23: codecept.js introduce - front end test E2E tool introduce

http://codecept.io/

Page 24: codecept.js introduce - front end test E2E tool introduce

codecept.js

• Every command is described as an action of a user visiting a site.

• CodeceptJS provides a general high-level API which can easily be executed

• Control browser in realtime with API of CodeceptJS

Page 25: codecept.js introduce - front end test E2E tool introduce

codecept.js• Synchronous Tests API

• user's perspective

• Backend agnostic

• PageObjects supported

• Written in ES6 without transpilers.

Page 26: codecept.js introduce - front end test E2E tool introduce

codecept.js

Page 27: codecept.js introduce - front end test E2E tool introduce

codecept.jsHelper

Page 28: codecept.js introduce - front end test E2E tool introduce

Codecept.js VS …

Page 29: codecept.js introduce - front end test E2E tool introduce

VS

• sss

Page 30: codecept.js introduce - front end test E2E tool introduce

VS

• sss

Page 31: codecept.js introduce - front end test E2E tool introduce

VS

• sssss

Page 32: codecept.js introduce - front end test E2E tool introduce

Codecept.js example

Page 33: codecept.js introduce - front end test E2E tool introduce

codecept.js

Page 34: codecept.js introduce - front end test E2E tool introduce

codecept.js

Go to target Url

Page 35: codecept.js introduce - front end test E2E tool introduce

codecept.js

An assertion

Page 36: codecept.js introduce - front end test E2E tool introduce

codecept.js

Selector and do something

Page 37: codecept.js introduce - front end test E2E tool introduce

codecept.js

Another assertion

Page 38: codecept.js introduce - front end test E2E tool introduce

codecept.js

Another assertion

Page 39: codecept.js introduce - front end test E2E tool introduce

Codecept.js install

Page 40: codecept.js introduce - front end test E2E tool introduce

Codecept.jsnpm install -g codeceptjs

npm install -g webdriver-manager

And

And

npm install -g webdriverio

Page 41: codecept.js introduce - front end test E2E tool introduce

Codecept.js up & run

Page 42: codecept.js introduce - front end test E2E tool introduce

Codecept.js $ codeceptjs init

Generate a config of codecept.js

Page 43: codecept.js introduce - front end test E2E tool introduce

Codecept.js $ codeceptjs gt

Generate a basic test.js of codecept.js

Page 44: codecept.js introduce - front end test E2E tool introduce

Codecept.js

Edit basic_test.js file content

Page 45: codecept.js introduce - front end test E2E tool introduce

Codecept.js $ codeceptjs run

Runs codecept.js test

Page 46: codecept.js introduce - front end test E2E tool introduce

sssss

Page 47: codecept.js introduce - front end test E2E tool introduce

Codecept.js locator

Page 48: codecept.js introduce - front end test E2E tool introduce

I.amOnPage

http://codecept.io/helpers/WebDriverIO/#amonpage

Page 49: codecept.js introduce - front end test E2E tool introduce

I.fillField

http://codecept.io/helpers/WebDriverIO/#fillfield

Page 50: codecept.js introduce - front end test E2E tool introduce

I.click

http://codecept.io/helpers/WebDriverIO/#fillfield

Page 51: codecept.js introduce - front end test E2E tool introduce

I.checkOption

http://codecept.io/helpers/WebDriverIO/#checkoption

Page 52: codecept.js introduce - front end test E2E tool introduce

I.selectOption

http://codecept.io/helpers/WebDriverIO/#selectoption

Page 53: codecept.js introduce - front end test E2E tool introduce

I.acceptPopup I.cancelPopup

http://codecept.io/helpers/WebDriverIO/#acceptpopup

Page 54: codecept.js introduce - front end test E2E tool introduce

Codecept.js assertion

Page 55: codecept.js introduce - front end test E2E tool introduce

I.see

http://codecept.io/helpers/WebDriverIO/#see

Page 56: codecept.js introduce - front end test E2E tool introduce

I.seeElement

http://codecept.io/helpers/WebDriverIO/#seeelement

Page 57: codecept.js introduce - front end test E2E tool introduce

I.seeInTitle

http://codecept.io/helpers/Protractor/#seeintitle

Page 58: codecept.js introduce - front end test E2E tool introduce

Codecept.js helper

Page 59: codecept.js introduce - front end test E2E tool introduce

I.saveScreenshot

http://codecept.io/helpers/Protractor/#savescreenshot

Page 60: codecept.js introduce - front end test E2E tool introduce

I.resizeWindow

http://codecept.io/helpers/Protractor/#resizewindow

Page 61: codecept.js introduce - front end test E2E tool introduce

I.acceptPopup I.can cancelPopup

http://codecept.io/helpers/WebDriverIO/#acceptpopup

Page 62: codecept.js introduce - front end test E2E tool introduce
Page 63: codecept.js introduce - front end test E2E tool introduce

Codecept.js comprare

Page 64: codecept.js introduce - front end test E2E tool introduce

codecept.io

Protractor

Page 65: codecept.js introduce - front end test E2E tool introduce

Codecept.js recap• Support popular test framework (mostly)

• Not another test framework

• Make people easy to use

• Make people easy to read

Page 66: codecept.js introduce - front end test E2E tool introduce

Codecept.js recap• Support popular test framework (mostly)

• Not another test framework

• Make people easy to use

• Make people easy to read

• But have to know …

Page 67: codecept.js introduce - front end test E2E tool introduce

Life is short Test is needs

https://leanpub.com/frontend_e2e_test_guidebook