Image from Amazon Title: Test Automation using Selenium WebDriver with Java: Step by Step Guide
Author(s): Navneesh Garg
Publisher: Self Published
Amazon wrote:Test Automation using Selenium WebDriver, is the latest book released on Selenium 2.0 using Java as a programming language. This Selenium book has been designed with the objectives of simplicity and ease of understanding.
As I read the reviews on Amazon for “Test Automation using Selenium WebDriver with Java: A Step by Step Guide”, I'm wondering if the reviewers read the same book as I did. I can't recommend this book to anyone.
The target audience for this book appears to be testers who don't yet know Java. Chapter 8 covers the basics of Java including what is a class and basic syntax like creating variables and if statements. Now Selenium WebDriver is a programming API implemented in a few languages. This book uses Java as the chosen language, which is fine. I have difficultly with the idea that you can write 90 pages (that's almost 25% of the book) without your readers yet having any knowledge of the language that is being used in the book. Some of it is good – covering why you'd want to test and concepts. But that's a really long introduction. Oh and I hope you like screenshots. I counted 75 screenshots in those first 90 pages. While I do like screenshots for installing software and showing tools, this feels like an excessive number.
Ok. Chapter 9 is titled “Creating First Selenium WebDriver Script.” Great. We are finally going to learn how to write code in WebDriver. Nope. This chapter is about how to export a script from Selenium IDE and how to use Eclipse. There's a tiny bit of explanation of what the exported script is doing, but that's more in Chapter 10. Ok. Chapter 10. Now we are FINALLY going to learn how to write code in WebDriver right? I suppose we do. We get 1.5 pages of unannotated code followed by five lines of explanation. The rest of the chapter is basically three pages of tables with APIs. The table does say what the method does, but this is a very fast moving way of introducing Selenium. And the book has held our hand and assumed no knowledge thus far.
I do like the justification for automation. I like the multiple choice questions for review. And the idea of a case study to have the the examples using the same topic throughout. I like that tools that Selenium integrates with are explored although I think it came at the expensive of becoming proficient in WebDriver. I like that property files and parameterized tests from Excel are covered. I like that recipes in chapter 27 at the end although I wish there was more focus on them.
Even thought there are things that I like, I can't recommend this book. The formatting of code is really bad. Tab indent lines are inconsistent but look like 10-15 spaces. Which causes lots of wrapping and makes it hard to read. On page 229, there are even spaces in keywords and variable names. In a number of cases imports have the wrong case and won't compile. JUnit is frequently spelled as Junit. @Before is written as @before. These are small things, but there are a ton of them which is distracting. And for a book that targets people new to Java, they aren't so obvious to figure out when typing in an example and wondering why the code doesn't compile. There's also a lot of English grammar errors.
There are also bad practices being touted as good practices. At the end, he recommends variable be named with the type like blnFound and strFirstName. Hungarian notation is controversial enough, but this isn't even standard for Java. There's an un-removed reference to VBScript before that table which appears to be where it comes from. Within the book, he uses a mix of Hungarian notation (iNumber and sName) and normal Java notation (number and name).
He also recommends HA_BE_login as a method name. Except he calls it a function name because he is presumably a VB guy who doesn't realize Java developers don't call them functions. And this is intentional. He thinks he is being clever by creating this abbreviation convention. Don't name your method that! There's not a character shortage. There's no reason this can't be HotelAppBusinessFunctionLogin. Which actually follows Java naming conventions and is easier to read.
These last two bother me a lot because they are bad practices in Java. Teaching someone new to Java bad practices in Java is not setting them up for success.
While all of the things I've mentioned would have had me take off stars, combined they just leave me with the advice to pick another book.