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.
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.
People who have used it
--Selenium ... About 70% --Selenide ... About 20% --Fluent Lenium ... 1 person
Presenter: backpaper0
--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
--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
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 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"))
--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
(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
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");
}
--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()
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
Presenter: @ shimashima35 Presentation material
The original story is the following article Example of DSL-like E2E automatic test infrastructure development by Selenide
--High maintainability and productivity --If possible, allow the planner to write the test himself
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
--Page Object hides Selenium / Selenide implementation from test scenarios --Focus on scenarios --Get the specifier to write the test
--Because it covers tax accounting salary --So that even non-programmers can write tests
--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
--Screen crossing process uses Java 8 Interface default method
--All contexts are Classed (inner Class)
--IDE complement can be used
--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
――I made the foundation, but the scenario implementation did not proceed --Cannot record after migrating to AWS --The scenario is not maintained
Presenter: @kitkat_twit
FluentLenium
-Quickstart does not work --Webdriver settings required --In the first place, knowledge of Selenium is required as a prerequisite
--DBUnit ... Large amount of data input --DBSetup… DAO / Repository unit test
--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.
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 ... Former MS, now Salesforce
Slenium v3
--Gecko Driver is now required for Firefox testing --WebDriver ⇒ Before W3C Recommendation
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… QA Engineer
User Analytics
--For B2C
--Usually QA tests and then releases --Coupon display released without QA's knowledge --Bug that unpopular coupons are displayed
--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
Testing with docker
--Docker is convenient if you use Selenium Grid for distributed execution --Fast startup
I used Slido.com
Selenium Committer Day 2017 "Q & A Panel Discussion" Audit Report #Seleniumjp
--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