Probably no more posts

I’ve been super busy (and enjoying myself!) at my new job, so haven’t had time to update this blog. I will keep the posts for posterity, though. I see ~10 people a day accessing these posts from web searches, which is what I wanted this blog to be: a good source of reference material for people having very specific software problems.

It’s been fun, y’all!

Stop username / password prompts for OS X on cloned GitHub repos

GitHub for OS X clones your repo using HTTPS, which will cause this prompt every time you do a ‘git push’. That would quickly become annoying. To fix it, edit your ‘project/.git/config’ file to have something like:

[remote "origin"]
url =

Get your ScalaTest tests running with Maven

Get your ScalaTest tests running with Maven

Use something like IntelliJ IDEA to create a new Maven project with a mostly empty pom.xml (this file specifies the dependencies for your project). You’ll need a few things in your pom.xml:

  • the Scala language
  • ScalaTest
  • junit
  • maven-scala-plugin with compile and testCompile goals

You’ll need three lines in your .scala file, one of which annotates the test class:

import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
(your test class goes here)

To run your tests:

mvn clean test

Get the JAVA_HOME environment variable working on OS X for Maven

In the Terminal, run this command:

export JAVA_HOME=/Library/Java/Home

Remap keyboard shortcuts on OS X with this free application

I am using a MacBook Pro at my new job and was frustrated by the text editing shortcuts. The Windows-style Home/End shortcuts are hardwired after 15+ years of use. This application had exactly what I needed:

Alternate download link for JetBrains IntelliJ IDEA

I searched for an alternate download method for IntelliJ IDEA. The JetBrains link kept giving me a network error trying to copy the last of the file.’s a little slimy — you’ll need to uncheck their adware installer boxes. But the direct link for the download seems to work.;1

Page Objects design pattern for Selenium WebDriver

Here’s the framework I’ve come up with to implement the Page Objects design pattern in Python for my automated regression testing. The code has been simplified so it’s easier to follow. In my real code, I have a lot of custom handling of settings and application-specific helper functions that aren’t critical for understanding this pattern.

Setting up the test context

from ConfigParser import SafeConfigParser
from nose.plugins.skip import SkipTest
from selenium import webdriver
import sys
import unittest

class TestContext(object):
    def __init__(self):
        self.driver = None

    def _get_configuration(self):
        config_parser = SafeConfigParser()"setup.cfg")
        settings = dict(config_parser.items('settings'))
        self.driver_to_use = settings['browser']

    def open_browser(self):
        if(self.driver_to_use == 'Chrome'):
            self.driver = webdriver.Chrome()
            self.driver = webdriver.Firefox()

class BaseTestCase(unittest.TestCase):
    def skip_on_known_bug(self):
        """ issues commented out means it's fixed """
        known_issues = {
            101: 'Browser crash',
            #102: 'Firefox freeze',
        for reason in self.skip_reasons:
            if known_issues.get(reason, None):
                raise SkipTest(reason, known_issues[reason])

    def setUp(self):
        self.skip_on_known_bug() = TestContext() # used by all tests and Page Object classes

    def tearDown(self):
        if sys.exc_info() == (None, None, None): # leave window open on fail

Page object

class UserLogin(BaseTestCase):
    def __init__(self, context): = context  # make username, web driver, etc. available to the page object's methods

    def login_valid(self, uname=None):
        elem ='user_id')

The test case

import PageObjects

class TestCase(PageObjects.BaseTestCase):
    def setUp(self):
        self.skip_reasons = [] # bug tracker issue numbers

    def login_test(self):
        UserLogin = PageObjects.UserLogin(  # pass in test context, such as the driver object and useful variables
        UserLogin.login_valid()  # each page has "services" you can use, which here are Python methods

Improve the readability of MetaFilter

Install the Stylish extension and this style:

Then you’ll need to add a new section to it, because the author neglected to have style for the comment pages:

div.comments {
padding: 10px !important;
display: block;
background-color: #2371a5 !important;}

Alternative download location for the Scala programming language

I was having a heck of a time trying to get it from — my downloads were not just slow but actually stopping midway through. You can get the language as part of the Typesafe Stack here:

How to leave the browser window open upon fail or error within Python’s unittest framework

I like to leave the browser open if a test doesn’t pass, since it can often reveal the obvious cause of bugs that an assertion error might not. This solution below feels hackish to me, but it does work. If anyone knows of a better way, please add an answer or comment to my thread on Stack Exchange:

def tearDown(self):
    """ clean up by closing the browser window """
    if sys.exc_info() == (None, None, None):  # leave window open on fail

About Aaron

Aaron Shaver is a software quality assurance engineer, programmer, and all-around technology enthusiast who lives in Portland, Oregon.