Monthly Archives: July 2014

Combining SpecFlow and Selenium

One of the cool things I like to do when testing webapps, is to define the testcases using SpecFlow (also known as Cucumber) and then use Selenium to actually execute the testcases against the web-application.

Here is an example testcase:

Feature: SpecFlowAndSelenium
	For demonstration purposes, I want to show how the human-readable
	SpecFlow testcases can be executed using Selenium to operate
	a real webbrowser

Scenario: SeleniumAndSpecFlow
	Given I navigate to 'http://www.google.com'
	Then there must be a control with 'id' 'gbqfq' 
	When I type 'Hello World!' into it
	Then there must be a control with 'id' 'gbqfb'
	When I click on it
	Then there must be a link with 'partialtext' 'Wikipedia' 
	When I click on it
	Then there must be a control with 'id' 'searchInput'
	When I type 'Selenium' into it
	Then there must be a control with 'id' 'searchButton' 
	When I click on it
	Then there must be a link with 'text' 'chemical element'
	And there must be a link with 'text' 'Selenium (software)'
	When I click on it
	Then there must be a link with 'text' 'web browsers'

And here you can see Selenium using Firefox to perform all the actions and checks:

Getting MS Access to remember the password for linked tables

If you’re using linked tables from MS Access to a database server (Oracle or SQL Server) using the MS Access GUI you can simply put a check mark in the ‘Remember password’ box. If you’re dynamically creating linked tables from VBA and supplying the username and password in the Connection member of the TableDef object then Access will still prompt for credentials when its restarted.

You can avoid this by using the dbAttachSavePWD attribute. Example:

Dim tDef As TableDef
Set tDef = CurrentDb.CreateTableDef("MyNewTable", dbAttachSavePWD)
tDef.Connect = ...
tDef.SourceTableName = ...