ciplogic.com
Live with grace. Write superb software.

testing

  • Germanium 1.7.3 - API on Top of WebDriver

    I am happy to announce the availability of Germanium 1.7.3.

    Germanium is an Python API simplifying WebDriver access into very simple commands, making for very readable code:

    from germanium.static import *
    from time import sleep
     
    open_browser("ff")
    go_to("http://www.google.com")
    type_keys("germanium pypy<enter>", Input("q"))
    wait(Link("Python Package Index"))
    click(Link("Python Package Index"))
    sleep(5)
    close_browser()

    It's best used for test automation, and is available straight from pip:

    pip install germanium

    Germanium is tested against Python 2.7, Python 3.4 and Python 3.5, and Firefox, Chrome and IE on each release.

    Also, it has pretty decent documentation.

    Enjoy using it :), and if you have any issues with it, questions, feature requests, etc. please open up an issue on GitHub.

  • TypeScript unit testing with Mocha

    I am writing some unit tests for my TypeScript collection classes (actually migrating some older tests), and I decided in going with Mocha.

    How easy it is? Well, as simple as 1, 2, 3... 4 :) :

    1. Install the typing files

    tsd install mocha
    tsd install node
    tsd install assert

    2. Write your test(s)

    For this example, I'm presenting you a super simple test, but obviously nothing stops you from adding new ones (check my github core-lang project for details):

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /// <reference path="../../../typings/mocha/mocha.d.ts"/>
    /// <reference path="../../../typings/node/node.d.ts"/>
    /// <reference path="../../../typings/assert/assert.d.ts"/>
     
    import { list, XIterable, XIterator } from "../../main/core/Iterable";
    import assert = require("assert");
     
    describe('ArrayList', function() {
        it('should allow filtering', function() {
            var items : XIterable<number> = list([1, 2, 3, 4]),
                filteredItems: XIterable<number>,
                iterator : XIterator<number>;
     
            filteredItems = items.filter(it => it % 2 == 0);
            iterator = filteredItems.iterator();
            
            assert.equal(iterator.next(), 2);
            assert.equal(iterator.next(), 4);
            assert.notEqual(iterator.hasNext(), true);
        });
    });

    3. Build your test(s)

    I use Grunt, so I have (I deleted all the non test stuff), but is basically easy to see the target that is named "test" across all the plugins in the original full Grunt file:

  • What Do We Learn from the Broken Firefox WebDriver Support

    Originally published at the project's site: http://www.germaniumhq.com/2016/07/03/2016-07-03-What-Do-We-Learn-from-the-Broken-Firefox-WebDriver-Support/

    With the new release of Firefox 47, the WebDriver support was left in limbo. On one hand, the old WebDriver API was not accessible anymore, on the other hand the new API (Marionette) explicitly didn’t support it. Kid you not, they actually used the word explicitly when saying they don’t support version 47, despite Mozilla telling on the release notes to use it.

    “Go use it, it’s broken” [probably someone at Mozilla]

    Of course, this lead to the Mozilla team releasing a hotfix for Firefox, namely 47.0.1 which fixed, you guessed it, allowing the old WebDriver API to work. The only small problem is that Mozilla knowingly introduced a bug that nuked all the WebDriver Firefox tests. For 3 weeks. Between June 7 and June 28.

    Unreal.

    Solution

    Now that we know this might happen, how do we mitigate this?

    The answer is containers. Docker containers.

    Germanium, out of the box, comes into two flavours. One one hand it’s the library itself that we know and love and that gets tested against a set of browsers.

    Now, for Firefox and Chrome, also docker images are automatically built, that guarantees such changes in infrastructure aren’t destroying your tests stability. For Firefox, since version 47 wasn’t running anymore using WebDriver, the container used Firefox 46 and the old API (the Marionette support is at this stage abysmal).

    Of course, this means we’re not on the bleedingest of edges of the browser version, but that is OK. In the Continuous Integration system, we want to be sure we don’t get all our tests failing just because WebDriver has a bug now, especially since the API itself it’s still coagulating, so this is bound to happen some more. The key is to lock the moving parts of the testing environment, and Germanium does that by default.

    Also these images themselves are used to test Germanium itself. So you know that all the API calls that are documented there are running as expected.

Germanium

The one to rule them all. The browsers that is.

SharpKnight

SharpKnight is an Android chess game.

MagicGroup

MagicGroup is an eclipse plugin.