Custom Webdriver Page Factories

Wrapping WebElements to reduce boilerplate clutter

The problem: Webdriver elements returned by driver.FindElement() are too generic. There’re the Text, SendKeys() and Click() methods/properties (depending your on C#/Java implementation). The solution is to simply wrap all elements inside custom HTML objects which contain specific methods like ShouldContainValue or Type (okay, that’s a one-to-one mapping with SendKeys(), but it’s a lot less technical!). Instead of [FindsBy(How = How.CssSelector, Using = ".ux-desktop-taskbar-startbutton")] private IWebElement startButton; [FindsBy(How = How.CssSelector, Using = ". Read More »

Bye autotools hello Scons

Building C++ projects with Scons

Remember this? ./configure make make install That’s not so bad, as long as you have the right compiler and linker flags configured, depending on the target OS. The real problem, however, is trying to figure out how to alter something if you didn’t write the Makefile yourself. Or if you in fact did write it, but it was some time ago. Two days. No, four hours. The problem Try to study the autoconf and automake flow diagram, explained on Wikipedia: the GNU build system. Read More »

Metaprogramming instead of duplication

convention over duplication, good or bad?

So… What’s up with all that duplication in your unit tests? Let’s take a look at a very recognizable pattern when for instance using RhinoMock in C#: [TestInitialize] public void SetUp() { dbConfigurationMock = MockRepository.GenerateMock<IDbConfiguration>(); mountPointLoaderMock = MockRepository.GenerateMock<IMountPointLoader>(); userEnvironmentFactoryMock = MockRepository.GenerateMock<IUserEnvironmentFactory>(); userEnvironmentLoaderMock = MockRepository.GenerateMock<IUserEnvironmentLoader>(); // ... We agreed to suffix each instance variable with ‘Mock’ if it’s a mock. That way, when you scroll down to an actual test case, it’s clear to everyone what’s what: mocks, stubs, actual implementations, and so forth. Read More »

Enhancing the builder pattern with closures

the trainwreck/builder/chaining pattern can be dangerous and here's why

This post is inspired by Venkat Subramaniam’s Devoxx 2013 talk Thinking Functional Style. See downloads at agiledeveloper.com which has a rather cool Groovy example. Classic builders For years, I’ve been using the builder pattern to quickly create new objects to be inserted into the database or to inject our domain objects with the required data. We started with so called “Object Mothers”, static methods which simply create and fill up an object, passing in a huge amount of parameters. Read More »

Integration Testing with SQLite

Decoupling your integrated database environment from your development.

This article is based on the notes I’ve collected on My Wiki. On previous projects I’ve worked on, development PCs came with a local version of the database scheme. Each DB change also got rolled out to those computers, which enabled us developers to fool around without breaking anything on the development (or test) environment. This is another step closer to happiness, at least for our proxy customers who didn’t have to reinsert their test data every time we flushed something from a table. Read More »

Visual Studio 2012 for Eclipse users

Trying to fill the gap of missing features in VStudio.

When switching over to a new editor and new language, I can sometimes get frustrated by missing features I got (very) attached to. This excludes the obvious difference in shortcut keys. Shortcuts and refactoring tools One plugin to rule them all: ReSharpner. This productivity tool brings back the incredible development speed to the Visual Studio platform. You can almost map the eclipse (or IntelliJ, since they guys from JetBrains developed it) keys to the ReSharpner keys. Read More »

Unit Testing Stored Procedures

And a pragmatic guide on how to include them into your build system.

This article is based on the notes I’ve collected on My Wiki. Test Driven Development (or TDD), it’s one of those buzz words which usuallly appear in the same sentence with “scrum” or “XP”. But in practice, I’ve seen few people actually applying it all the way through. What do I mean by that? You’re probably very familiar with, say Java or .NET, and you know how to write unit tests in that language using your beloved IDE. Read More »

Ending your day with happy thoughts

Or how a tiny thing can really help you sleep better

Past new year, I stopped promising silly things to myself. “This year, I’ll for sure go jogging several times a week!” — or “This year, I’ll really get into learning another language!”. We all know how these things go. Not that I made something up on the very day, these ideas are usually carefully crafted in my sketchbook and are lingering there to be exposed and finally executed. Originally posted on Medium. Read More »