Skip to content

Instantly share code, notes, and snippets.

View djangofan's full-sized avatar

Jon Austen djangofan

View GitHub Profile
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 {
@Test
void add() {
assert 1 + 1 == 2
}
@djangofan
djangofan / gist:10421275
Last active August 29, 2015 13:58
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>myappJMeterTest</groupId>
<artifactId>myappJMeterTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>patsatJMeterTest</name>
<description>JMeter tests for testing myapp APIs.</description>
<repositories>
<repository>
@djangofan
djangofan / ansible_HOWTO.txt
Last active August 29, 2015 14:00
First time using Ansible
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
djangofan / dataprovider.java
Created October 7, 2014 22:31
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
djangofan / SauceBrowserDataProvider.java
Created November 5, 2014 23:40
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
djangofan / gist:27374b054884730596ff
Last active August 29, 2015 14:13
Verbose elementExistsWithText for Selenium
public Boolean elementExistsWithText(By locator, String text)
{
ExpectedCondition<Boolean> textToBePresentInElement = ExpectedConditions.textToBePresentInElementLocated(locator, text);
WebDriverWait wait = webDriverManager.getCachedWebDriverWait(webDriverManager.DEFAULT_WAIT);
try {
wait.until(textToBePresentInElement);
return Boolean.TRUE;
} catch ( WebDriverException wde ) {
LOG.debug( "Element '" + locator.toString() + "' with text '" + text + "' was not present.", wde);
return Boolean.FALSE;
@djangofan
djangofan / Rakefile
Created June 14, 2015 16:27
Rakefile example for passing parameters for optparse
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."
Rake::TestTask.new do |t|
t.name = "runTestsReal"
@djangofan
djangofan / MinorSwing.txt
Created August 30, 2015 20:00
Minor Swing Tab
E|-7p5p4-5-7-5-4-7-5-----------10-8-7------------------|
B|-------------------6----------------10-9h10p9--------|
G|---------------------7-4--10------------------10-7---|
D|---------------------------------------------------9-|
A|-----------------------------------------------------|
E|-----------------------------------------------------|
@djangofan
djangofan / ShootoutTestBase.java
Created September 2, 2015 17:45
Example test base showing Selenium browser/driver creation and destruction.
From https://github.com/djangofan/yet-another-selenium-framework
package qa.se.framework;
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.openqa.selenium.support.ui.Sleeper;
import org.testng.ITestContext;
@djangofan
djangofan / ubuntu_commands.txt
Created December 8, 2011 05:28
Commands to install Oracle Java on Ubuntu
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