Skip to content

Instantly share code, notes, and snippets.


Jon Austen djangofan

View GitHub Profile
View gist:9925209
import org.testng.annotations.*
import org.testng.TestNG
import org.testng.TestListenerAdapter
@Grab(group='org.testng', module='testng', version='5.7', classifier='jdk15')
class HogeTest {
void add() {
assert 1 + 1 == 2
View gist:10421275
<project xmlns="" xmlns:xsi=""
<description>JMeter tests for testing myapp APIs.</description>
djangofan / ansible_HOWTO.txt
Last active Aug 29, 2015
First time using Ansible
View ansible_HOWTO.txt
Using Ansible, given scenario with 3 hosts: vbox1, vbox2, and vbox3, this guide will teach you to do the
following Ansible tasks:
A. Configure Ansible
B. Define remote slave servers by group
C. Run any shell commands on your remote servers by their group name
D. Create a Apache playbook to install Apache2 on all of your remote servers
E. SCP files out to your remote servers
F. Create a new blank role directory structure for you to write your own Role and publish it to "Ansible Galaxy" for re-use.
djangofan /
Created Oct 7, 2014
Example data provider creating instances of various web browsers
public class FactoryDataProviderTestBase extends MyTestBase
@Factory(dataProvider = "dp")
public FactoryDataProviderTestBase( SauceTestHelper helper,
Map<String,String> csvArgMap ) {
super( helper, csvArgMap );
@DataProvider( name = "factory" )
static public Object[][] factoryDataProvider() {
djangofan /
Created Nov 5, 2014
Sauce on demand data provider for TestNG
package com.saucelabs.testng;
import com.saucelabs.common.Utils;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.testng.annotations.DataProvider;
import java.lang.reflect.Method;
djangofan / gist:27374b054884730596ff
Last active Aug 29, 2015
Verbose elementExistsWithText for Selenium
View gist:27374b054884730596ff
public Boolean elementExistsWithText(By locator, String text)
ExpectedCondition<Boolean> textToBePresentInElement = ExpectedConditions.textToBePresentInElementLocated(locator, text);
WebDriverWait wait = webDriverManager.getCachedWebDriverWait(webDriverManager.DEFAULT_WAIT);
try {
return Boolean.TRUE;
} catch ( WebDriverException wde ) {
LOG.debug( "Element '" + locator.toString() + "' with text '" + text + "' was not present.", wde);
return Boolean.FALSE;
djangofan / Rakefile
Created Jun 14, 2015
Rakefile example for passing parameters for optparse
View Rakefile
require 'rake'
require 'rake/testtask'
# uses '--' args format because ruby 'optparse' lib wants it that way
# runs myapp tests with args client, env, and application
namespace :myapp do |args|
desc "Example test task." do |t| = "runTestsReal"
View MinorSwing.txt
djangofan /
Created Sep 2, 2015
Example test base showing Selenium browser/driver creation and destruction.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.ITestContext;
djangofan / ubuntu_commands.txt
Created Dec 8, 2011
Commands to install Oracle Java on Ubuntu
View ubuntu_commands.txt
sudo apt-get install galternatives
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin
(then use Gnome galternatives GUI to set the default)
OR on the pure command line:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update