FEEL THE
POWER OF THE
JDI
LIGHT
JDI
LIGHT
22 MARCH 2019
•
JDI Evangelist
•
Almost 14 years in Testing
•
More than 12 years in Test Automation
ROMAN IOVLEV
Chief QA Automation
roman.Iovlev
roman.Iovlev.jdi@gmail.com
2
http://roman-iovlev.info/
JDI FRAMEWORK
JDI
L
i
g
h
t
•
Simple to use test Automation Framework
•
Based on UI Elements (Buttons, Forms etc.)
•
Fast and stable tests execution
•
User friendly logs and reports with no effort
[since
2015]
JDN
•
Simple and modern
Page Objects Generator
JDI Dark
•
Web Services testing Framework
powered by Rest Assured
3
JDI Mobile
•
UI Test Framework for Mobile
JDI Desktop
•
UI Test Framework for Desktop
PAGE OBJECTS
4
Header
Main Section
Menu
Odd Radio buttons
Weather Multiselect
Name Textfield
Passport checkbox
Description textarea
Composite
Complex
Simple
UI PAGE OBJECTS
@JSite
(
“https://epam.github.io/JDI/ "
)
public class
EpamSite
{
@Url
(
"/index.html”
)
public
static
HomePage
homepage
;
public
static
ContactPage
contactPage
;
}
@Url
(
"/contact/%s”
)
@Title
(
“Contact Form"
)
public class
ContactPage
extends
WebPage
{
@FindBy
(id=
“#Name”
) public
TextField
name
;
@Css
(
“#LastName”
) public
TextField
lastName
;
@UI
(
“[‘Submit’]”
) public
Button
submit
;
}
@BeforeSuite
(alwaysRun = true)
public static void setUp() {
initElements
(
EpamGithubSite
.class);
}
open()
back()/ forward()
refresh()/ reload()
clearCache()/ addCookie()
String getHtml()
zoom(double factor)
5
UI ELEMENTS
6
public class LoginForm extends Form<User> {
TextField
login, password;
Button
enter;
}
@FindBy
(id =
“jdi-logo”
)
public static
Image
jdiLogo;
@Css
(
“#colors”
) public
Dropdown
colors
@XPath
(
“//*[@id=‘nav’][text=‘%s’]”
)
public
Menu
navigation;
@UI
(
“#nav[‘%s’]”
) public
Menu
navigation;
HTML ELEMENTS
•
HTML elements pack
•
Bootstrap elements
•
Angular collections
•
React collections
•
Vue collections
•
Telerik (KendoUI)
https://epam.github.io/JDI/html5.html
7
LIST OF SECTIONS
8
List<Section> = Elements in JDI
T
get
(String name/int index)
MapArray<String, T>
getMap
()
List<E>
asData
(Class<E> entityClass)
−
Get Section by name/index
−
Get all elements as Map
−
Get All elements as List of Sections
public class
SearchResult
extends Section {
@Title
public
WebElement
label
;
public
WebElement
link
;
public
WebElement
description
;
…
}
8
LIST OF SECTIONS EXAMPLES
@UI
(
“.g”
) List<
SearchResult
>
results
;
Assert.assertContains(
results
.get(5).
description
.getText(),
“JDI some text”
);
results
.get(
“EPAM JDI”
).
link
.click();
results
.assertThat().
value
(expetedValue);
results
.assertThat().
any
(e -> e.
name
.toLowerCase().contains(
“epam jdi"
));
results
.assertThat().
each
(e -> e.
name
.toLowerCase().contains(
"jdi"
))
|| e.
description
.contains(
“jdi"
));
results
.assertThat().
onlyOne
(e -> e.
name
.contains(
"EPAM JDI"
));
results
.assertThat().
noOne
(e -> e.
name
.contains(
"SELENIDE"
));
9
ELEMENT ASSERTS
redButton
.assertThat().text(
is
(
“Submit”
));
notification
.is().displayed();
teaser
.assertThat().text(
containsString
(
“JDI is Awesome"
))
.cssClass(
is
(
“jdi-teaser"
)).attr(
"type"
,
is
(
“submit"
));
results
.is().notEmpty();
results
.assertThat().values(
hasItem
(
“JDI"
));
Powered by Hamcrest
No more waits!
Compare to Selenide and Selenium asserts
10
NO PAGE OBJECTS STYLE
@Test
public void nonPageObjectTest() {
WebPage
.
openUrl(
"https://epam.github.io/JDI/index.html"
)
;
$
(
"img#user-icon"
).
click()
;
$
(
"form #name"
).
input(
"epam"
)
;
$
(
"form #password"
).
input(
"1234"
)
;
$
(
"form [type=submit]"
).
click()
;
Assert.assertEquals(
WebPage
.
getUrl()
,
"https://epam.github.io/JDI/index.html"
);
}
11
REDUCE AMOUNT OF
CODE IN 5-30 TIMES
1