Study session memo: Kansai Java Engineers Association 8/5 --Selenium

Introduction

This month's Seki Java featured Selenium. I think that it will be useful for engineers who are working on E2E testing with a wide range of contents such as Selenide's on-site use cases and trends of the Selenium project. From the middle, the battery of the Mac is insufficient and it is a rough memo. I'm sorry.

Overview

Kansai Java Engineers Association 8/5 --Selenium Date: 2017/08/05 (Sat) 14: 00-17: 00 Location: Rental conference room "Use Tsu" Fuji Co., Ltd.

Venue questionnaire

People who have used it

--Selenium ... About 70% --Selenide ... About 20% --Fluent Lenium ... 1 person

What you have devised in the test using Selenide and what you are going to do

Presenter: backpaper0

What is Selenide?

--Framework that wraps Selenium Web Driver for easy use --For E2E test --CodeBorne (Estonia) --There is also a seleide-appium

For details, see [Web + DB Press vol.100 "[9th] Automatic browser test with Selenide ... From how to use to problems encountered in the field"](http://gihyo.jp/magazine/wdpress/archive/2017 / vol100) posted

--You can write like jQuery --Easy to test Ajax --There is a retry mechanism --Easy to set the base URL and WebDriver as system properties

Current efforts

--Manually operate and push screenshots from Excel to Selenide to push test automation to your boss --Selenide automates E2E tests while taking screenshots --The accepting people confirm the screenshot

Being devised

I want to verify that the page is displayed as expected

Verify by putting the screen name in the meta element ⇒Because it is a business application, the title tag does not change for each screen

I want to wait for the completion of initial processing

I used shouldBe because the initially displayed data is also acquired by Ajax. It will retry without writing wait.

//Check the status
$("#state").shouldBe(exactText("initialized"))

IE does not work as expected

--Chrome can be tested nicely --Your standard browser is IE ⇒ It is hard because it does not work as expected

For IE

I can't input properly when I call the val method (If you enter one character at a time with sendKey, it will work ...) ⇒ You can overwrite Command with Commands # add, so hack this and adjust the behavior of IE

IE is slow

(Partly because I hacked Command)

Remote execution on another PC

--In case you want to check the operation lightly during implementation, it works with Chrome in local development --Take a Stack Trace and switch between IE and Chrome launch

I want to test run as soon as I check out my code from VCS

It is troublesome to rewrite the configuration file according to the environment

--JDBC connection information --Temporary file storage --Chrome driver, IE driver location

--Use Spring Boot's Condition and Profile --Set the base URL, target browser, etc. with TestRule

if (System.getProperty("selenide.baseUrl") == null) {
  System.setProperty("selenide.baseUrl", "http://localhost:8080");
}

from now on

--DBUnit for inputting test data and verifying DB --I want to generate a page object semi-automatically

Example) After writing a selector in the page object with annotation, get the value and set it in that variable

--Japanese method + method chain

※image

Set the value to foo("Huh")
.Click bar()

Question

Q. Was there anything unstable (slow) waiting for asynchronous processing?

--There is currently no heavy processing that causes so much waiting --You can change the maximum timeout

Q. How do you manage screenshots?

--Folder management for each test class

Q. Can I upload files for D & D or upload multiple files?

――D & D uses a common library, so it may be excluded from the test target.

Q. Can I authenticate with BASIC?

Q. Do you use headless?

Q. Is the test code written by the implementer at the time of implementation?

--The implementer also wrote an E2E test at the time of implementation --The implementer has a selector for the convenience of E2E testing.

Q. Why did you choose Selenide?

--It seems easy to use ――It seems that it can be expanded when something happens

Example of DSL-like E2E test infrastructure development by Selenide in Osaka

Presenter: @ shimashima35 Presentation material

The original story is the following article Example of DSL-like E2E automatic test infrastructure development by Selenide

Purpose of infrastructure development

--High maintainability and productivity --If possible, allow the planner to write the test himself

Hierarchical Page Object Pattern introduced

BasePage

--Abstract class --Only selectors are described --Depends on WebDriver / Selenide API --Selenide type also appears in method signature

Page

--Inheriting BasePage --Scenario from test class --In principle, there is no selector description

Elimination of direct operation of Selenium / Selenide

--Page Object hides Selenium / Selenide implementation from test scenarios --Focus on scenarios --Get the specifier to write the test

Fully Japanese method

--Because it covers tax accounting salary --So that even non-programmers can write tests

Data registration by pseudo Builder Pattern

--Create the data used in the test scenario within the scenario --Prepare registration method with pseudo Builder Pattern --You can use the complementary function of the IDE

Unification of common screen items by Mix-in

--Screen crossing process uses Java 8 Interface default method

Fine Object of screen elements

--All contexts are Classed (inner Class)

Objectize return value for pseudo DSL

--IDE complement can be used

Recording function

--Basically all operations are recorded --Erase if the test is successful ――Only the video when you failed remains --Can be reduced to 1/100 by using a codec for screen capture

After creating the foundation ...

――I made the foundation, but the scenario implementation did not proceed --Cannot record after migrating to AWS --The scenario is not maintained

The story of having trouble with the introduction of FluentLenium

Presenter: @kitkat_twit

FluentLenium

-Quickstart does not work --Webdriver settings required --In the first place, knowledge of Selenium is required as a prerequisite

Preparation of test data

--DBUnit ... Large amount of data input --DBSetup… DAO / Repository unit test

Handling of test projects

--Do you want to make the same project? --Do you work with unit tests?

⇒Isn't it better to have another project? However, apart from that, it's easy to forget to move it.

Selenium Committer Day 2017 substitute in Osaka

Presenter: Naoya Kojima / @jugemix

Former story: [Comitter talks about the present and future of Selenium- "Selenium Committer Day 2017" report](ttp: //gihyo.jp/news/report/2017/07/2601)

Jim Evans-The Future of Selenium

Jim Evans ... Former MS, now Salesforce

Selenium now

Slenium v3

--Gecko Driver is now required for Firefox testing --WebDriver ⇒ Before W3C Recommendation

The future of Selenium

Selenium v4

--W3C Recommendation --From now on, each browser vendor will develop WebDriver according to the specifications.

In the distant future

--The project will be slimmed down by the browser vendor developing the driver. --Document issues --Official documentation is still v2 ――Because it is a volunteer project, the resources are not sufficient.

Marcus Merrell-Analysis test automation

Marcus Merrell… QA Engineer

User Analytics

--For B2C

Failure story in A / B Test

--Usually QA tests and then releases --Coupon display released without QA's knowledge --Bug that unpopular coupons are displayed

Analytics QA

--QA is isolated from the design process ――QA should be actively involved --There is browsermob-proxy as a tool to use for that. --By incorporating it in the test, you can capture the response of the browser etc. --Can be aggregated and grasped with kibana

Manoj Kumar-Testing with a container

Testing with docker

--Docker is convenient if you use Selenium Grid for distributed execution --Fast startup

QA panel discussion

I used Slido.com

Selenium Committer Day 2017 "Q & A Panel Discussion" Audit Report #Seleniumjp

Impressions

--The tools and know-how around Selenium have been enhanced, making it easier to work on automating E2E testing in development projects. ――In particular, Selenide can be implemented like jQuery, so the threshold is low for implementers and it seems easy to gain on-site understanding. --Common design such as Page Object is necessary to seriously tackle the productivity and maintainability of test code creation ――It is important for productivity and maintainability to create a common foundation and make it easy to test, but whether you can continue to use E2E testing is probably another issue and you need to understand E2E testing throughout the development project. --The recording function may be useful --The general method of creating test data with tools such as DBUnit (I felt that the know-how in this area is still in the future). --I'd like to expect the W3C Recommendation and the subsequent provision of WebDriver by browser vendors, but I'm worried (whether IE will comply properly?) --I want to use selenium-docker (or rather, increase the number of E2E tests as needed ...)

Recommended Posts

Study session memo: Kansai Java Engineers Association 8/5 --Selenium
Study session memo: Kansai Java Engineers Association [Osaka] 7/12 --Cloud Native
[Study session memo] Java Day Tokyo 2017
[Java ~ Method ~] Study memo (5)
[Java ~ Array ~] Study memo 4
Java Silver Study Method Memo
[Java ~ Boolean value ~] Study memo (2)
Java study memo 2 with Progate
[In-house study session] Java exception handling (2017/04/26)
Summary of in-house newcomer study session [Java]
[Java ~ Variable definition, type conversion ~] Study memo
Java memo
[Java ~ Conditional branching / Iterative processing ~] Study memo (3)
[Java ~ Classes and External Libraries ~] Study Memo (6)
[In-house study session] Java basics-execution without using IDE- (2017/07/06)
java anything memo
Let's study Java
Java Silver memo
java, maven memo
Selenium sample (Java)
Selenium x Java
Java SE 7 memo
java anything memo 2
[Java] Study notes
Java 8 study (repeatable)
Java study memorandum
Java session scope
Study Java Silver 1
Java specification memo
Java pattern memo
[In-house study session] Java basics-Lambda expression and Stream API- (2017/07/13)
[In-house study session] Basics of Java annotation (2017/11/02) ~ Under construction ~