Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mikeal Rogers mikeal

🏠
Working from home
View GitHub Profile
View gist:126852
# Web Testing with Windmill
You need to write some tests for your web application... really, you do!
But what kind of tests do you write? What approach do you take to testing with limited time and resources? What tools do you use?
There are many competing test tools and framework for automated web testing. In [Web Testing with Windmill](http://opensourcebridge.org/sessions/36) I'll briefly cover the different testing approaches and tools, where Windmill fits in, and why it stacks up to it's competitors as the best tool for writing, debugging and maintaining web application tests across all browsers on all operating systems.
Then I'll take you through the process of writing, running and debugging your Windmill tests and getting them running in the "cloud" (look at me I used a buzzword!).
View gist:128459
/*!
* jQuery JavaScript Library v1.3.2
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
* Revision: 6246
View gist:136921
setup_module(tests[0][1])
for wmt in wmtests:
sys.argv = [wmt,]
for k in (k for k in sys.modules.keys() if k.startswith('functest')):
del(sys.modules[k])
del(bin); del(runner)
import functest
from functest import bin
from functest import runner
bin.cli()
View gist:136922
setup_module(tests[0][1])
for wmt in wmtests:
sys.argv = [wmt,]
for k in (k for k in sys.modules.keys() if k.startswith('functest')):
del(sys.modules[k])
del(bin); del(runner)
import functest
from functest import bin
from functest import runner
bin.cli()
View gist:147391
import httplib2
h = httplib2.Http(".cache")
h.add_credentials('name', 'password')
h.request("http://joelmaher.couch.io",
"POST", body=simplejson.dumps(data),
headers={'content-type':'application/json'} )
View gist:162920
class Cache(dict):
lambda get(*args, **kwargs): dict.__getitem__(*args, **kwargs)
lambda set(*args, **kwargs): dict.__setitem__(*args, **kwargs)
lambda del(*args, **kwargs): dict.__delitem__(*args, **kwargs)
View gist:162921
class Cache(dict):
lambda get(*args, **kwargs): dict.__getitem__(*args, **kwargs)
lambda set(*args, **kwargs): dict.__setitem__(*args, **kwargs)
lambda del(*args, **kwargs): dict.__delitem__(*args, **kwargs)
View gist:165982
Tabs.prototype.__defineGetter__("activeTabIndex", function() {
return this.controller.window.gBrowser.tabContainer.selectedIndex;
})
Tabs.prototype.selectTabIndex = function(i) {
this.controller.window.gBrowser.selectTabAtIndex(i);
}
View gist:166039
# Before
function (doc) {
if (doc.type == 'tcm-testcase') {
emit([doc.product, doc.title], doc);
}
}
# After
View gist:166995
$(document).ready = function () {
var d = document.getElementById('description');
var e = document.getElementById('description-edit');
e.width = d.offsetWidth;
e.height = d.offsetHeight;
}