Friday

Repost - Notes: Selenium 3, the Spec, and Onwards by Simon Stewart

Notes: Selenium 3, the Spec, and Onwards by Simon Stewart

Title: Selenium 3, the Spec, and Onwards
Speaker: Simon Stewart, Selenium Project Lead
Host: Applitools
Date: Wed. May 25, 2016 @ 1:00 PM EDT
Duration: 60 minutes

Summing up Simon's Webinar:
  • Selenium 3 (no release date given) will be a removal of all old Selenium RC code into a legacy library called "leg-RC".
  • Selenium 4 will move closer to the new W3C WebDriver Protocol they have been pushing for.
  • Selenium 5 will be the full W3C WebDriver.

Before that information was given at the end of the talk, Simon took a long walk down Memory Lane...


How Selenium Started


Jason Huggins ( @hugs ) at the consulting company, ThoughtWorks, was in Tech Support working on a new web application to track time and expenses. Jason would fix one bug only to have it appear in another browser. He saw Ward Cunningham FIT (Framework for Integrated Test). Jason took this idea and realized that all browsers handled HTML differently, but all browsers used Javascript. Perhaps this could be leveraged?


Selenium Core was created. It could manipulate the DOM (Document Object Model), simulate clicks.

Tests, like with FIT, were was based on HTML tables. Selenium Remote Control (RC) was a good tool to start automating tests. He worked with Paul Hammant to add new functionality to it, where people could use the programming language of their choice.

Two years after Jason stated, Simon Stewart was using HTTPUnit for browser testing… and the web browser was rubbish (See the official home for HTTP Unit). HTTPUnit was in a gross violation of object oriented programming. Someone mentioned that people should put in wrappers around the functionality. He did this through six or seven iterations.

Simon borrowed the word WebDriver from another project. He wrote a fresh version, a “clean room” version of what he did before. At the time he though he would be done, back in 2007, and he thought he would be done in a year. Maybe two.

Jason and Simon met up when they both moved on to Google. At the time, AJAX was becoming popular. The problem was that you couldn’t just simulate a click. You had to emulate the mouse down and mouse up. As web application were becoming more sophisticated, it became harder to emulate what needed to be done.

Simon foolishly he said, wrote versions of WebDriver tightly coupled to the browser. Paul Hammant, Simon said, called him an idiot for doing this. The product became branded Selenium 2.0.

What is Selenium 3?


Simon once announced three years ago they would release the next version of Selenium WebDriver by Christmas... Luckily, Simon joked, he didn’t say what Christmas.

"What is in Selenium 3 and why are we bumping in a version number?"

Only the current Selenium WebDriver API will be there. All outdated Selenium Core code will be taken out.

With the Python and Ruby bindings, there will be practically be no changed. Java though… it will be breaking up into three separate libraries:

Selenium-Java:
  • Just the WebDriver classes. 

Selenium 3 Server: 
  •  Lightweight command line compatible remote server. 

leg-rc:
  • The old Selenium client-side classes.
  • WebDriverBackedSelenium.
  • Remote end point for SEL server. 

... As Simon said, “This is why the team doesn’t let me name things very often. I like a bad pun”.

If you are still using Selenium RC, there will be upgrade paths. New implementation of HTML table runner. All of this work is placed in for those who made a huge investment with Selenium RC.

Continue reading here: http://www.tjmaher.com/2016/05/notes-selenium-3-spec-and-onwards-by.html

Monday

Install Node.JS and npm behind a firewall / company proxy - Galen Framework




Problem: Unable to install npm behind the proxy

Solution: Similar to what we did when we installed git http://go-gaga-over-testing.blogspot.com.au/2015/04/setup-github-within-companys-firewall.html behind a company's firewall we shall edit the config settings for Node


  1. The best way to install npm is to install node using the node.js installernpm is installed as part of node.
  2. The problem occurs when you clone the Node repository from Github
  3. npm uses a configuration file and it can be added to via the command line npm config set ...
  4. To get packages behind a proxy
    1. npm config set strict-ssl false
    2. npm config set registry "http://registry.npmjs.org/"
    3. npm config set proxy http://"username:password"@proxy:8080
    4. npm config set https-proxy http://proxy-server-address:8080 
Update: Try changing to npm config set registry "https://registry.npmjs.org/"

Update:

You can skip the username password and just hardcode the proxy and registry URL so that npm wouldn’t have to look for it, so in the end, I had an .npmrc that looked like this:

proxy=http://proxy details:8080
https_proxy=http://proxy details:8080
strict-ssl=false
ca=null
registry=http://registry.npmjs.org/

And If you are installing the Galen Framework on Windows just like me then use the manual installer:
http://blog.teamtreehouse.com/install-node-js-npm-windows

Wednesday

Selenium 3.0 will be out soon!



For anyone who is interested: http://lp.applitools.com/selenium3/

In 2016, the Selenium Project is working hard to (finally!) ship 3.0.

Join Simon Stewart on May 25, and discover:
  • What will this release contain
  • What impact will it have on your test runs
  • How can you preserve your existing investment in tests using the Selenium WebDriver APIs, and your even older RC tests
  • Looking forward, when will the W3C spec be complete
  • And what can we expect from Selenium 4

Speaker: Simon Stewart
At ThoughtWorks, Simon invented WebDriver. At Google, he became the lead of the Selenium project and built the infrastructure required to run millions of browser-based tests every day. At Facebook, Simon advocated for a monorepo, setup the mobile end-to-end testing frameworks, and lead the Buck build tool team, all of which helped slash the time from code to release.

Tuesday

Maven run tests from commandline - CheatSheet





PurposeCommand
Run all tests mvn test
Run using testng verifymvn verify
Run the allure reports mvn site
Run a single maven test within a class mvn -Dtest=TestObjects#ostiariusAddUserWithCancel test
where "TestObjects" is the test class name and "ostiariusAddUserWithCancel" is the test method.
Run all tests within a groupmvn test -Dgroups=slow test
Run all tests within a classmvn -Dtest=com.amedia.qa.automation.testcases.testgoogle.TestGoogle test
mvn clean test -Dtest=xxxxTest
Only runs all the test classes ending in PerformanceTest.mvn -Dtest=*PerformanceTest clean test
To run test suite xml filemvn test -DsuiteXmlFile=src/test/resources/testsuite/test.xml

Further Reading: http://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html

Monday

Endless loading screen when open Allure report using Chrome / Internet explorer browser

Problem:  Endless loading screen when open Allure report using Chrome / Internet explorer browser
This means that report data failed to load. Possible solutions:
  • When opening the report from the local file, either open it in Firefox or launch Chrome with the --allow-file-access-from-files flag. For other browsers, you need to enable cross-origin requests to local files.
  • Windows
    1. Exit any running-instance of chrome.
    2. Find the shortcut you normally use to launch chrome.
    3. Create a copy of it
    4. Right click on the new shortcut, and select Properties
    5. At the very end of the Target: text box, add a space and then the desired command line flags (--allow-file-access-from-files)
  • Upload the report to the web server and open it from there
  • If you get a 404 error from the remote server, check logs in order to verify that the report was built successfully.
  • If your test framework is JUnit, check that you're using version 4. Allure is incompatible with version 3 of JUnit and that's why no data is gathered from tests.


Source: https://github.com/allure-framework/allure-core/wiki/FAQ-and-Troubleshooting

Open Source Test Reporting Frameworks



Inspired from the previous post on Test Automation Frameworks, Reporting frameworks play an important part in these frameworks. So here are some of the best open source reporting frameworks out there:

  1. Extent Reports
  2. Serenity (Formally Thucydides)
  3. RedwoodHQ
  4. Allure
There are other frameworks like TestNG/ReportNG but we are looking at more robust reporting frameworks with graphical outputs that fit into the CI/CD world.
Happy Reporting!

Wednesday

Open Source Test Automation Frameworks



Every-time I read Joe Colantonio's posts I learn something new and this time it was a newbie called Gauge.
If you don't know what it is here are the 6 opensource frameworks Joe talks about:

  1. Serenity (Formally Thucydides)
  2. Robot Framework
  3. RedwoodHQ
  4. Sahi
  5. Galen Framework
  6. Gauge
Update: 
Two more to the list:
  1. An old one Open2Test
  2. New: Extensive Testing
Further Reading: http://www.joecolantonio.com/2016/05/10/6-open-source-test-automation-frameworks-need-know/

Tuesday

Serenity Maven Cucumber - Only run specific scenarios



Problem: While using the serenity cucumber framework with maven run only specific scenarios or feature files

Solution: To run only individual feature, run a specific tag say @wip

Work In Progress tag @wip

mvn verify -Dcucumber.options="--tags @wip"

mvn verify -Dcucumber.options="--tags @wip @debug2"

More -DCucumber.options here: http://cucumber.github.io/api/cucumber/jvm/javadoc/cucumber/api/CucumberOptions.html#tags--

You can also do this by creating test runner class for each .feature file:
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features = "src/test/resources/features/search/search_by_keyword.feature")
public class SearchByKeyword {
}
Triggering this as any other test class, would execute only the SearchByKeyword.feature.