+ All Categories
Home > Technology > Selenium With Spices

Selenium With Spices

Date post: 13-Feb-2017
Category:
Upload: nikolajs-okunevs
View: 417 times
Download: 0 times
Share this document with a friend
53
1
Transcript
Page 1: Selenium With Spices

1

Page 2: Selenium With Spices

2

GRAPHWALKER

ALLURE

BROWSERMOB PROXY

Page 3: Selenium With Spices

3

Application we will play with

https://github.com/SpringSource/spring-

petclinic.git

Page 4: Selenium With Spices

4

SelenideSelenium Wrapper

SALT ENHANCES FLAVOR OF FOOD..

Page 5: Selenium With Spices

5

Selenide – PROs

Easy to start

Concise API for tests

Ajax support

Turnkey Solution

Timesaver

Page 6: Selenium With Spices

6

Browser opening

WebDriver driver = new FirefoxDriver();

driver.get("http://localhost:9966/petclinic/");

SELENIDE

SELENIUM

open("http://localhost:9966/petclinic/");

Page 7: Selenium With Spices

7

Browser closing after tests

if (driver != null) {

driver.close();

}

SELENIDE

SELENIUM

// Do not care! Selenide closes the browser automatically.

Page 8: Selenium With Spices

8

Find element by id

WebElement customer = driver.findElement(By.id("customerContainer"));

SELENIDE

SELENIUM

WebElement customer = $("#customerContainer"); or a longer conservative option:WebElement customer = $(By.id("customerContainer"));

Page 9: Selenium With Spices

9

Assert that element has a correct text

assertEquals("Customer profile", driver.findElement(

By.id("customerContainer")).getText());

SELENIDE

SELENIUM

$("#customerContainer").shouldHave(text("Customer profile"));

Page 10: Selenium With Spices

10

Assert that element does not exist

try { WebElement element = driver.findElement(By.id("customerContainer")); fail("Element should not exist: " + element);

} catch (WebDriverException itsOk) {}

SELENIDE

SELENIUM

$("#customerContainer").shouldNot(exist);

Page 11: Selenium With Spices

11

Find element by text

WebElement customer = $(byText("Customer profile"));

No way (except XPath)

SELENIDE

SELENIUM

Page 12: Selenium With Spices

12

Result – more compact tests

Page 13: Selenium With Spices

13

Selenide - Side Effects

• Tests become slower

• Wrapper doesn’t wraps anything!

– Sometimes had to create wrapper over wrapper

Page 14: Selenium With Spices

14

Allure – reporting framework

An open-source framework designed to createtest execution reports clear to everyone in theteam.

AllureReporting Framework

Page 15: Selenium With Spices

15

Allure – reporting framework

“An open-source framework designed to create test execution reports clear to everyone in the team”

Page 16: Selenium With Spices

16

Problem 1

How the automated tests matched to user behavior (or manual test cases)?

Page 17: Selenium With Spices

17

Solution – step annotation

• What needs to be done:– Add @Step annotation for needed methods

Page 18: Selenium With Spices

18

What is covered by automated tests and what are the pain areas?

Problem 2

Page 19: Selenium With Spices

19

Solution – feature, story annotation

• What needs to be done:– Add @Feature/@Story annotation for needed classes

Page 20: Selenium With Spices

20

What are the failure reasons of my automated tests?

Problem 3

Page 21: Selenium With Spices

21

Solution – Failed/Broken statuses

• What needs to be done:– Use default Junit, TestNG status codes

Page 22: Selenium With Spices

22

Result – good reports, that meet basic Team needs

Page 23: Selenium With Spices

23

BrowserMob ProxyPerformance Utility

Page 24: Selenium With Spices

24

Performance metrics

How to get performance metrics?

Page 25: Selenium With Spices

25

Method 1

Own Timings

Page 26: Selenium With Spices

26

Method 2

Own Timings

Web Timings

Page 27: Selenium With Spices

27

Method 3

Own Timings

Web Timings

Browser plugins

Page 28: Selenium With Spices

28

Method 4

Own Timings

Web Timings

Browser plugins

Using proxy

Page 29: Selenium With Spices

29

BrowserMob Proxy

Is an utility that makes it easy to capture

performance data from browsers, typically written

using automation toolkits such as Selenium

Page 30: Selenium With Spices

30

Additional features

• Assert the HTTP status code

• Block third-party resources that are slow to load

• Capture HTTP archive (HAR file)– Then convert it to a JMeter jmx file

Page 31: Selenium With Spices

31

BrowserMob Proxy – How to use?

Add dependency

Page 32: Selenium With Spices

32

BrowserMob Proxy – How to use?

Add dependency

Start local proxy server

Use proxy with browser

Page 33: Selenium With Spices

33

BrowserMob Proxy – How to use?

Add dependency

Start local proxy server

Use proxy with browser

Get data from proxy server

Page 34: Selenium With Spices

34

HAR file

Page 35: Selenium With Spices

35

SikuliImage based automation

Page 36: Selenium With Spices

36

Sikuli – image recognition tool

Operates with images

Page 37: Selenium With Spices

37

Sikuli – image recognition tool

Operates with images

Lets you automate anything that is displayed on the screen

Page 38: Selenium With Spices

38

Sikuli – image recognition tool

Operates with images

Lets you automate anything that is displayed on the screen

No need to have access to application structure

Page 39: Selenium With Spices

39

Sikuli – image recognition tool

Operates with images

Lets you automate anything that is displayed on the screen

No need to have access to application structure

Cross-platform

Page 40: Selenium With Spices

40

Sikuli – image recognition tool

Operates with images

Lets you automate anything that is displayed on the screen

No need to have access to application structure

Cross-platform

Open-source

Page 41: Selenium With Spices

41

Sikuli – image recognition tool

Operates with images

Lets you automate anything that is displayed on the screen

No need to have access to application structure

Cross-platform

Open-source

Provides libraries for test creation in Java

Page 42: Selenium With Spices

42

Sikuli – Google Maps Example

Page 43: Selenium With Spices

43

GraphwalkerModel based testing tool

Page 44: Selenium With Spices

44

Graphwalker - what is this?

Model Based

Build in Java

Reads models in the shape of finite-state diagrams, or graphs,

and generate tests from the models

Modeling syntax is very simple

Comes from Spotify test automation

Page 45: Selenium With Spices

45

Graphwalker – how model works?

The purpose of the test design is to describe the expected behavior of

the system under test.

Page 46: Selenium With Spices

46

Graphwalker – how model works?

The purpose of the test design is to describe the expected behavior of

the system under test.

Vertex

A vertex represents an expected state that we want to

examine.

Page 47: Selenium With Spices

47

Graphwalker – how model works?

The purpose of the test design is to describe the expected behavior of

the system under test.

Vertex

A vertex represents an expected state that we want to

examine.

Edge

Represents the transition from one

vertex to another.

Page 48: Selenium With Spices

48

Graphwalker - workflow

Create Graph model

http://www.yworks.com/en/products/yfiles/yed/

Page 49: Selenium With Spices

49

Graphwalker - Workflow

Create Graph model

Generate test sequences

Page 50: Selenium With Spices

50

Graphwalker - Workflow

Create Graph model

Generate test sequences

Generate Java sources

Page 51: Selenium With Spices

51

Graphwalker - Workflow

Create Graph model

Generate test sequences

Generate Java sources

Implement interfaces

Page 52: Selenium With Spices

52

Graphwalker - Workflow

Create Graph model

Generate test sequences

Generate Java sources

Implement interfaces

Running test

Page 53: Selenium With Spices

53


Recommended