Coding Dojo #6: Web Driver
We ran a sort of coding dojo/more playing around with web driver learning session this evening, coding some tests in Java driving Planet TW from the code.
The Format
We had the same setup as for our normal coding dojos but only one person was driving at a time and the others were watching from around them offering tips on different approaches. I think only a couple of us drove during the session.
What We Learnt
-
This was an interesting way to start learning about a tool that I hadn’t previously used. Two of my colleagues had used it before and they were able to provide knowledge of best practices, such as the Page Object pattern. I finally got the value in this pattern today after seeing the way that we can use the PageFactory to help cut out a lot of the boiler plate code usually needed to get the elements on each page into a class.
-
Web Driver seems to be simpler to setup than Selenium from my experiences tonight. We don’t have to worry about the reverse proxy like we do when using Selenium which makes things much easier. The tests, especially when using the Html Unit driver, ran fairly rapidly.
-
We worked with the Safari driver for most of the time but had to put in a lot of sleeps because the calls to pages didn’t seem to wait for that page to load before going onto the next step. A quick browse of the mailing list suggests that this is an area that will be worked on soon. The Html Unit Driver worked really well though.
-
I learnt about the idea of LiFT style APIs - we can write web driver tests in this style by using the correct context wrapper. Effectively an acceptance testing DSL:
LiFT allows writing automated tests in a style that makes them very readable, even for non-programmers. Using the LiFT API, we can write tests that read almost like natural language, allowing business requirements to be expressed very clearly. This aids communication amongst developers and customers, helping give all stakeholders confidence that the right things are being tested.
-
Liz mentioned an earlier discussion she had been having around the creation of strings using literals ("string") or by using the constructor (new String("string)). The latter is not encouraged as those strings are not put into the string pool and therefore cannot be reused. There is more discussion of the two approaches to creating strings on the Code Ranch forums and on Ethan Nicholas' blog.
Next Time
-
Next week we are going to explore the Retlang concurrency library. I think the plan is to take a concurrency problem and try to solve it with the library.
-
I’m still not sure how well the Dojo format works for learning or exploring things that are new to most of the group. This week’s one certainly wasn’t as intense as last week’s although I still learnt about things that I previously didn’t know about.
About the author
I'm currently working on short form content at ClickHouse. I publish short 5 minute videos showing how to solve data problems on YouTube @LearnDataWithMark. I previously worked on graph analytics at Neo4j, where I also co-authored the O'Reilly Graph Algorithms Book with Amy Hodler.