Skip to content

Instantly share code, notes, and snippets.

Avatar

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 {
@Test
void add() {
assert 1 + 1 == 2
}
View gist:10421275
<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 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
djangofan / dataprovider.java
Created Oct 7, 2014
Example data provider creating instances of various web browsers
View dataprovider.java
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 Nov 5, 2014
Sauce on demand data provider for TestNG
View SauceBrowserDataProvider.java
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 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 {
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 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."
Rake::TestTask.new do |t|
t.name = "runTestsReal"
View MinorSwing.txt
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 Sep 2, 2015
Example test base showing Selenium browser/driver creation and destruction.
View ShootoutTestBase.java
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 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