Planet

Automation Services Week 6 February - 10 February

Automation Services, the team I co-lead with Henrik Skupin, are going to start sending out weekly updates so that everyone can be aware of what we have been upto in the last week on our main projects.

Nightly Tester Tools

Our team is now taking ownership of the addon from Heather Arthur. This extension has over 100000 active users at the moment and we want to grow that community. We need to still do a few logistical things with Heather to get it moved over and we hope to have this sorted in the next few weeks. Once that is done we will do some house keeping on the project like changing the repository structure and getting build scripts in place. Next quarter we hope to do some work on the project and will create some issues out that will be mentored by someone in the team for anyone to work on!

Actually we will be creating mentored issues for a lot of our projects at the moment and will have a central place for these soon! In the mean time you can have a look at:

MemChaser

One of the major projects on the go at the moment is a project to see where we have large GC/CC pauses in the browser. Long pauses lead to the browser feeling jerky which isn't a great user experience. Last week Henrik blogged about the MemChaser 0.1.1 release and got a couple of good comments! It has helped identify a few bugs. A really good example is where we identified memory leak with Add-ons SDK bug, which is already partly fixed for SDK v1.6 and even for the upcoming v1.5 release. Currently we have over 1000 downloads and nearing 400 active daily users (statistics). We need to get docs in place for further planning on the project but this is a great start!

Look out for future updates and if you want to join our team meetings you can get all of the details at here and you can also get notes from previous meetings.


Summer of Code 2012

Google has announced that they will be running the Summer of Code again this year, 2012. The Mozilla Project has had the honour of participating in every SoC so far, and intends to submit a request to take part again. This means we need to produce a list of suitable student projects in the next four weeks.

For those who are not familiar with it, Summer of Code is where Google pays students to work on free software projects – as long as those projects can provide support and a mentor for the particular task the student is undertaking. This is a great opportunity for us as a project to introduce new people to Mozilla, and for you as an individual to get new people involved in your team :-) In the past, it has been the source of major features of our flagship products. For example, the 3D web page debugging tool Tilt started life as a SoC project.

It doesn’t matter where in Mozilla you contribute. We are collecting project ideas for every part of the project – Firefox, Thunderbird, Camino, SeaMonkey, Bugzilla, L10n, NSS, B2G, IT and many more. Can you think of an 8-week-sized task you might be able to guide a student through?

If you have a proposal, head over to the Brainstorming page, whcih is our idea development scratchpad. Please read the instructions at the top – following them vastly increases your chances of your idea getting added to the formal Ideas page.

Note that, in order to have much chance of going ahead, ideas need to have a suitable mentor. So if you submit an idea and you aren’t available to or suitable to mentor it, you may want to go about trying to find one by politely emailing experienced hackers in the appropriate areas of the code.

Automating BrowserID with Selenium

BrowserID is an awesome new approach to handling online identity. If you haven’t heard of it then I highly recommend reading this article, which explains what it is and how it works. Several Mozilla projects have already integrated with BrowserID, including Mozillians, Affiliates, and the Mozilla Developer Network.

With all of these sites now integrating with BrowserID (and more on their way) we needed to add support to our test automation to handle the new sign in process. Initially we started to do this independently in our projects, but the thought of updating all of our projects whenever a tweak was made to BrowserID was daunting to say the least! For this reason I have created a project that contains a page object model for BrowserID. This can be included in other projects as a submodule and then updated and maintained centrally.

The new project is called ‘BIDPOM’ (BrowserID Page Object Model) and can be found here. It currently only contains a page object for the Sign In page, however this currently meets the needs of the automation for projects that have integrated with BrowserID. As we have a mix of projects using Selenium’s two APIs (RC and WebDriver), it was necessary for BIDPOM to support both.

By adding BIDPOM as a submodule, we can easily pull the BrowserID page objects into our automation projects and reference them in a very similar way to the main project’s page objects. We can also update the version of BIDPOM simply by updating the git link and updating the submodule. What’s even better is that our continuous test builds running in Jenkins automatically initialise and update the submodule for us!

I hope that in addition to being a dependency for our own automation projects, this page object model can be utilised by others wanting to create or maintain automated tests using Selenium against sites that adopt BrowserID. If you would like to start using BIDPOM then I have provided below a guide to adding the project as a submodule to an existing git repository.

From within your project, add the BIDPOM project as a git submodule:

cd ~/workspace/automationproject
git submodule add git://github.com/davehunt/bidpom.git browserid

This will add an entry to .gitmodules and clone the BIDPOM project to the browserid subdirectory. It will also stage the new gitlink and .gitmodules items for commit.

You can now commit these changes to your project’s repository:

git commit -m 'Added BrowserID page object model as submodule.'

Before you can test the new submodule you will need to run the following command to copy the contents of .gitmodules into your .git/config file.

git submodule init

Now you can test the submodule by deleting the browserid directory and allowing it to be recreated:

rm -rf browserid
git submodule update

The BIDPOM project should be cloned to the browserid directory.

You will now be able to integrate your project with BrowserID! Here follow a few examples of how to integrate your project.

Example: Short sign-in using Selenium’s RC API

1
2
3
4
5
6
...
selenium.click('id=login')
from browserid import BrowserID
browser_id = BrowserID(selenium)
browser_id.sign_in('testaccount@example.com', 'password')
assert selenium.is_visible('id=logout')

Example: Long sign-in using Selenium’s RC API

1
2
3
4
5
6
7
8
9
10
...
selenium.click('id=login')
from browserid.pages.rc.sign_in import SignIn
signin = SignIn(self.selenium, self.timeout)
signin.email = 'testaccount@example.com'
signin.click_next()
signin.password = 'password'
signin.click_select_email()
signin.click_sign_in()
assert selenium.is_visible('id=logout')

Example: Short sign-in using Selenium’s WebDriver API

1
2
3
4
5
6
...
selenium.find_element_by_id('login').click()
from browserid import BrowserID
browser_id = BrowserID(selenium)
browser_id.sign_in('testaccount@example.com', 'password')
assert selenium.find_element_by_id('logout').is_displayed()

Example: Long sign-in using Selenium’s WebDriver API

1
2
3
4
5
6
7
8
9
10
...
selenium.find_element_by_id('login').click()
from browserid.pages.webdriver.sign_in import SignIn
signin = SignIn(self.selenium, self.timeout)
signin.email = 'testaccount@example.com'
signin.click_next()
signin.password = 'password'
signin.click_select_email()
signin.click_sign_in()
assert selenium.find_element_by_id('logout').is_displayed()

For the latest documentation on the BIDPOM project refer to the github wiki.

i < 3 theopenweb - January on the Web

The second installment of the i < 3 theopenweb . In it I go over recent events and give you some of my favourite links related to the Open Web and the Federated Social Web.
 
Links of the week
 

  • Open*Life: 2011 in review
    • A second great year on opensource.com has proven even more that openness can improve just about anything. No matter what you're interested in, we've had a story for you.
  • Mozilla Public License 2.0
    • Congratulations to Mozilla on the release of the Mozilla Public License 2.0 after a two year versioning process. As Mozilla chair Mitchell Baker writes “Version 2.0 is similar in spirit to the previous versions, but shorter, better, and more compatible with other Free Software and Open Source Licenses.”
  • Facebook Poses a Far Greater Threat to the Web than Apple
    • Facebook’s goal is to consume the entire web, like a social media analogue to Matt Taibbi’s now-iconic “vampire squid”, giving users little reason to venture outside of the service. Facebook is collecting the entire Internet for its midden pile: social gaming, email, Skype, Netflix, Spotify, cloud documents, and now news
  • Richard Stallman Was Right All Along
    • Late last year, president Obama signed a law that makes it possible to indefinitely detain terrorist suspects without any form of trial or due process. Peaceful protesters in Occupy movements all over the world have been labelled as terrorists by the authorities. Initiatives like SOPA promote diligent monitoring of communication channels. Thirty years ago, when Richard Stallman launched the GNU project, and during the three decades that followed, his sometimes extreme views and peculiar antics were ridiculed and disregarded as paranoia - but here we are, 2012, and his once paranoid what-ifs have become reality.
  • Google open sources new HTML5 video tool
    • The 'search giant' has pushed its latest HTML5 video tool to open source.

      The new Video Player Sample is built with open web technology and is designed to allow developers (and other users) to wrap video up in the required code to be able to release it as a web store application.

      It acts as a basic video player too, if that's all a user is looking for.

  • Unhosted -- freedom from the web's monopolies
    • Web applications usually come with storage attached to it, users can not choose where their data is stored. Put plainly: You get their app, they get your data. We want to improve the web infrastructure by separating web application logic from per-user data storage: Users should be able to use web services they love but keep their life stored in one place they control .
  • Enhanced Privacy and Security for Web Browsing
    • One thing many people agree the FreedomBox should do is web filtering for privacy and ad-removal. Toward that end, the FreedomBox will act as a web proxy to clean up and protect web traffic.
  • January 18 captured: A SOPA blackout gallery
  • Thank You, Internet! And the Fight Continues
    • Working together, we sent a powerful message to Big Media and the misguided proponents of the Internet blacklist legislation: we will not stand idly by and let you hamper innovation, kill jobs, wreak havoc on Internet security, and undermine free speech. Supporters of SOPA and PIPA say the Internet Blackout day was a "publicity stunt." We say it was a wake-up call.
  • The top 20 HTML5 games
    • HTML5 is quickly turning into a great game development platform. Rob Hawkes, creator of multiplayer space shooter Rawkets, highlights some of the best online games built with HTML5 (and JavaScript) out there and the technologies that they’re using.
  • Google announces privacy changes across products; users can’t opt out
    • Google will soon know far more about who you are and what you do on the Web.

      The Web giant announced Tuesday that it plans to follow the activities of users across nearly all of its ubiquitous sites, including YouTube, Gmail and its leading search engine.

  • Help Protect Gadget Jailbreakers and Video Artists from Legal Threats
    • EFF Launches Petition Campaign for Expanded DMCA Exemptions

      San Francisco - The Electronic Frontier Foundation (EFF) is asking the public to join the campaign to keep and widen exemptions EFF obtained in 2010 to the Digital Millennium Copyright Act (DMCA) to help remove a cloud of legal uncertainty hanging over folks who modify electronic gadgets and make remix videos.

 

This is only the second installment of the i < 3 theopenweb so if you have ideas for improving the newsletter or would like to make a contribution to the next installment please leave a message in the comments. Thanks.

 

Mozilla from the outside.

 
From next week we will start taking a look at the OStatus protocols starting with OpenID
 

Track of the week
John Foxx & The Maths – A Falling Star on Spotify

Tags: 

Automating Web Performance data collection with BrowserMob Proxy and Selenium

Back in 2008, David Henderson and I wanted to try automate collecting client side performance data for the web application that we were working on at the time. We were getting a large number of complaints from users about load time and we need to try solve this. The way that we decided on doing this was to use Selenium, which was already running our tests, and hack the Selenium server to give us the information we needed. What we came up with was showcased at GTAC 2009. It was really good for the time and we were happy.

About a year later just as the new movement for HTTP Archive or HAR as its commonly known was taking off I found that Jan "Honza" Odvarko had created a Firebug add on to export the network tab to HAR. This, when used with Selenium, could mean that we could get the same data that the browser wanted with little to no effort. Run your tests as you were with the new WebDriver API and get it to programmatically install the necessary addons as well as set all the preferences needed. I wrote this for Python and for .NET. This works really well but now limits this type of data to only being collected within Firefox. Some modern web applications can send back totally different javascript and sprites dependant on which browser hits.

What if you could run your Selenium tests and collect the same info as the if you were using the Firebug Net tab but using any browser. Browsermob Proxy is a good way to collect this information and it has a programmatic interface that allows us to set it before our tests start. It can also return a HTTP Archive of the traffic that it is routing. I have released the Python Library for BrowserMob Proxy that can be injected into tests quite easily. I have put an example below.

from browsermobproxy import Server
server = Server("path/to/browsermob-proxy")
server.start()
proxy = server.create_proxy

from selenium import webdriver
profile  = webdriver.FirefoxProfile()
profile.set_proxy(proxy.selenium_proxy())
driver = webdriver.Firefox(firefox_profile=profile)

proxy.new_har("google")
driver.get("http://www.google.co.uk")
proxy.har # returns a HAR JSON blob

proxy.stop()
driver.quit()

If we now feed the data from proxy.har into HAR Viewer we can get a nice waterfall of the traffic as below! Jari Bakken has a useful commandline version called Har.

waterfall from HAR of this site

I recently showed this off at London Web Performance. Unfortunately it wasn't recorded but you can view the slides here


Outstanding Requests in Bugzilla

Many Mozilla project members will wake up this morning to find an email entitled “[Bugzilla] Your Outstanding Requests” in their inbox. This is a reminder of all requests (for e.g. review, feedback, or super-review) which have been outstanding more than 7 days, and from now on will be sent out every week.

This is part of an effort to clear the request backlog (by either cancelling, fulfilling or transferring the requests) and set up a community norm that contributors should not have to wait more than two weeks for a request to be dealt with. (Two weeks is our initial community-wide target, and we hope that people or their managers may set more ambitious personal targets.) We hope that this will lead to fewer instances of new contributors becoming discouraged by being ignored, and if we can get the backlog cleared and then monitor the statistics to make sure the problem does not recur, it will generally oil the wheels of the project.

So please do your best to deal with the requests on your list. It is important to emphasize that this does not necessarily mean doing e.g. a review – it may mean cancelling it (with an apology) because the patch is unwanted or bitrotted, or transferring it to someone else if you are not the right person.

At the time of writing, there are 996,333 waiting-days in the system for the “review” flag (recently it was over 1,000,000), and 1494 reviews have been outstanding more than 14 days. Let’s drive that figure towards 0 :-)

The beginning of a standard for browser automation

WebDriver, the browser automation framework we all love, is on its way to becoming a browser standard. WebDriver as an OSS project is 5 years old and started being merged into the Selenium project about 3 years ago. From there we have seen WebDriver grow. It has had a lot updates in that time. The team is currently averaging ~100 commits a week.

In the short time, from GTAC 2009 when they were created, the Ruby bindings created by Jari Bakken have had over a million downloads! The Python bindings have around 3000 downloads a week and growing. Jim Evans work on the .NET bindings is great, I don't have figures because of Nuget. Same with the Java bindings. Maven makes it difficult to know how many downloads.

We have also seen that Selenium Jobs have overtook the commercial counterparts. All of these things point to us needing a standard to make sure if we can do the same thing on multiple devices and multiple OSes.

Yesterday we held a W3 meeting in the Google UK office. It was great to be able to get in a room and discuss what needed. A plan was hatched on what needs to be done next, and it is going to be a lot of work.You can see the minutes of the meeting here to see what we discussed.

Mozilla, Opera and Google are happy with the direction we are going and long may it last! It will be great to get Microsoft and Apple involved soon.

Remember that all of this work is happening out in the open and you can watch the Hg repository for the editors draft updates.

This is going to be a really exciting journey!


Case Conductor pytest plugin proposal

Case Conductor is the new test case management tool being developed by Mozilla to replace Litmus. I’ve recently been thinking about how we can improve the relationship between our automated tests and our test case management, and want to sare my thoughts on how a plugin could help our WebQA team do just that.

Annotating tests

Currently our automated tests include a docstring referencing the Litmus ID. This is inconsistent (some even include a full URL to the test case) and hard to do anything with. It’s important to reference the test case, but I see this as the bare minimum.

Current method

1
2
3
4
5
6
def test_empty_search(self, mozwebqa):
    """Litmus 13847"""
    feedback_pg = FeedbackPage(mozwebqa)
    feedback_pg.go_to_feedback_page()
    feedback_pg.search_for('')
    Assert.greater(len(feedback_pg.messages), 0)

I would prefer to use a custom pytest mark, which would accept a single ID or a list. By doing this we can cleanly use the IDs without having to write a regex or conform to a strict docstring format.

Proposed method

1
2
3
4
5
6
@pytest.mark.cc(12345)
def test_empty_search(self, mozwebqa):
    feedback_pg = FeedbackPage(mozwebqa)
    feedback_pg.go_to_feedback_page()
    feedback_pg.search_for('')
    Assert.greater(len(feedback_pg.messages), 0)

Submitting results

There’s already an API in development for Case Conductor, so it would be great to interface directly with it during automated test runs. We could, for example prompt the user for the product, test cycle, and either a test run or a collection of test suites. With these details it should be possible for every automated run to create a new test run in Case Conductor and mark the linked test cases as passed/failed depending on the result. In addition to the existing reports, we can then also offer a link to the Case Conductor report for the relevant test run.

Result reports

We could also use the Case Conductor plugin to enhance the existing HTML report generated by the plugin already in use by WebQA. For example, we could link to the Case Conductor report for the test run, and provide a link for each test case. In the following mockup the new details are highlighted.

Coverage reports

By knowing all test cases in the specified product/cycle/run/suites we can report on the automated coverage. This could be used to set goals such as ‘automate 75% of product A’s tests’, which suddenly become a lot easier to measure. Here’s another mockup of how this command line report may look.

========================================= CASE CONDUCTOR =========================================
------------------------------------- test cases covered (2) -------------------------------------
Entering future date in start date field (test_feedback_custom_date_filter_with_future_start_date)
Entering future date in end date field (test_feedback_custom_date_filter_with_future_end_date)
----------------------------------- test cases not covered (2) -----------------------------------
Filtering by mobile versions
Filtering by desktop versions
----------------------------------------- coverage (50%) -----------------------------------------

We could also use tags to indicate test cases that aren’t worth automating so the coverage is more realistic.

Command options

I would propose several command line options in order to cover the above mentioned functionality. In the form of output from –help, here are my suggestions:

Options:
  case conductor:
    -cc-url=str       url of the case conductor instance
    -cc-username=str  case conductor username
    -cc-password=str  case conductor password
    -cc-product=str   product identifier
    -cc-cycle=str     test cycle identifier
    -cc-run=str       test run identifier
    -cc-suite=str     test suite identifiers (comma separated)
    -cc-coverage      show the coverage report

Some of these would be mandatory but could fail with useful messages if omitted. For example, if the product was not provided then a list of available products could be returned. The same could be done for test cycles and test runs.

Looking at the Past, Present, and Future

So it has been a busy and life changing year that just went by. 2011 brought not only a number of new events, and friends, but also a new look on the world around me. It has been fun, and I hope that it is an indication of things to come over the next year, and beyond (no, the world is not going to end).

What have I done in 2011 then? Well here is a list of some of the key things I have done this year (in my opinion):

January through March

This was a large part of my 2011 year. I spent a lot of time and effort on it and I hope to find the time to continue working on it in 2011. Affero (the Latin word for “contribute”) is a community contribution wizard that was developed as part of my A-Level course. It aims to make getting people involved in a community easier for those trying to choose where in the community they want to help out. I spent almost my entire final year of college working on it and it took up the first two months of 2011. There have been a number of posts about it, in fact so many that it even has its own category here on this blog.

Written in PHP and JavaScript it taught me a lot about not only how to develop, and properly document a project, but also a lot about Mozilla and how people feel while trying join Mozilla.

March through April

Firefox 4 Cupcakes

Next up in 2011 was the launch of Firefox 4. This was a big move forward for not only the web but also for myself. It was the first time I threw myself in at the deep end and organized not only the Firefox 4 Launch Party but also the first Mozilla UK meet, I also learned never to try to do both on the same day.

So on Thursday 21st April 2011 we here in the United Kingdom were graced with a wonderful (even if I do say so myself) party in our (well England’s) capital, London. However the party started well before… in fact it started weeks before, with the creation of the Firefox 4 Launch Team, the launch of Firefox 4, and then the launch of Firefox 4 Mobile. Without these three things there would be no reason for the party at all!

May through June

exams

Well… this was a big time for me, not so much an interesting one but an important one. This was the time that I spend, gone for quite some time from the land of the internet. This was when I was doing my final A-Level exams. These I later found out, were good enough to get into my preferred university, though I will come to that one later.

July through September

University Of Kent School Of Computing

Nothing much happened… I worked a lot, saved a large amount of money, then spent it all on a new computer… oh… and I got accepted by the University Of Kent!!!

In the summer I had planned to do a large number of things that never got done and for that I apologise. I did intend to get some updates made to Affero as well as create a tool to track the exposure of hashtags on twitter (about 60% there but not complete). I also wanted to re-write MozHunt and get that out properly with some nice new web technologies that fall under the HTML5 banner. Unfortunately all I have managed to do is drop off the grid even more than when I was taking my exams.

October

Steve Jobs

This was my first full month at university… I did a number of things such as start my course at university, make a whole new bunch of friends, and join a few societies. I even did a presentation as a Mozilla Rep on who Mozilla are, what we do, and why we do it. I also helped out a little with the planning of the Mozilla Festival, as well as write a post on how I got involved with Mozilla.

Not only was this month a big change for me (spending my first month away from home) but it was also a big month in history. This was the month that the world lost a great man who not only changed the world of tech, but also of animation. Steve Jobs.

“Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma — which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.”

November

Many Voices One Mozilla

Okay… now I know I have said several times things along the lines of “this was a big month”, well they all pale in compare to November. This is defiantly the highlight of my year. Organizing a party… that was amazing. Moving to university, life changing. Though neither of these compares to the time I had over the course of two weeks in November. Not only did I get to go to the Mozilla Festival in London, and during the evening of the second day home to Lewes for Bonfire, and making myself ill, and very tired, BUT I also got to go to MozCamp EU in Berlin! I have no idea how my luck got so good but these two events are the best two events I have been to all year, and I loved every single second!

December

Nothing much happened this month. This time I mean it too… I came home from University, and spent the holiday so far with family. Now onto the present?

Present onto the Future

So nothing much is happening now, I am sat at home, watching… well right now Torchwood, writing this post. So what is it I am planning on doing? Well in late January I am going to be running a little meetup in Canterbury. Oh and come Easter there will be a BarCamp in Canterbury too… and I will be there representing Mozilla. I also plan on working a little more on Affero, as well as on a few new ideas I have had.

What about resolutions… well I have none of those… I never manage to keep them so why bother… instead, I am going to give you my list of New Year wishes for 2012 (thanks for the idea Chris).

This year I wish…

  • That everyone can learn at least the basics of hacking the web. To help this happen here are some tools that I will be recommending to people.
  • I wish to be able to do more for Mozilla than I have ever done before.
  • That everyone takes care of the web, and governments stop abusing it and realize that it is not theirs to play with or restrict.

MPL 2.0 Released

We’ve shipped it :-)

A blog post will be forthcoming soon on what this means logistically for the Mozilla project, in terms of our announced migration to use the MPL 2 for Mozilla code.

Pages

Subscribe to Planet