codecept.js introduce - front end test E2E tool introduce

Post on 13-Jan-2017

386 views 2 download

transcript

E2E tool introduce@Caesar

Caesar Chi

clonncd

Caesar Chi 2.0

clonncd

Do you have e2e test?

Maybe QA team in E2E?

How many resource do you have?

Test UI by yourself. Stand out DRY principle

There are so many UI auto test tool.

that sounds great, lets code for e2e test

But e2e test so hard

Less

• hard to code

• assertion is bad

• have to know deeply flow control

• big gap for newbie

Protractor

Protractor

Go to target Url

Protractor

An assertion

Protractor

Selector and do something

Protractor

Another assertion

Protractor

Another assertion

What the …

E2E codecept.io

http://codecept.io/

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

codecept.js• Synchronous Tests API

• user's perspective

• Backend agnostic

• PageObjects supported

• Written in ES6 without transpilers.

codecept.js

codecept.jsHelper

Codecept.js VS …

VS

• sss

VS

• sss

VS

• sssss

Codecept.js example

codecept.js

codecept.js

Go to target Url

codecept.js

An assertion

codecept.js

Selector and do something

codecept.js

Another assertion

codecept.js

Another assertion

Codecept.js install

Codecept.jsnpm install -g codeceptjs

npm install -g webdriver-manager

And

And

npm install -g webdriverio

Codecept.js up & run

Codecept.js $ codeceptjs init

Generate a config of codecept.js

Codecept.js $ codeceptjs gt

Generate a basic test.js of codecept.js

Codecept.js

Edit basic_test.js file content

Codecept.js $ codeceptjs run

Runs codecept.js test

sssss

Codecept.js locator

I.amOnPage

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

I.fillField

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

I.click

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

I.checkOption

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

I.selectOption

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

I.acceptPopup I.cancelPopup

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

Codecept.js assertion

I.see

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

I.seeElement

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

I.seeInTitle

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

Codecept.js helper

I.saveScreenshot

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

I.resizeWindow

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

I.acceptPopup I.can cancelPopup

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

Codecept.js comprare

codecept.io

Protractor

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

• Not another test framework

• Make people easy to use

• Make people easy to read

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 …

Life is short Test is needs

https://leanpub.com/frontend_e2e_test_guidebook