AMA: another book?

Stan asks…

Are you going to write another book? (please say yes :)

My response…

My first book was always an experiment: write a series of publicly accessible blog posts contradicting oneself on a series of topics, gather feedback on these and package these nicely into ePub/PDF format that people can buy for any amount they like (including free!). As I stated in my other post, I don’t think the book was a commercial success, but it was by no means a typical book, for instance, its length is rather shorth!

“It has often been said
there’s so much to be read,
you never can cram
all those words in your head.

So the writer who breeds
more words than he needs
is making a chore
for the reader who reads.

That’s why my belief is
the briefer the brief is,
the greater the sigh
of the reader’s relief is.

And that’s why your books
have such power and strength.
You publish with shorth!
(Shorth is better than length.)”

I recently read an article ‘Moneyball for Book Publishers: a Detailed Look at How We Read‘ and I must admit I was a bit alarmed about the future of books, especially non-fiction books:

On average, fewer than half of the books tested were finished by a majority of readers. Most readers typically give up on a book in the early chapters. Women tend to quit after 50 to 100 pages, men after 30 to 50. Only 5 percent of the books Jellybooks tested were completed by more than 75 percent of readers. Sixty percent of books fell into a range where 25 percent to 50 percent of test readers finished them. Business books have surprisingly low completion rates.

It’s really quite depressing: this isn’t the sort of material that a person thinking about writing a book should read.

But it makes me think: maybe more people need to follow Dr Seuss’s advice: focus on shorth!

I can’t say I am thinking at all about writing another book at present, but if I do it will be unlike anything I’ve already written. Maybe some Dr Seuss style poems/illustrations about testing? Who knows…

An ongoing stream of articles I find interesting

Much like the collection of quotes that I regularly update, I have now created a collection of links/articles that I find interesting at links.watirmelon.com which I will reguarly update. Like articles on this blog, these are automatically published to this follow-only twitter account: @watirmelon

My favorite article I have read lately is the U.S. Digital Services Playbook: a collection of 13 key “plays” about how to deliver great digital services. I was surprised to see this great stuff coming from a government agency!

Digital Service Plays

  1. Understand what people need
  2. Address the whole experience, from start to finish
  3. Make it simple and intuitive
  4. Build the service using agile and iterative practices
  5. Structure budgets and contracts to support delivery
  6. Assign one leader and hold that person accountable
  7. Bring in experienced teams
  8. Choose a modern technology stack
  9. Deploy in a flexible hosting environment
  10. Automate testing and deployments
  11. Manage security and privacy through reusable processes
  12. Use data to drive decisions
  13. Default to open

Enjoy.

Faking Geolocation in Selenium WebDriver with Firefox

I recently worked on some Selenium WebDriver tests that needed to provide a Geolocation to a HTML5 site so it could display some results. There’s a couple of things to keep in mind when doing this:

  1. There are two Firefox about:config preferences that you must both set in your WebDriver Firefox profile to always supply the Geolocation information to your test (instead of displaying a prompt). These are:
    1. set ‘geo.prompt.testing’ to true
    2. set ‘geo.prompt.testing.allow’ to true
  2. If you want to use a specific location you need to override an about:config preference to a JSON file containing that location. This is only supported in very recent versions of Firefox (I tested version 31). Whilst this can be manually done using a data:application/json string, Firefox using WebDriver in C# completely ignores this so the workaround is to create a JSON file with the location and reference using using a file:/// prefix
    1. Create C:\Dev\Brussels.json etc containing something like:
      {
          "status": "OK",
          "accuracy": 10.0,
          "location": {
              "lat": 50.850780,
              "lng": 4.358138,
              "latitude": 50.850780,
              "longitude": 4.358138,
              "accuracy": 10.0
          }
      }
    2. set ‘geo.wifi.uri’ to ‘file:///C:/Dev/brussels.json’ (or wherever your file is)

Once you’ve done this you should be able to test Geolocation without seeing the prompt or being able to completely override the location. Some example C# WebDriver scripts are below.


using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;

namespace GeoLocation.Tests.Acceptance
{
    [TestClass]
    public class WebDriverGeoLocation
    {
        [TestMethod]
        public void CanOverrideLocationInNewerVersionsOfFirefoxLike31()
        {
            var profile = new FirefoxProfile {EnableNativeEvents = false};
            profile.SetPreference("geo.prompt.testing", true);
            profile.SetPreference("geo.prompt.testing.allow", true);
            profile.SetPreference("geo.wifi.uri", "file:///C:/Dev/brussels.json");
            var driver = new FirefoxDriver(profile);
            driver.Navigate().GoToUrl("http://html5demos.com/geo");
            new WebDriverWait(driver, TimeSpan.FromSeconds(15)).Until(ExpectedConditions.ElementExists((By.ClassName("success"))));
            Assert.AreEqual("found you!", driver.FindElement(By.Id("status")).Text);
            driver.Close();
        }

        [TestMethod]
        public void CantOverrideLocationInOlderVersionsOfFirefoxLike24()
        {
            var profile = new FirefoxProfile { EnableNativeEvents = false };
            profile.SetPreference("geo.prompt.testing", true);
            profile.SetPreference("geo.prompt.testing.allow", true);
            var driver = new FirefoxDriver(profile);
            driver.Navigate().GoToUrl("http://html5demos.com/geo");
            new WebDriverWait(driver, TimeSpan.FromSeconds(15)).Until(ExpectedConditions.ElementExists((By.ClassName("success"))));
            Assert.AreEqual("found you!", driver.FindElement(By.Id("status")).Text);
            driver.Close();
        }
    }
}

Enjoy your Geolocation testing!

Connecting to a Windows 8.1 box from Mac OS X

I have a new Windows 8.1 machine for work and couldn’t work out how to connect to it via the Microsoft Remote Desktop Connection client on Mac OS X. No matter what I did I got the following error:

Verify Identity of Computer

When trying to work out the reason for this I stumbled across a link to this page with the solution deeply embedded in another page.

Here’s my summary:

On your Windows 8.1 box:

  1. Open the Management Console (mmc.exe)
  2. Add a Snap-In (File Menu) and choose ‘Group Policy Object Editor’ and then ‘Local Computer’ on the subsequent screen
  3. Navigate using the tree to:
    • Computer Configuration
      • Administrative Templates
        • Windows Components
          • Remote Desktop Services
            • Remote Desktop Session Host
              • Security
  4. Change the following two settings from their default:
    1. ‘Require use of specific for remote desktop (RDP) connections’ from ‘Default’ to ‘Enabled’, then select ‘RDP’ in the options pane
    2. ‘Require user authentication for remote connections by using Network Level Authentications’ to ‘Disabled’
  5. Restart the ‘Remote Desktop Service’ or restart the Windows 8.1 machine

I hope this helps you should you come across this problem yourself.