Recent course source code changes for WebDriver 2.46.0

I just finished updating my course source code for WebDriver 2.46.0

I removed some of the code to github:

I had to make a few other minor changes which I summarise below.

Chrome and Firefox

Chrome and ChromeDriver 2.16 now seem to work as well as the Firefox driver. I used to have some issues with Frames and Window management but that has all gone away. Now I have a single set of tests for Chrome and Firefox with no ‘fails on Chrome’ and ‘fails on Firefox’ suites.

I did have to add some additional synchronisation when creating new windows in Firefox. Firefox used to block before returning control to the code when creating new windows, but now it doesn’t so I simple ‘wait’ for the element I need to be available before clicking on it. General synchronisation goodness that we all know and love.

Cookies

I did have to make changes for cookies though. I assume most people don’t mess much with cookies when using WebDriver, but it is handy functionality when you need it.

ChromeDriver still has a bug where it creates 2 cookies. And now, when ChromeDriver creates a cookie it prefixes the ‘domain’ with a ‘.’. This means you have to be careful working with cookies through ChromeDriver as you might have to work around the browser creating a duplicate cookie after you amend it.

Firefox updates have meant that I now have to append a ‘/’ to my cookie paths.

Minor Things

  • The Select support class gave me a string padded text, so I had to ‘trim’ the output. I suspect this was a browser compatibility thing with my app code.
  • On Mac, my window positioning code didn’t work because I set the Y value to 20, but Mac wanted more space for its top menu bar, so I changed the position to 40.

 

Posted in Courses, WebDriver | Leave a comment

OperaDriver is now officially deprecated in my code

Anyone remember Opera?

For a while it had the best developer tools and the best JavaScript debugger. It also had ‘good, not great’ WebDriver support, but an easy to add driver via maven.

That stopped when Opera went from version 12.17 and the Opera Driver didn’t work on most recent versions of Opera when they moved to webkit and then blink. But if you still wanted to, you could still use the driver and run tests with the older version of Opera.

But no longer.

The OperaDriver hasn’t been updated so it now compile clashes with Selenium WebDriver 2.46.0

You can exclude the conflicting apache.commons code if you want:

<dependency>
    <groupId>com.opera</groupId>
    <artifactId>operadriver</artifactId>
    <version>1.3</version>
    <exclusions>
        <!-- changes to Selenium 2.46.0 mean that the operadriver
            now conflicts with Selenium WebDriver. I excluded the
            apache.commons commons-exec from operadriver to allow
            the driver to retain compile time compatibility 
            with webdriver
        -->
        <exclusion>
            <groupId> org.apache.commons</groupId>
            <artifactId>commons-exec</artifactId>
        </exclusion>
    </exclusions>
</dependency>

That will get you compiled, but won’t help you execute.

In fact OperaDriver hasn’t executed since WebDriver version 2.34.0

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-server</artifactId>
    <version>2.34.0</version>
</dependency>

The OperaDriver depends on code that moved in WebDriver 2.35.0.

Possibly just as well since Opera always had some issues:

  • Alert Handling
  • Did not refresh reliably
  • Window Management – did not maximise
  • JavaScript Executor and Asyn execution
  • File handling
  • Cookies – did not return the correct expiry date

I have now ‘officially’ removed OperaDriver from my course code base, and moved the basic Opera stuff, just as a legacy example, off to github.

https://github.com/eviltester/operaWebDriverExample

Posted in WebDriver | Leave a comment

WebDriverBackedSelenium example on github now

I had a small WebDriverBackedSelenium example in my Selenium 2 WebDriver API Course codebase.

Since the Selenium API has been deprecated by the main WebDriver project, although it can still be found in the current versions of Selenium WebDriver, I have moved the example to a separate github project.

https://github.com/eviltester/webDriverBackedExample

It isn’t much. It just shows how to get started with the API.

But I’m making the split now, so that:

  • students no longer see the deprecation messages when the compile the code source and think they have a problem
  • my main code won’t break badly on the future version of WebDriver which removes the Selenium API

 

Posted in Migrating to WebDriver, Selenium-RC, WebDriver | Leave a comment

Successful Test Automation for Managers

Illustration by Herb Lebowitz from the cover of “Automation” by Carl Dreher

What questions do Test Managers have regarding automation? What concerns and issues do non-technical managers face with test automation?

I presented at the Test Management Summit on the 29th April 2015 to try and find out.

I’ve been an automator and a test manager so I’ve experienced both sides of the coin, but I’ve always had the benefit of technical and programming knowledge and experience. So while I had an initial list of areas that I thought current managers working, or about to work, with automation would want to discuss, I wanted to see what would happen on the day.

At this point I’m working from memory without notes, because I was facilitating a discussion, so let’s see what I remember…

The Test Management Summit is a discussion based event, with the emphasis on the presenter moving to triggering and facilitating discussion rather than doing all the talking. As a result, when you look at the slides, the first half of the slides were designed for me to talk over, and the remainder held in reserve in case the discussion faltered.

In the event, I talked for 15 mins, and the discussion was lively and proceeded without requiring my reserve slides.

I made a distinction between use of tools, and automation. With automation having the characteristic of no manual intervention during its execution.

I emphasized the need to have an understanding of how the automation works. If you don’t understand how it works then you have added a dependency on your success on someone who does. This applies across the board:

  • If you use a commercial tool then you rely on the support team from the supplier
  • If you use open-source then you rely on the internet and the informal development team, but have the opportunity to involve yourself, if you have the skills
  • Similarly if you bring in frameworks or libraries into your automation, if you don’t have the skill sets to read, and possibly amend the code, then you limit the level that you can understand or fix them.

Regardless, we have to have some sort of way of deciding if the automation process supports your test approach, or not.

As to “Who can use automation?”. If you don’t have the skills to move beyond automation as ‘magic’ then you can only use it if an interface has been added to the automation which allows your skill level to engage with it. i.e. automation with one button to start it can be triggered by anyone, but if that is the level of your understanding then you won’t have the ability to intervene when something goes wrong.

This may, or may not, be managed as a risk in your organization.

Many people do not think through what they want from automation to identify if their approach to automation can meet their expectations, or to think through multiple approaches to achieving their aims. Too often we default to: “automate all the scripts”. I recommend thinking through your aims, and identifying options. This will also help you work out if your automation ‘works’ i.e. helps you meet your aims.

If you read the slides then you’ll see that I used the Carl Dreher book “Automation”  as one of the references for the talk.

Carl Dreher’s book is out of print, but I like it, as an historical overview of various forms of automation from mechanical devices through to cybernetics and computing. There are various quirks in language that I enjoyed, particularly the use of “Automationist” rather than “Automator” to describe someone who works on automation.

I also referenced “The Art of Leadership” by Captain S.W. Roskill. Another out of print book, but I can relate to the early sections in Roskill’s book where he describes two traits of military leaders that we don’t always expect from leaders in business:

  • An expectation that military leaders will train and teach as they gain experience
  • An expectation that military leaders need technical skills to ‘lead’ from the front and gain the respect of their troops

In order to balance this out for the business world, I think we make a distinction between ‘managers’ and ‘leaders’. Therefore managers may need to engage with automation in a different way than leaders who exhibit the traits above.

We discussed:

  • Should we convert manual scripts to automation scripts?
  • What would you do in the event of …
    • Single staff member having all the knowledge
    • Immediate “No – can’t be done” to requests for work
    • Staff who are ‘doing their job’ but are finished in half the day
  • How do you know your automation is working
  • How to recruit technical staff
  • What should a test manager do to improve their technical knowledge
  • What should a test programme manager do to improve their technical knowledge

Much of the discussion will remain private because it was provided by the participants themselves.

As add on points – during the discussion, I remember mentioning:

  • Use multiple layers of abstraction to support:
    • different “Who can use?” levels
    • use of automation in different ways, i.e. you can use the automation abstraction as a tool to support your testing, rather than only create non-manual intervention automation
  • Recruit with hands on exercises, i.e. pairing, discussion
  • Automating manual scripts does not lead to effective automation because
    • does not harness the ability for data driven automation (vary non-path invariant data)
    • does not harness the ability to use random data to explore assumptions inherent in equivalence class analysis
    • building on a point made by Adam Knight [http://www.a-sisyphean-task.com/] it does not encourage ‘alternative’ thinking about how automation can help test the system in ways that the script analysis did not identify e.g. API testing, adhoc automation to support defect investigation
  • Coaching without technical knowledge
    • Ask open questions of the team (i.e. non yes/no answers)
    • Ask “How can we…” questions
  • Encourage alternative investigations, but constrain them to time or scope

Some of the points deserve longer blog post on their own. And I will expand on some of these points at the Test Automation Day in June 2015

Hopefully the slide deck will have some points that encourage you to evaluate your own use of automation in your test process, and try something different, or try to investigate in more detail.

Posted in Conferences | Leave a comment

Automation Abstractions: Page Objects and Beyond – Conference Talk

I presented “Automation Abstractions: Page Objects and Beyond” as a conference talk at Star West 2014 and Oredev 2014

Essentially the same talk, but Oredev had a slightly smaller timeslot for the talk, so I summarised the verbage a little.

I have uploaded the slides to slideshare

And the source code is in my svn repo.

The talk was filmed and recorded by Oredev, unfortunately the audio doesn’t appear to have recorded properly and is very quiet in their released vimeo video..

However, I have subsequently amended their video and re-processed the audio so you can hear it, and released it on YouTube and you can watch it below.

Posted in Conferences, Practices | 3 Comments

Speedrun install for WebDriver 2.43.1 on Mac OS X 10 Mavericks

I added the notes and video for my ‘speedrun’ install of WebDriver 2.43.1 with Java, Maven and IntelliJ on the speedrun page.

I used VM Fusion to create a VM on my Mac with a clean install of OS X 10 Mavericks, then went through the process of installing on the Mac.

I updated the speedrun checklist to account for the Mac OS differences, and made notes on the install.

For some reason, when I installed on my ‘proper’ mac, I didn’t have to set the JAVA_HOME variable, but I did on the VM, so the video shows a full environment setup for JAVA_HOME, M2_HOME, M2 and updating PATH.

I found it interesting how Mac prompted me to the correct location a few times – ie. the install of JDK 1.8, so I did this earlier in the process than I did with Windows XP.

Also, since Mac OS X 10 Mavericks is slightly more ‘modern’ than Windows XP, I didn’t have to install an alternate browser to download the files, or an alternate text editor to amend the pom.xml file and update it to version 2.43.1 of WebDriver.

I edited the video down to 13 minutes, although the elapsed time (if I exclude the Wifi failure I had in the middle, was about 45 minutes).

You can find the speedrun video and installation notes on the speedrun page.

Posted in WebDriver | Leave a comment

First WebDriver Speedrun Install added

I have created a new page on the site for ‘speedruns’

seleniumsimplified.com/speedrun-installs

These are start to finish single run install of:

  • Java
  • Firefox
  • WebDriver
  • Maven
  • IDE
  • And running first test from command line and IDE

They have been edited to remove the boring bits, have annotations as simple explanation, but no verbal commentary.

I have an install checklist on the page, but you can also find that in our ‘start’ github project.

I’ll add more speedruns for different operating systems and versions over time.

For now, I have added Windows XP (using the modern.ie).

If you need more help getting started than the speedrun offers then watch our free get-started course or the free preview videos on our full course.

Posted in Training Courses | Leave a comment

Selenium WebDriver Page Object Abstractions and Beyond

I’ve been collating my thoughts on Page Objects and Abstraction Layers, particularly the implementation of them using Java.

I presented my initial thoughts at Let’s Test 2014 in a half day workshop. This could easily have been a full day workshop to allow for more experimentation with the different coding styles.

I released the slides to the tutorial on slideshare.

I confess to some nervousness about releasing the information since I don’t normally release the slides to tutorials and courses in case it cuts down on the value of running the tutorial or course again.

But, in this case, I don’t see enough information on the web about multiple Abstraction Layers and different ways of doing Page Objects, so I thought I’d throw my work out there, along with the supporting source code.

I’m presenting this material as a ‘talk’ rather than a workshop at StarWest 2014, and at Oredev 2014.

On a related note. I fronted a discussion at the Test Management Summit 2014 on Automation Abstractions. The slides for which were taken from the above presentation.

The aim for the slides and presentation is to demonstrate multiple approaches, so that people don’t just pick up the first ‘framework’ they see, or build ‘Page Objects’ without thinking through the modelling approaches open to them.

In the code and presentation I have examples of:

  • Page Objects
  • Page Objects that synchronize as slow loadable components
  • Navigation separate from Page Objects
  • Domain Objects
  • DOM WebElement abstractions
  • and more…

The code and slides demonstrate some of my biases.

The main point is that ‘none of these approaches are best’, and we make decisions when we build our automation. We should take responsibility for those decisions and experiment with what works best in our environment, with our coding skills, with our development standards, for our application.

I’ll expand this material in the future. But I hope it helps somewhat in its current form.

You might also find the slides for my BDD tutorial relevant since I discuss some of my thoughts on BDD and Domain Specific Languages as Abstraction Layers.

Posted in Conferences, Practices | 2 Comments

Selenium Conference 2014

The Selenium Conference “seconf 2014” starts on the 4th of September.

This year, we are one of the sponsors of the conference. Although we can’t attend.

For a limited time, to celebrate the Selenium Conference, check out our Selenium Conference page for special discounts on our online courses.

I don’t think the conference has live streaming this year. But subscribe to the Selenium Conference YouTube channel as there are sure to be videos from the conference available during September.

Posted in Conferences | Leave a comment

Upgrading the HTMLUnit Version for WebDriver with Maven Dependencies

Since HTMLUnit impressed me so much in my last run through of tests I wanted to see how the current version would perform.

I noticed that WebDriver 2.42.2 uses version 2.14 of HTMLUnit,  but the current version of HTMLUnit is 2.15. I wanted to try 2.15 and see if it made a difference.

I import the full selenium-server dependency since it makes life easy for me.

<dependency>
 <groupId>org.seleniumhq.selenium</groupId>
 <artifactId>selenium-server</artifactId>
 <version>2.42.2</version>
</dependency>

This brings in HTMLUnit 2.14.

To bring in 2.15, I have to add a dependency on HTMLUnit itself in my pom.xml. And, provided HTMLUnit versions are backwards compatible, I should be good to go.

In the pom.xml before I import selenium-server, I import HTMLUnit

<dependency>
 <groupId>net.sourceforge.htmlunit</groupId>
 <artifactId>htmlunit</artifactId>
 <version>2.15</version>
</dependency>

And when I run the tests against this version of HTMLUnit, I discover that a few more tests have failed.

Oh well, I guess the guys at SeleniumHQ know what they are doing, and the picked the best version.

But the point is – you can override the dependencies if you have a specific use case that needs it, or a clash in those dependencies.

 

 

 

 

Posted in Maven | Leave a comment