Selenium Clinic Eurostar 2012 Slides

For some reason I didn’t blog about releasing the slides from the “Selenium Clinic” a tutorial session that Simon Stewart and I presented at Eurostar 2012.

I released the slides which were given to the tutorial attendees up on slideshare.

I was a little nervous about this because of those 72 slides, 50 of them form part of my Udemy course and I put a lot of material, detail, time and energy into them. But I now view them as something which might help people learn more about WebDriver. So I’m learning to let go.

I don’t really update those slides, but I do update the 230+ slides on the Udemy course.

Selenium 2 WebDriver API course

Posted in Conferences, Training Courses, WebDriver | Leave a comment

Selenium 2 WebDriver Java API Cheat Sheets

I have released the cheat sheets that I provide during WebDriver training courses.
These act as reminders of the WebDriver API, basic synchronisation, Hamcrest, JUnit, some tips for IntelliJ and CSS and XPath Selectors.

Feel free to print them out and keep them beside you when you work with Selenium 2 WebDriver to help you increase your familiarity with the WebDriver API.

As Slides:

As Handouts:

Posted in Training Courses, WebDriver | 2 Comments

OperaDriver 1.2 With Selenium 2.32.0 on Windows 8

“Hmm, why aren’t my tests on Opera working any more?”

For those of you that want to skip to the chase and see my hack then I did this, just before I created a new OperaDriver();

System.setProperty("os.name","windows");
driver = new OperaDriver();

And thanks to you for sticking around to see the investigation process…

Caused by: org.openqa.selenium.WebDriverException: 
Could not find a platform that supports bundled launchers, 
please set it manually
Build info: version: '2.32.0', revision: 
'6c40c187d01409a5dc3b7f8251859150c8af0bcb', time: '2013-04-09 10:39:28'
System info: os.name: 'Windows 8', os.arch: 'amd64', 
os.version: '6.2', java.version: '1.7.0_10'
Driver info: driver.version: OperaDriver
    at com.opera.core.systems.runner.launcher.OperaLauncherRunner.
launcherNameForOS(OperaLauncherRunner.java:543)
    at com.opera.core.systems.runner.launcher.OperaLauncherRunner.
<clinit>(OperaLauncherRunner.java:77)
    ... 34 more

Umm. OK. That’s new for me. I wonder how to set the platform manually?

I jumped off to the line of code in the OperaLauncherRunner, which was an enum. Did a quick evaluate on Platform.getCurrent(); which had correctly identified my current operating system as WIN8.

But sadly the switch statement in launcherNameForOS doesn’t cater for WIN8, so I set the platform manually by changing the “os.name” property, and I set it to “windows” to pretend I’m running on XP.

System.setProperty("os.name","windows");
driver = new OperaDriver();

I also used “win7″ and pretended to be VISTA. Same result, so I thought using “windows” was probably the most explanatory in the code.

And viola. My tests were running in Opera again.

 

Posted in WebDriver | Leave a comment

Selenium 2 WebDriver Online Course Reviews

First, a big thank you to everyone who takes the time to post reviews on my Udemy courses. Particularly when they also take the time to leave a comment. As it really helps explain to other people why they enjoy the course.

I also appreciate all the feedback that I receive on the course, even when it doesn’t make its way into a review. The course changes based on the suggestions I received.

Since I’m pleased that so many people have posted positive comments about the course on Udemy, I thought I’d share the reviews here.

Is this social proof that learning Selenium WebDriver is good for you?

Learn Selenium WebDriver API at your own pace with this Online Training Course

  • Reinvigorated my motivation for learning…Alan Richardson’s Selenium training videos have reinvigorated my motivation for learning. His manner and methods are simple, concise and real world. The best teacher I have had in years.
  • One of a kind course on SeleniumI recommend the Selenium 2 WebDriver Basics with Java course because it offers a path through the jungle of automation testing material that is available on the web.Alan is an experienced guide and provides a complete, thorough, precise and detailed course. Lectures are relatively short so it’s all easy to digest and still covers everything that is required to get started in this field.What I really appreciate is the insight on Alan’s automation testing mindset that would probably take years of experience and several mistakes to learn by oneself. That is something that you don’t normally find in a book.Plus he keeps adding material constantly! :)

  • Invaluable course for learning Selenium WebDriver – can’t rate high enough!I have been working my way through this course and have found it invaluable. The course has really helped me improve my knowledge of the Selenium WebDriver API, as well as learn about Maven, Jenkins, not to mention improve my Java skills.The videos are clear to understand and Alan has been quick to respond to any queries I’ve had and added further explanatory videos where necessary.I can’t rate this course highly enough…..those interested in improving their skills and continually learning – this course is for you!Thanks Alan.

  • Highly recommend this course ‘WebDriver basics with Java’Alan Richardson does a fantastic job teaching WebDriver in this course. You will be able to get tests up and running even if you do not have a lot of experience. Alan covers all aspects of WebDriver and spends a lot of time covering the nuances that are important to making the tests run reliably. I have learned quite a bit from this course and recommend this to other people who wish to get more proficient with WebDriver. Great job Alan!
  • SuperbI can’t rate this highly enough. It’s a superb example of a successful and engaging online course, which is no small accomplishment given the complexity of Java and Selenium, as well as the many related topics the instructor touches on which all relate to the job at hand.The course has taught me a ton about Selenium and quite a bit more about Java, JUnit and the IntelliJ ide as well. I don’t know how long it would have taken me to get up to speed on this stuff purely on my own!The videos are well produced and to the point. The audio is a bit low, but otherwise very clear and consistent.This is not one of the cheaper courses, but I can say it is well worth the price of admission if you’re looking to learn Selenium.

  • Excellent coverage and code examples!
  • Fantastic contentI bought Alan`s ebook and now I am glad that Alan provided course in Udemy. It is very practical and very useful. Thank you very much for you hard effort Alan.

You can review the course syllabus and join the course on Udemy.

Posted in Training Courses | Leave a comment

Online Selenium WebDriver Course amendments

I’m giving my Online Selenium WebDriver Training courses a bit of minor overhaul.

I’m in the process of increasing the volume across the “Selenium 2 WebDriver API” course. I’m working backwards through the lectures so that the volume increase becomes a pleasant surprise rather than experiencing a decrease.

I try to do a section a day, and I’m currently down to section 19, so I’ll do section 18 tomorrow. Hopefully I’ll manage to get them all done by the end of April.

I’ve also changed the course images to make them more attractive and pleasing to the eye, or at least as good as my graphic design skills will allow. They all have a consistent feel to them, with a randomly chosen colour swash that I found aesthetically pleasing.

The Comprehensive Online Selenium WebDriver API Course looks like this:

Comprehensive Learn Selenium WebDriver API Online CourseA rather lovely shade of Orange methinks.

The full course helps you learn the Selenium WebDriver API Online at your own pace.

The Free Online Selenium WebDriver Course looks like this:

Free Introductory WebDriver Course

The free course helps you learn how to get started with the IDEs, installing maven, and all the other setup tasks you need to do before you can really start learning Selenium WebDriver with Java. Again the course is online at Udemy so you can go through it at your own pace.

Every amendment on Udemy takes me out of the search listings, but Most of the traffic to the course comes via this website or word of mouth. So that isn’t really an issue.

What do you think of the new logos?

Posted in Training Courses | Leave a comment

Click on “html” to make User Interactions more reliable

I have been lucky over the years that when I put out some information into the world, and I get to learn from the people who consume that information.

I received a lot of good feedback from readers of “Selenium Simplified” about what they found easy to understand, and what they didn’t, and that all helped with future editions and when I was constructing the Udemy course.

And I get to learn from the people on the Udemy course itself.

I’ve always found Advanced User Interactions in WebDriver intermittent to use.

Recently Kent Wood, one of the people taking the Udemy course wrestled this particular bug bear to the ground using a method I haven’t seen before, but Kent managed to find from trawling the internet.

To put focus on to the page, before issuing any user interaction commands, click on the “html”.

Seems simple, but I hadn’t used this before.

driver.findElement(By.tagName("html")).click();

Kent describes it on his blog:

Thanks Kent.

Posted in WebDriver | 2 Comments

Second Selenium WebDriver Webinar released to Youtube

The second in our ‘live coding’ webinars has been released to YouTube.

You can find the embed below.

Slides have been uploaded to SlideShare

Sourcode is under svn with xp-dev: https://xp-dev.com/svn/webdriverwebinars

The second webinar follows on directly from the first Webinar. Which, if you haven’t seen it, you can find details on this very blog.

In the first webinar I create a basic test after investigating the application under test. In the second I refactor this into page objects.

I’m mainly using the webinars to explain concepts and thought processes and a brief summary of what I think I remember I said:

  • keep your code and page objects as simple as you can for as long as you can
  • just because everyone else adds a login method to the login page, doesn’t mean you have to
  • I use page object to model the physical world
  • I use other objects to model transactions, workflows and user journeys
  • keep navigation separate from page objects to start with
  • Refactor to page objects
  • Write the test code the way you want it to look
  • Write code to call methods that don’t exist and have the IDE create them

I didn’t go into many of the WebDriver API Page Objects very much, since I cover that on the Udemy course.

The recommended reading for participants on the webinar was:

I find that when I’m coding for speed for consultancy production projects I use the Slow Loadable Component a lot. I’ve linked to the java docs above, but it also exists in .net as well. The .net API is slightly different than Java but the basic concept is the same. I’ve used both and I find that for speed of construction with minimal synchronisation issues, I use it a lot.

I think I worry about page objects more than other people. And that really deserves its own post. So I’ll quickly summarise what I worry about.

I worry that people don’t think about the page object as an ‘object’ they treat it as a dumping ground for everything to do with interacting with a web application, rather than a clean set of abstractions. Hence why I try to keep things separate and simple for as long as I can.

And the reason I say that? Because I have started complicated before, and have had to unwind code and had to ‘code around’ mistakes I made.

Keep it simple for as long as you can.

Posted in WebDriver, Webinars | Leave a comment

Patterns for Automation – Some Twitter Feedback

I received feedback, via twitter, on webinar #1 from Roy de Kleijn (@TheWebTester)

I don’t really like twitter as a conversation tool. I lose a lot of nuance and the ability to elaborate.

The basic twitter conversation read:

  • Roy: “It’s a pity that there are no design patterns in the source. Any reason for this?”
  • Alan: ”Yes. I don’t start with patterns. I code for value, then generalise as needed. I did use domain objects, a pattern of sorts.”
  • Roy: “fair enough, what about the value of maintenance? I usually start with patterns because people work in bigger environments”
  • Alan: “In the webinars I will grow the code, explaining my decisions at each point. Patterns will influence me as the code grows.”
  • Roy: “valid reason :) it was just something I noticed…”
  • Alan: “:) good, keep commenting, we have to choose between coding styles, and justify our decisions, so all questions help”
  • Roy: “or choose both and let the scripts evolve.We have the challenge that also (a lot) non-technical people joining the trainings. how you deal with that ?”
  • Alan: “During training I explain my decisions. I point out alternatives, and “but right now, I choose this because… x, y and z”
  • Roy: “What about if people don’t have program skills/experience at all ? are they in the wrong place ?”
  • Alan “I believe people who want to learn, can do so quickly, via osmosis, of stuff they don’t yet grasp, when they see it done.”
  • Roy: “I like the idea of osmosis, will try to do this more during next trainings… Thanks for your advice!”
  • Alan: “You’re welcome. Hope it helps.”

And I want to elaborate on the conversation above in this post because I think Roy draws out a bunch of really important points here.

If anyone else has feedback, feel free to leave a comment or twitter message to @eviltester.

What no patterns?

In the webinars, I code the way I code in the real world. With the difference that I explaining as I go. And I find that hard, I won’t discuss that here, but I don’t feel used to doing that. I want to do that in the webinars because it helps people understand the decisions I make, and I that helps me draw down on experience that the participants in the webinar may not have.

e.g. If I choose to write a class with a public final field rather than add an accessor method then I explain that I could add an accessor method, but at the moment I want to encourage the flow of coding, and I want to write code that maintains the flow. I need something that I can access, which has a value, which won’t change. And an accessor method can give me flexibility in how I calculate or generate that value. But at that precise moment I don’t really need that flexibility. I might need it in five minutes time, but I don’t need it now. So I also try to explain that I can change this at any point in time.

The knowledge that it can change quickly allows me to make decisions quickly. Knowing that I will revisit the decisions that I have made.

I try to adopt a flexible approach when I code. And sometimes I experiment with approaches to see how far I can simplify them before I experience pain. I don’t necessarily have the aim to set out an exemplar coding style in the webinar code, but I do want to make people aware of options.

I build what I need, when I need it, and evolve

I also don’t start with patterns. I have experience of patterns, but I don’t start there. I know when I write tests that I’ll probably need Page Objects, but I don’t start there. I let the test itself justify the need for scaffolding around it.

  • If I only ever right one automated test on a project. I don’t need a Page Object.
  • If I write two test methods, for the same page then I don’t yet need a Page Object. I need some local methods in the test class to avoid repeated code.
  • If I write three test methods, and they no longer all reside in the same test class. Then I might think about a page object because the repeated code I need has different classes accessing it.

Now I could have started with the Page Object, because I thought I’d write a lot of tests. But I don’t.

I write simple code. Refactor chunks out into higher levels of abstraction, as the use of that abstraction becomes necessary. And when I refactor into higher levels of abstraction, the patterns and aproaches that I know, help me decide how to refactor.

I think that this leads to maintainable code. And it also leads to code which I own and have an attitude of non-permanence towards. i.e. I don’t start with patterns, so I don’t think my code has a good design. I refactor based on usage, so as I see better ways of using it, I will change it, constantly.

The code we write should add value

I think this also forces the code to add value.

A test method, with no abstraction, written quickly, can add value faster than a framework and set of Page Objects, with no tests that use them.

What about maintenance?

I don’t believe Roy meant “create a framework” when he asked about maintenance. I think he meant – “Alan, you don’t just ignore maintenance and longer term concerns do you?” and I don’t, I evolve to them.

I take this approach when I code. And I take this approach in the Webinar. Explaining my decisions and pointing out alternatives as I go, and making decisions, that I can justify and explain while understanding the pros and cons of each decision. Because each line of code offers us a decision point and we have to understand why we make the decision we make to code intelligently.

What about experience?

Roy also brings up the point about, what “if people don’t have program skills/experience at all”. Can they learn like this?

I believe they can. I don’t pretend to have expertise in learning theory. But I know the approaches I take to learning.

The Webinars use an osmosis learning style. By watching someone do something you see that someone can do the task. You have evidence of the possibility. So you know when you come to do it, that it can work. Useful knowledge for a beginner because beginners make mistakes, and if you don’t know the mistake originates from you, instead you think that you have encountered an impossible action, you stop.

When I studied at University, I read as many books on each topic as I could. Regardless of whether I had the necessary knowledge to understand that particular section in that particular book. Because I knew that if I read a lot of them, and read them quickly, then my brain would assimilate the information and I would advance more quickly through the material that the linear tutorials and lectures led me through.

I recommend reading around your study topic as much as possible. Quickly. Jump backwards and forward through the material. Jump to advanced, so when you come back to your current ‘ready for it’ level, then it seems simple in comparison, and you have foresight into where it will go.

I use this experience as a basis for the Webinars. The linear progression in the webinar comes from the creation of the tests and the automation. But the knowledge around that comes out of order, I base it on experience, I’ll name drop Page Objects without explaining them, etc. because people will take what they need at that time and develop an awareness for other concepts that we will refer to again because they form part of the automation context and domain.

I have designed the webinars to supplement self study and other linear styles of learning e.g. the Udemy courses I put together have a linear path through the API, or a linear path through the initial setup steps.

Thanks to Roy for the twitter questioning. And hopefully you can see why 140 chars don’t let me fully express myself.

Recommended Reading:

And in a spirit of giving you more information to explore, I recommend:

  • Kent Beck‘s “Implementation Patterns” book, which encouraged me to keep things simple
  • Steve Freeman, and Nat Pryce “Growing Object-Oriented Software“, which helped me see additional nuances around growing code

By the way. I’m not suggesting that either of these books or people have recommended the approaches I’m describing. But I think the books do a similar job of explaining decisions as part of the coding process.

P.S.

I sent this blog post to Roy to review to make sure he was happy with the name check. And he gave me his approval. He also said.

“One note: I think if you work with multiple people on the same automation project, you will need some structure or patterns.

Don’t you think ?

For a small web application this approach is fine, but if you do automation for a bank or insurance company… And you are part of a team of automated testers..”

And I do agree that Yes, when working with multiple people you need to introduce structure at some point. And I think I’ll cover that in a different blog post in more detail… later.

Posted in Webinars | Leave a comment

How to practice Selenium WebDriver FAQs

I receive a fair few emails from people asking if they can have the code to the web pages in my training and what other sites they can use to practice on. So consider this an FAQ post.

Question 1: Can you have my code?

Yes, I released it as open source

Please don’t use it to train people, but for personal use and practice. Knock yourself out.

Question 2: What do you practice on?

For some reason, people seem to practice on Google.com a lot. I don’t recommend this because it keeps changing, and they probably run A/B tests so sometimes you get one setup and another time a different one. When you are starting you want to use something simple.

Having said that, Simon and I did use Google in our WebDriver tutorial for Eurostar, and you can see the code for that on Simon’s github account.

I like to use the GWT Showcase, because it has some remarkably gnarly output, and it doesn’t seem to change too often.

In fact I liked it so much that I wanted a cut down version to help people practise on that wasn’t so heavyweight on the install side. So created a smaller clone, which has some deliberately horribly code for automating against.

 

Posted in Links, WebDriver | Leave a comment