SlideShare a Scribd company logo
JAVA EDGE IN
TEST AUTOMATION
28 MAY 2017
2CONFIDENTIAL
Chief QA Automation
More than 12 years in testing
About 10 in test automation
ROMAN IOVLEV
3CONFIDENTIAL
• Java 8
• Lambdas
• Declarative programming
• Examples
• Interfaces
• Data with Lombok
• Java 9 expectations
TOPICS
4CONFIDENTIAL
• “How does Java 8 exert hidden power on Test
Automation?” (https://goo.gl/uT4XfN)
• “Test UI with JDI: easy, simple and good”
(http://goo.gl/Mwta77, https://goo.gl/1kxZS2)
• “Java Tip of the Week #1 – Lombok”
(https://goo.gl/Toxyeh)
INSPIRED WITH
JAVA 8
5
λ
6CONFIDENTIAL
public Function<Integer, String> toStr = i -> i.toString();
public void print(int num, Function<Integer, String> func) {
func.apply(num);
}
print(22, i -> (i / 10)+”decades”);
print(3, toStr);
print(-30, i -> { if (i >0) return i.toString();
return –i; } );
FUNCTION AS VARIABLE
7CONFIDENTIAL
{3, 1, 4, 5, 2, 8, 10, 12, 0, 4, 2, 1, 10, -1}
STREAM
• Even numbers > 3
• Only unique values
• Sorted by Ascending
• Cut 2 lowest and highest values
• Wrap rest of numbers with “( n )”
• And print
“(8)(10)”
8CONFIDENTIAL
//32 strings
public String printResultsJava7(Integer[] strings) {
// Filter
List<Integer> filtered = new ArrayList<>();
for (int s : strings)
if (s > 3 && s % 2 == 0)
filtered.add(s);
//Distinct
List<Integer> distinct = new ArrayList<>();
for (int s : filtered)
if (!distinct.contains(s))
distinct.add(s);
// Sort
Object[] sortedArray = distinct.toArray();
Arrays.sort(sortedArray);
// Trim
List<Integer> trimBounds = new ArrayList<>();
for (int i = 0; i < sortedArray.length; i++)
if (i > 0 || i < sortedArray.length)
trimBounds.add((int)sortedArray[i]);
// Map
List<String> print = new ArrayList<>();
for (int s : trimBounds)
print.add("(" + s + ")");
// Reduce
String result = "";
for (String s : print)
result += s + ";";
return result;
}
JAVA 7
// 6 strings
public String printResultsJava7(Integer[] strings) {
List<Integer> filtered = filter(strings);
List<Integer> distinct = distinct(filtered);
Integer[] sortedArray = sort(distinct);
List<Integer> trimBounds = trim(sortedArray);
List<String> print = print(trimBounds);
return reduce(print);
}
9CONFIDENTIAL
public String Filter(Integer[] strings) {
return stream(strings)
.filter(el -> el > 3 && el % 2 == 0)
.distinct()
.sorted()
.skip(1).limit(1)
.map(el -> "(" + el + ")")
.reduce((str, el) -> el + ";").get();
}
JAVA 8
10CONFIDENTIAL
DECLARATIVE PROGRAMMING
EXAMPLES
11
λ
https://github.com/epam/JDI
12CONFIDENTIAL
public String getMessage(int httpStatus) {
switch(httpStatus) {
case 404:
return “Page not found”;
case 500:
return “Internal Server error”;
default:
return “Unknown status code”;
}
}
SWITCH
13CONFIDENTIAL
public WebElement getVisibleElement(By locator) {
List<WebElement> elements = driver.findElements(locator);
switch(elements) {
case elements.size() == 1 && elements.get(0).isDisplayed():
return elements.get(0),
case elements.size() > 0:
throw new RuntimeException(
format("Find %s elements instead of 1", els.size()));
default:
throw new RuntimeException("Visible elements not found")
); }
SWITCH IMPOSSIBLE
14CONFIDENTIAL
public WebElement getVisibleElement(By locator) {
List<WebElement> elements = driver.findElements(locator);
return Match(elements).of(
Case(els -> els.size() == 1 && els.get(0).isDisplayed(),
els -> els.get(0)),
Case(els -> els.size() > 0,
els -> { throw new RuntimeException(
format("Find %s elements instead of 1", els.size())); }),
Case($(),
() -> { throw new RuntimeException("Visible elements not found") })
); }
JAVASLANG
15CONFIDENTIAL
• Option.of(null) name.toString()
• Try.of(() – 1/0)
• Tuple(“String”, 1, new MyClass())
• Collections,
• Validate
• Functions etc…
JAVASLANG
http://www.baeldung.com/javaslang
16CONFIDENTIAL
PRECONDITIONS
public enum Preconditions implements IPreconditions {
LOGGED_IN(() -> loggedIn(),
() -> { loginPage.open();
loginForm.login(); }),
CAREERS_PAGE("/careers");
….
} 1.Is in expected state?
2.How to get this state?
17CONFIDENTIAL
PRECONDITIONS
@Test
public void simpleTest() {
isInState(LOGGED_IN)
…
};
States.isLoggedIn();
18CONFIDENTIAL
PRECONDITIONS
public class States() {
public static void isLoggedIn() {
logger.info("Move to condition: " + condition);
if (loggedIn()) return;
logIn();
if (!loggedIn())
throw new Exception(“Can’t log In”);
else
logger.info(“User logedIn succesfullly");
};
}
public class States() {
public static void isLoggedIn() {
logger.info("Move to condition: " + condition);
if (loggedIn()) return;
logIn();
if (!loggedIn())
throw new Exception(“Can’t log In”);
else
logger.info(“User logedIn succesfullly");
};
public static void isLoggedIn() {
logger.info("Move to condition: " + condition);
if (loggedIn()) return;
logIn();
if (!loggedIn())
throw new Exception(“Can’t log In”);
else
logger.info(“User logedIn succesfullly");
};
public static void isLoggedIn() {
logger.info("Move to condition: " + condition);
if (loggedIn()) return;
logIn();
if (!loggedIn())
throw new Exception(“Can’t log In”);
else
logger.info(“User logedIn succesfullly");
};
}
public static void isLoggedIn() {
logger.info("Move to condition: " + condition);
if (loggedIn()) return;
logIn();
if (!loggedIn())
throw new Exception(“Can’t log In”);
else
logger.info(“User logedIn succesfullly");
};
public static void isLoggedIn() {
logger.info("Move to condition: " + condition);
if (loggedIn()) return;
logIn();
if (!loggedIn())
throw new Exception(“Can’t log In”);
else
logger.info(“User logedIn succesfullly");
};
public static void isLoggedIn() {
logger.info("Move to condition: " + condition);
if (loggedIn()) return;
logIn();
if (!loggedIn())
throw new Exception(“Can’t log In”);
else
logger.info(“User logedIn succesfullly");
};
}
19CONFIDENTIAL
ENTITY TABLES
@Data
public class Entity {
public String Номер;
public String Тип;
public String Пользователь;
public String Описание;
}
public class Row {
public Text Номер;
public Dropdown Тип;
public Link Пользователь;
public Description Описание;
}
20CONFIDENTIAL
Row user = UsersTable.firstRow(row ->
textOf(row.description).contains(“tasks”) &&
textOf(row.type).equals(“Admin”));
user.description.choosen.select();
ENTITY TABLES
CheckboxColumn name
21CONFIDENTIAL
ENTITY TABLES
One method instead of
dozens methods for each
combination
22CONFIDENTIAL
FUNCTIONS AND PREDICATES
find(max(Product::getPrice);
find(min(Product::getPrice);
find(max(Product::getName);
find(max(User::getPrice);
getElement(WebElement::isDisplayed, unique);
getDriver(maxSize(chrome));
23CONFIDENTIAL
CUSTOM SCENARIOS
@BeforeSuite (alwaysRun = true)
public static void setUp() {
ActionScenrios.actionScenario = (element, actionName, jAction, level) -> {
logger.info(format("Do '%s' action", actionName));
jAction.invoke();
};
ActionScenrios.resultScenario = (element, actionName, jAction, logResult,
level) -> {
logger.debug(format("Do '%s' action", actionName));
Object result = jAction.get();
logger.info(format("Get '%s' action result: %s", actionName, result));
return result;
};
} Like AOP
24CONFIDENTIAL
Assert.areEquals(() -> getNext(), "IPhone 6");
Assert.contains(() -> getNext(), "IPhone 5");
WAIT ASSERT
Значение станет равно X в течении таймаута
25CONFIDENTIAL
• Incredible flexibility
• Greatly reduce code
amount
PROS N’ CONS
• Learn lambda staff
• Change your and your teammates
mind
• Sometimes more complex debug
JAVA 8
26
INTERFACES
27CONFIDENTIAL
public interface IForm<T> {
void submit(String text, String btnName);
default void login(String text) { submit(text, "login"); }
default void loginAs(String text) { login(text); }
default void add(String text) { submit(text, "add"); }
default void publish(String text) { submit(text, "publish"); }
static T ToEntity(IForm<T>) { … }
static final int PAGE_NOT_FOUND = 404;
…
INTERFACES
28CONFIDENTIAL
MULTI INHERITANCE
public interface ITextField {
void input();
void newInput();
String getValue();
}
public interface ICombobox extends IDropDown, ITextField {
}
public interface Dropdown {
void select();
void open();
}
void input();
void newInput();
String getValue();
void select();
void open();
JAVA 8
29
DATA
30CONFIDENTIAL
3
DATA CLASS
public class Product {
public String name;
public int id;
public Types type;
}
31CONFIDENTIAL
CONSTRUCTORS AND TOSTRING
public Product() {}
public Product(String name, int id, Types type) {
this.name = name;
this.id = id;
this.type = type;
}
@Override
public String toString() {
return String.format("Name: %s, Id: %s, Type: %s", name, id, type);
}
+10
32CONFIDENTIAL
EQUALS AND HASHCODE
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (!Product.class.isAssignableFrom(obj.getClass())) {
return false;
}
final Product other = (Product) obj;
if (name == null)
return other.name == null;
return this.name.equals(other.name) &&
this.id == other.id &&
this.type == other.type;
}
@Override
public int hashCode() {
int hash = 3;
hash = 53 * hash + (name != null ? name.hashCode() : 0);
hash = 53 * hash + id;
hash = 53 * hash + type.hashCode();
return hash;
}
+23
33CONFIDENTIAL
@Data
public class Product {
public String name;
public int id;
public Types type;
}
LOMBOK
36 строк кода
1 аннотация
или
34CONFIDENTIAL
Add different Constructors
Add Getters and Setters
Add Builder pattern
Add good ToString
Add good Equals
LOMBOK
WARNING
This can really confuse
external users
ENTITY DRIVEN
TESTING
35
36CONFIDENTIAL
EDT: DATA DRIVEN TESTING
 Provide List<User> for test
37CONFIDENTIAL
EDT: PRECONDITIONS
 Provide List<User> for test
0. Have DefaultUser in DB
38CONFIDENTIAL
EDT: FILL AND SUBMIT
 Provide List<User> for test
0. Have DefaultUser in DB
1. Login with DefaultUser
39CONFIDENTIAL
EDT: FILL AND SEND
 Provide List<User> for test
0. Have DefaultUser in DB
1. Login with DefaultUser
2. Submit Contact Us Form for DefaultUser
40CONFIDENTIAL
EDT: EXTRACT
 Provide List<User> for test
0. Have DefaultUser in DB
1. Login with DefaultUser
2. Submit Contact Us Form for DefaultUser
3. Get Act. Opening from Vacancy table
41CONFIDENTIAL
EDT: VALIDATE
 Provide List<User> for test
0. Have DefaultUser in DB
1. Login with DefaultUser
2. Submit Contact Us Form for DefaultUser
3. Get Act. Opening from Vacancy table
4. Assert Act. Opening equals to Exp. Opening
ExpectedActual
42CONFIDENTIAL
EDT & JDI
DB.Users.shouldPresent(user);
LoginForm.login(user);
ConactUsForm.send(user);
Vacancy vacancy= OpeningsTable.entity(inRow(2));
Assert.areEquals(vacancy, expectedVacancy);
43CONFIDENTIAL
Learn language features
Learn modern tools and frameworks
Use popular approaches
Do your work better (write tests faster, more
stable, with better quality etc.)
Have fun with your work!
CONCLUSIONS
44CONFIDENTIAL
• Modularity
• New HTTP Client (Http2.0 & WebSocket)
• Improved Process API
• Language try-new, anonymous Diamond, private in
interfaces, immutable set, list-optional to stream
• Improved logging…
JAVA 9
http://www.baeldung.com/new-java-9
27.07.2017
45CONFIDENTIAL
QUESTIONS?
roman.Iovlev
roman_iovlev@epam.com

More Related Content

What's hot

Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
Soumya Behera
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
julien.ponge
 
Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
julien.ponge
 
JavaZone 2014 - goto java;
JavaZone 2014 - goto java;JavaZone 2014 - goto java;
JavaZone 2014 - goto java;
Martin (高馬丁) Skarsaune
 
JS and patterns
JS and patternsJS and patterns
JS and patterns
David Rodenas
 
Easy Button
Easy ButtonEasy Button
Easy Button
Adam Dale
 
Software Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW SydneySoftware Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW Sydney
julien.ponge
 
Migrating to JUnit 5
Migrating to JUnit 5Migrating to JUnit 5
Migrating to JUnit 5
Rafael Winterhalter
 
ES3-2020-P3 TDD Calculator
ES3-2020-P3 TDD CalculatorES3-2020-P3 TDD Calculator
ES3-2020-P3 TDD Calculator
David Rodenas
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicox
David Rodenas
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassle
Anton Arhipov
 
Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011
Anton Arhipov
 
Unit testing concurrent code
Unit testing concurrent codeUnit testing concurrent code
Unit testing concurrent code
Rafael Winterhalter
 
The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189
Mahmoud Samir Fayed
 
Дмитрий Контрерас «Back to the future: the evolution of the Java Type System»
Дмитрий Контрерас «Back to the future: the evolution of the Java Type System»Дмитрий Контрерас «Back to the future: the evolution of the Java Type System»
Дмитрий Контрерас «Back to the future: the evolution of the Java Type System»
Anna Shymchenko
 
ReactJS for Programmers
ReactJS for ProgrammersReactJS for Programmers
ReactJS for Programmers
David Rodenas
 
Server1
Server1Server1
Server1
FahriIrawan3
 
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch
 
Kotlin : Advanced Tricks - Ubiratan Soares
Kotlin : Advanced Tricks - Ubiratan SoaresKotlin : Advanced Tricks - Ubiratan Soares
Kotlin : Advanced Tricks - Ubiratan Soares
iMasters
 
Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113
SOAT
 

What's hot (20)

Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
 
Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
 
JavaZone 2014 - goto java;
JavaZone 2014 - goto java;JavaZone 2014 - goto java;
JavaZone 2014 - goto java;
 
JS and patterns
JS and patternsJS and patterns
JS and patterns
 
Easy Button
Easy ButtonEasy Button
Easy Button
 
Software Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW SydneySoftware Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW Sydney
 
Migrating to JUnit 5
Migrating to JUnit 5Migrating to JUnit 5
Migrating to JUnit 5
 
ES3-2020-P3 TDD Calculator
ES3-2020-P3 TDD CalculatorES3-2020-P3 TDD Calculator
ES3-2020-P3 TDD Calculator
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicox
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassle
 
Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011
 
Unit testing concurrent code
Unit testing concurrent codeUnit testing concurrent code
Unit testing concurrent code
 
The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189
 
Дмитрий Контрерас «Back to the future: the evolution of the Java Type System»
Дмитрий Контрерас «Back to the future: the evolution of the Java Type System»Дмитрий Контрерас «Back to the future: the evolution of the Java Type System»
Дмитрий Контрерас «Back to the future: the evolution of the Java Type System»
 
ReactJS for Programmers
ReactJS for ProgrammersReactJS for Programmers
ReactJS for Programmers
 
Server1
Server1Server1
Server1
 
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
 
Kotlin : Advanced Tricks - Ubiratan Soares
Kotlin : Advanced Tricks - Ubiratan SoaresKotlin : Advanced Tricks - Ubiratan Soares
Kotlin : Advanced Tricks - Ubiratan Soares
 
Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113
 

Similar to #ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"

Teste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrity
Washington Botelho
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
Chris Weldon
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql
JOYITAKUNDU1
 
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
STX Next
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projects
Bartosz Kosarzycki
 
Testing in android
Testing in androidTesting in android
Testing in android
jtrindade
 
Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
Andres Almiray
 
A evolução da persistência de dados (com sqlite) no android
A evolução da persistência de dados (com sqlite) no androidA evolução da persistência de dados (com sqlite) no android
A evolução da persistência de dados (com sqlite) no android
Rodrigo de Souza Castro
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
Tomek Kaczanowski
 
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24  tricky stuff in java grammar and javacJug trojmiasto 2014.04.24  tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Anna Brzezińska
 
Kotlin
KotlinKotlin
Android testing
Android testingAndroid testing
Android testing
Sean Tsai
 
All things that are not code
All things that are not codeAll things that are not code
All things that are not code
Mobile Delivery Days
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
Doug Hawkins
 
Mobile Programming - Network Universitas Budi Luhur
Mobile Programming - Network Universitas Budi LuhurMobile Programming - Network Universitas Budi Luhur
Mobile Programming - Network Universitas Budi Luhur
Riza Fahmi
 
How to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy CodeHow to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy Code
Daniel Wellman
 
RxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камниRxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камни
Stfalcon Meetups
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
Tomáš Kypta
 
Imagine a world without mocks
Imagine a world without mocksImagine a world without mocks
Imagine a world without mocks
kenbot
 
Clean coding-practices
Clean coding-practicesClean coding-practices
Clean coding-practices
John Ferguson Smart Limited
 

Similar to #ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation" (20)

Teste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrity
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql
 
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projects
 
Testing in android
Testing in androidTesting in android
Testing in android
 
Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
 
A evolução da persistência de dados (com sqlite) no android
A evolução da persistência de dados (com sqlite) no androidA evolução da persistência de dados (com sqlite) no android
A evolução da persistência de dados (com sqlite) no android
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
 
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24  tricky stuff in java grammar and javacJug trojmiasto 2014.04.24  tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
 
Kotlin
KotlinKotlin
Kotlin
 
Android testing
Android testingAndroid testing
Android testing
 
All things that are not code
All things that are not codeAll things that are not code
All things that are not code
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
Mobile Programming - Network Universitas Budi Luhur
Mobile Programming - Network Universitas Budi LuhurMobile Programming - Network Universitas Budi Luhur
Mobile Programming - Network Universitas Budi Luhur
 
How to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy CodeHow to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy Code
 
RxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камниRxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камни
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
Imagine a world without mocks
Imagine a world without mocksImagine a world without mocks
Imagine a world without mocks
 
Clean coding-practices
Clean coding-practicesClean coding-practices
Clean coding-practices
 

More from epamspb

Mobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast diveMobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast dive
epamspb
 
Mobile Open Day: Things I wish I'd known about Core Data before getting married
Mobile Open Day: Things I wish I'd known about Core Data before getting marriedMobile Open Day: Things I wish I'd known about Core Data before getting married
Mobile Open Day: Things I wish I'd known about Core Data before getting married
epamspb
 
#ITsubbotnik Spring 2017: Sergey Chibirev/Andrei Ortyashov "Умный дом своими ...
#ITsubbotnik Spring 2017: Sergey Chibirev/Andrei Ortyashov "Умный дом своими ...#ITsubbotnik Spring 2017: Sergey Chibirev/Andrei Ortyashov "Умный дом своими ...
#ITsubbotnik Spring 2017: Sergey Chibirev/Andrei Ortyashov "Умный дом своими ...
epamspb
 
#ITsubbotnik Spring 2017: Stepan Rakitin "Создаем отказоустойчивые распределе...
#ITsubbotnik Spring 2017: Stepan Rakitin "Создаем отказоустойчивые распределе...#ITsubbotnik Spring 2017: Stepan Rakitin "Создаем отказоустойчивые распределе...
#ITsubbotnik Spring 2017: Stepan Rakitin "Создаем отказоустойчивые распределе...
epamspb
 
#ITsubbotnik Spring 2017: Rustam Kadyrov "Как приструнить зоопарк из микросер...
#ITsubbotnik Spring 2017: Rustam Kadyrov "Как приструнить зоопарк из микросер...#ITsubbotnik Spring 2017: Rustam Kadyrov "Как приструнить зоопарк из микросер...
#ITsubbotnik Spring 2017: Rustam Kadyrov "Как приструнить зоопарк из микросер...
epamspb
 
ITsubbotnik Spring 2017: Dmitriy Yatsyuk "Готовое комплексное инфраструктурно...
ITsubbotnik Spring 2017: Dmitriy Yatsyuk "Готовое комплексное инфраструктурно...ITsubbotnik Spring 2017: Dmitriy Yatsyuk "Готовое комплексное инфраструктурно...
ITsubbotnik Spring 2017: Dmitriy Yatsyuk "Готовое комплексное инфраструктурно...
epamspb
 
#ITsubbotnik Spring 2017: Sergey Chernolyas "JPA for NoSQL"
#ITsubbotnik Spring 2017: Sergey Chernolyas "JPA for NoSQL"#ITsubbotnik Spring 2017: Sergey Chernolyas "JPA for NoSQL"
#ITsubbotnik Spring 2017: Sergey Chernolyas "JPA for NoSQL"
epamspb
 
#ITsubbotnik Spring 2017: Dmitrii Nikitko "Deep learning for understanding of...
#ITsubbotnik Spring 2017: Dmitrii Nikitko "Deep learning for understanding of...#ITsubbotnik Spring 2017: Dmitrii Nikitko "Deep learning for understanding of...
#ITsubbotnik Spring 2017: Dmitrii Nikitko "Deep learning for understanding of...
epamspb
 
#ITsubbotnik Spring 2017: Roman Dimitrenko "Building Paas with the HashiStack"
#ITsubbotnik Spring 2017: Roman Dimitrenko "Building Paas with the HashiStack"#ITsubbotnik Spring 2017: Roman Dimitrenko "Building Paas with the HashiStack"
#ITsubbotnik Spring 2017: Roman Dimitrenko "Building Paas with the HashiStack"
epamspb
 
#ITsubbotnik Spring 2017: Mikhail Khludnev "Search like %SQL%"
#ITsubbotnik Spring 2017: Mikhail Khludnev "Search like %SQL%"#ITsubbotnik Spring 2017: Mikhail Khludnev "Search like %SQL%"
#ITsubbotnik Spring 2017: Mikhail Khludnev "Search like %SQL%"
epamspb
 
#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...
#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...
#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...
epamspb
 
#ITsubbotnik Spring 2017: Anton Shapin, Denis Klykov "Visualization, storage ...
#ITsubbotnik Spring 2017: Anton Shapin, Denis Klykov "Visualization, storage ...#ITsubbotnik Spring 2017: Anton Shapin, Denis Klykov "Visualization, storage ...
#ITsubbotnik Spring 2017: Anton Shapin, Denis Klykov "Visualization, storage ...
epamspb
 
#ITsubbotnik Spring 2017: Sergey Mishanin "Report Portal. Руководство для аде...
#ITsubbotnik Spring 2017: Sergey Mishanin "Report Portal. Руководство для аде...#ITsubbotnik Spring 2017: Sergey Mishanin "Report Portal. Руководство для аде...
#ITsubbotnik Spring 2017: Sergey Mishanin "Report Portal. Руководство для аде...
epamspb
 

More from epamspb (13)

Mobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast diveMobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast dive
 
Mobile Open Day: Things I wish I'd known about Core Data before getting married
Mobile Open Day: Things I wish I'd known about Core Data before getting marriedMobile Open Day: Things I wish I'd known about Core Data before getting married
Mobile Open Day: Things I wish I'd known about Core Data before getting married
 
#ITsubbotnik Spring 2017: Sergey Chibirev/Andrei Ortyashov "Умный дом своими ...
#ITsubbotnik Spring 2017: Sergey Chibirev/Andrei Ortyashov "Умный дом своими ...#ITsubbotnik Spring 2017: Sergey Chibirev/Andrei Ortyashov "Умный дом своими ...
#ITsubbotnik Spring 2017: Sergey Chibirev/Andrei Ortyashov "Умный дом своими ...
 
#ITsubbotnik Spring 2017: Stepan Rakitin "Создаем отказоустойчивые распределе...
#ITsubbotnik Spring 2017: Stepan Rakitin "Создаем отказоустойчивые распределе...#ITsubbotnik Spring 2017: Stepan Rakitin "Создаем отказоустойчивые распределе...
#ITsubbotnik Spring 2017: Stepan Rakitin "Создаем отказоустойчивые распределе...
 
#ITsubbotnik Spring 2017: Rustam Kadyrov "Как приструнить зоопарк из микросер...
#ITsubbotnik Spring 2017: Rustam Kadyrov "Как приструнить зоопарк из микросер...#ITsubbotnik Spring 2017: Rustam Kadyrov "Как приструнить зоопарк из микросер...
#ITsubbotnik Spring 2017: Rustam Kadyrov "Как приструнить зоопарк из микросер...
 
ITsubbotnik Spring 2017: Dmitriy Yatsyuk "Готовое комплексное инфраструктурно...
ITsubbotnik Spring 2017: Dmitriy Yatsyuk "Готовое комплексное инфраструктурно...ITsubbotnik Spring 2017: Dmitriy Yatsyuk "Готовое комплексное инфраструктурно...
ITsubbotnik Spring 2017: Dmitriy Yatsyuk "Готовое комплексное инфраструктурно...
 
#ITsubbotnik Spring 2017: Sergey Chernolyas "JPA for NoSQL"
#ITsubbotnik Spring 2017: Sergey Chernolyas "JPA for NoSQL"#ITsubbotnik Spring 2017: Sergey Chernolyas "JPA for NoSQL"
#ITsubbotnik Spring 2017: Sergey Chernolyas "JPA for NoSQL"
 
#ITsubbotnik Spring 2017: Dmitrii Nikitko "Deep learning for understanding of...
#ITsubbotnik Spring 2017: Dmitrii Nikitko "Deep learning for understanding of...#ITsubbotnik Spring 2017: Dmitrii Nikitko "Deep learning for understanding of...
#ITsubbotnik Spring 2017: Dmitrii Nikitko "Deep learning for understanding of...
 
#ITsubbotnik Spring 2017: Roman Dimitrenko "Building Paas with the HashiStack"
#ITsubbotnik Spring 2017: Roman Dimitrenko "Building Paas with the HashiStack"#ITsubbotnik Spring 2017: Roman Dimitrenko "Building Paas with the HashiStack"
#ITsubbotnik Spring 2017: Roman Dimitrenko "Building Paas with the HashiStack"
 
#ITsubbotnik Spring 2017: Mikhail Khludnev "Search like %SQL%"
#ITsubbotnik Spring 2017: Mikhail Khludnev "Search like %SQL%"#ITsubbotnik Spring 2017: Mikhail Khludnev "Search like %SQL%"
#ITsubbotnik Spring 2017: Mikhail Khludnev "Search like %SQL%"
 
#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...
#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...
#ITsubbotnik Spring 2017: Andriy Filatov "Ансамбль солёных поваров: сравнивае...
 
#ITsubbotnik Spring 2017: Anton Shapin, Denis Klykov "Visualization, storage ...
#ITsubbotnik Spring 2017: Anton Shapin, Denis Klykov "Visualization, storage ...#ITsubbotnik Spring 2017: Anton Shapin, Denis Klykov "Visualization, storage ...
#ITsubbotnik Spring 2017: Anton Shapin, Denis Klykov "Visualization, storage ...
 
#ITsubbotnik Spring 2017: Sergey Mishanin "Report Portal. Руководство для аде...
#ITsubbotnik Spring 2017: Sergey Mishanin "Report Portal. Руководство для аде...#ITsubbotnik Spring 2017: Sergey Mishanin "Report Portal. Руководство для аде...
#ITsubbotnik Spring 2017: Sergey Mishanin "Report Portal. Руководство для аде...
 

Recently uploaded

What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
aymanquadri279
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
Ayan Halder
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Envertis Software Solutions
 

Recently uploaded (20)

What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
 

#ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"

  • 1. JAVA EDGE IN TEST AUTOMATION 28 MAY 2017
  • 2. 2CONFIDENTIAL Chief QA Automation More than 12 years in testing About 10 in test automation ROMAN IOVLEV
  • 3. 3CONFIDENTIAL • Java 8 • Lambdas • Declarative programming • Examples • Interfaces • Data with Lombok • Java 9 expectations TOPICS
  • 4. 4CONFIDENTIAL • “How does Java 8 exert hidden power on Test Automation?” (https://goo.gl/uT4XfN) • “Test UI with JDI: easy, simple and good” (http://goo.gl/Mwta77, https://goo.gl/1kxZS2) • “Java Tip of the Week #1 – Lombok” (https://goo.gl/Toxyeh) INSPIRED WITH
  • 6. 6CONFIDENTIAL public Function<Integer, String> toStr = i -> i.toString(); public void print(int num, Function<Integer, String> func) { func.apply(num); } print(22, i -> (i / 10)+”decades”); print(3, toStr); print(-30, i -> { if (i >0) return i.toString(); return –i; } ); FUNCTION AS VARIABLE
  • 7. 7CONFIDENTIAL {3, 1, 4, 5, 2, 8, 10, 12, 0, 4, 2, 1, 10, -1} STREAM • Even numbers > 3 • Only unique values • Sorted by Ascending • Cut 2 lowest and highest values • Wrap rest of numbers with “( n )” • And print “(8)(10)”
  • 8. 8CONFIDENTIAL //32 strings public String printResultsJava7(Integer[] strings) { // Filter List<Integer> filtered = new ArrayList<>(); for (int s : strings) if (s > 3 && s % 2 == 0) filtered.add(s); //Distinct List<Integer> distinct = new ArrayList<>(); for (int s : filtered) if (!distinct.contains(s)) distinct.add(s); // Sort Object[] sortedArray = distinct.toArray(); Arrays.sort(sortedArray); // Trim List<Integer> trimBounds = new ArrayList<>(); for (int i = 0; i < sortedArray.length; i++) if (i > 0 || i < sortedArray.length) trimBounds.add((int)sortedArray[i]); // Map List<String> print = new ArrayList<>(); for (int s : trimBounds) print.add("(" + s + ")"); // Reduce String result = ""; for (String s : print) result += s + ";"; return result; } JAVA 7 // 6 strings public String printResultsJava7(Integer[] strings) { List<Integer> filtered = filter(strings); List<Integer> distinct = distinct(filtered); Integer[] sortedArray = sort(distinct); List<Integer> trimBounds = trim(sortedArray); List<String> print = print(trimBounds); return reduce(print); }
  • 9. 9CONFIDENTIAL public String Filter(Integer[] strings) { return stream(strings) .filter(el -> el > 3 && el % 2 == 0) .distinct() .sorted() .skip(1).limit(1) .map(el -> "(" + el + ")") .reduce((str, el) -> el + ";").get(); } JAVA 8
  • 12. 12CONFIDENTIAL public String getMessage(int httpStatus) { switch(httpStatus) { case 404: return “Page not found”; case 500: return “Internal Server error”; default: return “Unknown status code”; } } SWITCH
  • 13. 13CONFIDENTIAL public WebElement getVisibleElement(By locator) { List<WebElement> elements = driver.findElements(locator); switch(elements) { case elements.size() == 1 && elements.get(0).isDisplayed(): return elements.get(0), case elements.size() > 0: throw new RuntimeException( format("Find %s elements instead of 1", els.size())); default: throw new RuntimeException("Visible elements not found") ); } SWITCH IMPOSSIBLE
  • 14. 14CONFIDENTIAL public WebElement getVisibleElement(By locator) { List<WebElement> elements = driver.findElements(locator); return Match(elements).of( Case(els -> els.size() == 1 && els.get(0).isDisplayed(), els -> els.get(0)), Case(els -> els.size() > 0, els -> { throw new RuntimeException( format("Find %s elements instead of 1", els.size())); }), Case($(), () -> { throw new RuntimeException("Visible elements not found") }) ); } JAVASLANG
  • 15. 15CONFIDENTIAL • Option.of(null) name.toString() • Try.of(() – 1/0) • Tuple(“String”, 1, new MyClass()) • Collections, • Validate • Functions etc… JAVASLANG http://www.baeldung.com/javaslang
  • 16. 16CONFIDENTIAL PRECONDITIONS public enum Preconditions implements IPreconditions { LOGGED_IN(() -> loggedIn(), () -> { loginPage.open(); loginForm.login(); }), CAREERS_PAGE("/careers"); …. } 1.Is in expected state? 2.How to get this state?
  • 17. 17CONFIDENTIAL PRECONDITIONS @Test public void simpleTest() { isInState(LOGGED_IN) … }; States.isLoggedIn();
  • 18. 18CONFIDENTIAL PRECONDITIONS public class States() { public static void isLoggedIn() { logger.info("Move to condition: " + condition); if (loggedIn()) return; logIn(); if (!loggedIn()) throw new Exception(“Can’t log In”); else logger.info(“User logedIn succesfullly"); }; } public class States() { public static void isLoggedIn() { logger.info("Move to condition: " + condition); if (loggedIn()) return; logIn(); if (!loggedIn()) throw new Exception(“Can’t log In”); else logger.info(“User logedIn succesfullly"); }; public static void isLoggedIn() { logger.info("Move to condition: " + condition); if (loggedIn()) return; logIn(); if (!loggedIn()) throw new Exception(“Can’t log In”); else logger.info(“User logedIn succesfullly"); }; public static void isLoggedIn() { logger.info("Move to condition: " + condition); if (loggedIn()) return; logIn(); if (!loggedIn()) throw new Exception(“Can’t log In”); else logger.info(“User logedIn succesfullly"); }; } public static void isLoggedIn() { logger.info("Move to condition: " + condition); if (loggedIn()) return; logIn(); if (!loggedIn()) throw new Exception(“Can’t log In”); else logger.info(“User logedIn succesfullly"); }; public static void isLoggedIn() { logger.info("Move to condition: " + condition); if (loggedIn()) return; logIn(); if (!loggedIn()) throw new Exception(“Can’t log In”); else logger.info(“User logedIn succesfullly"); }; public static void isLoggedIn() { logger.info("Move to condition: " + condition); if (loggedIn()) return; logIn(); if (!loggedIn()) throw new Exception(“Can’t log In”); else logger.info(“User logedIn succesfullly"); }; }
  • 19. 19CONFIDENTIAL ENTITY TABLES @Data public class Entity { public String Номер; public String Тип; public String Пользователь; public String Описание; } public class Row { public Text Номер; public Dropdown Тип; public Link Пользователь; public Description Описание; }
  • 20. 20CONFIDENTIAL Row user = UsersTable.firstRow(row -> textOf(row.description).contains(“tasks”) && textOf(row.type).equals(“Admin”)); user.description.choosen.select(); ENTITY TABLES CheckboxColumn name
  • 21. 21CONFIDENTIAL ENTITY TABLES One method instead of dozens methods for each combination
  • 23. 23CONFIDENTIAL CUSTOM SCENARIOS @BeforeSuite (alwaysRun = true) public static void setUp() { ActionScenrios.actionScenario = (element, actionName, jAction, level) -> { logger.info(format("Do '%s' action", actionName)); jAction.invoke(); }; ActionScenrios.resultScenario = (element, actionName, jAction, logResult, level) -> { logger.debug(format("Do '%s' action", actionName)); Object result = jAction.get(); logger.info(format("Get '%s' action result: %s", actionName, result)); return result; }; } Like AOP
  • 24. 24CONFIDENTIAL Assert.areEquals(() -> getNext(), "IPhone 6"); Assert.contains(() -> getNext(), "IPhone 5"); WAIT ASSERT Значение станет равно X в течении таймаута
  • 25. 25CONFIDENTIAL • Incredible flexibility • Greatly reduce code amount PROS N’ CONS • Learn lambda staff • Change your and your teammates mind • Sometimes more complex debug
  • 27. 27CONFIDENTIAL public interface IForm<T> { void submit(String text, String btnName); default void login(String text) { submit(text, "login"); } default void loginAs(String text) { login(text); } default void add(String text) { submit(text, "add"); } default void publish(String text) { submit(text, "publish"); } static T ToEntity(IForm<T>) { … } static final int PAGE_NOT_FOUND = 404; … INTERFACES
  • 28. 28CONFIDENTIAL MULTI INHERITANCE public interface ITextField { void input(); void newInput(); String getValue(); } public interface ICombobox extends IDropDown, ITextField { } public interface Dropdown { void select(); void open(); } void input(); void newInput(); String getValue(); void select(); void open();
  • 30. 30CONFIDENTIAL 3 DATA CLASS public class Product { public String name; public int id; public Types type; }
  • 31. 31CONFIDENTIAL CONSTRUCTORS AND TOSTRING public Product() {} public Product(String name, int id, Types type) { this.name = name; this.id = id; this.type = type; } @Override public String toString() { return String.format("Name: %s, Id: %s, Type: %s", name, id, type); } +10
  • 32. 32CONFIDENTIAL EQUALS AND HASHCODE @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!Product.class.isAssignableFrom(obj.getClass())) { return false; } final Product other = (Product) obj; if (name == null) return other.name == null; return this.name.equals(other.name) && this.id == other.id && this.type == other.type; } @Override public int hashCode() { int hash = 3; hash = 53 * hash + (name != null ? name.hashCode() : 0); hash = 53 * hash + id; hash = 53 * hash + type.hashCode(); return hash; } +23
  • 33. 33CONFIDENTIAL @Data public class Product { public String name; public int id; public Types type; } LOMBOK 36 строк кода 1 аннотация или
  • 34. 34CONFIDENTIAL Add different Constructors Add Getters and Setters Add Builder pattern Add good ToString Add good Equals LOMBOK WARNING This can really confuse external users
  • 36. 36CONFIDENTIAL EDT: DATA DRIVEN TESTING  Provide List<User> for test
  • 37. 37CONFIDENTIAL EDT: PRECONDITIONS  Provide List<User> for test 0. Have DefaultUser in DB
  • 38. 38CONFIDENTIAL EDT: FILL AND SUBMIT  Provide List<User> for test 0. Have DefaultUser in DB 1. Login with DefaultUser
  • 39. 39CONFIDENTIAL EDT: FILL AND SEND  Provide List<User> for test 0. Have DefaultUser in DB 1. Login with DefaultUser 2. Submit Contact Us Form for DefaultUser
  • 40. 40CONFIDENTIAL EDT: EXTRACT  Provide List<User> for test 0. Have DefaultUser in DB 1. Login with DefaultUser 2. Submit Contact Us Form for DefaultUser 3. Get Act. Opening from Vacancy table
  • 41. 41CONFIDENTIAL EDT: VALIDATE  Provide List<User> for test 0. Have DefaultUser in DB 1. Login with DefaultUser 2. Submit Contact Us Form for DefaultUser 3. Get Act. Opening from Vacancy table 4. Assert Act. Opening equals to Exp. Opening ExpectedActual
  • 42. 42CONFIDENTIAL EDT & JDI DB.Users.shouldPresent(user); LoginForm.login(user); ConactUsForm.send(user); Vacancy vacancy= OpeningsTable.entity(inRow(2)); Assert.areEquals(vacancy, expectedVacancy);
  • 43. 43CONFIDENTIAL Learn language features Learn modern tools and frameworks Use popular approaches Do your work better (write tests faster, more stable, with better quality etc.) Have fun with your work! CONCLUSIONS
  • 44. 44CONFIDENTIAL • Modularity • New HTTP Client (Http2.0 & WebSocket) • Improved Process API • Language try-new, anonymous Diamond, private in interfaces, immutable set, list-optional to stream • Improved logging… JAVA 9 http://www.baeldung.com/new-java-9 27.07.2017

Editor's Notes

  1. Работаю в компании Epam в