Skip to content

Instantly share code, notes, and snippets.

View FriendlyTester's full-sized avatar

Richard Bradshaw FriendlyTester

View GitHub Profile
@FriendlyTester
FriendlyTester / DBPModel.java
Last active August 29, 2015 14:23
A simple model for demonstrating the data builder pattern
public class User
{
private String firstName;
private String surname;
private int age;
private String emailAddress;
}
//Then you could do the following
public void setFirstName(String firstName)
@FriendlyTester
FriendlyTester / Ideas
Last active August 29, 2015 14:17
TestBash Lean Coffee Ideas
So these are all the postits note I could find after the LeanBaconTeaCoffee at TestBash.
It was suggested by an attendee that these could make could help people formulate some blog ideas
so here they are!
1. Release candidate testing
2. Are unit checks only for programmers
3. When does a tester become a developer
4. Sustainable pace
5. Ant fucking (nit picking) how picky is it OK to be with testing?
6. Is there a way to inspire 9-5 testers?
@FriendlyTester
FriendlyTester / AndroidRecord.sh
Created January 30, 2015 17:04
BASH script to record Android display and download/delete the video
#Check if an argument was supplied
if [ -z "$1" ]
then
echo "No argument supplied, please provide video name"
else
# start recording
adb shell screenrecord --bit-rate 6000000 /sdcard/$1.mp4 &
# Get its PID
PID=$!
public void ProxyUsingChromeDriver()
{
//Set the location of the ChromeDriver
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Richard\\Desktop\\chromedriver.exe");
//Create a new desired capability
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
// Create a new proxy object and set the proxy
Proxy proxy = new Proxy();
proxy.setHttpProxy("localhost:8888");
//Add the proxy to our capabilities
@FriendlyTester
FriendlyTester / ProxyWithFirefoxDriverInJava
Created October 16, 2014 11:27
Proxy Using FirefoxDriver In Java
public void ProxyUsingFirefoxDriver()
{
//Create a new Firefox profile
FirefoxProfile firefoxProfile = new FirefoxProfile();
//Then add the proxy setting to the Firefox profile we created
firefoxProfile.setPreference("network.proxy.http", "localhost");
firefoxProfile.setPreference("network.proxy.http_port", "8888");
//Then create a new Firefox Driver passing in the profile we created
//WebDriver we open a Firefox using this profile now
FirefoxDriver Driver = new FirefoxDriver(firefoxProfile);
@FriendlyTester
FriendlyTester / gist:79e7d61ce418ed24cedb
Created October 16, 2014 11:16
C# - Proxy Using ChromeDriver
public void SettupUpAProxyUsingChromeDriver()
{
//Create a chrome options object
var chromeOptions = new ChromeOptions();
//Create a new proxy object
var proxy = new Proxy();
//Set the http proxy value, host and port.
proxy.HttpProxy = "localhost:8888";
//Set the proxy to the Chrome options
chromeOptions.Proxy = proxy;
@FriendlyTester
FriendlyTester / gist:897c776c1fcf14e627c8
Created October 16, 2014 11:04
C# Proxy Using Firefox Driver
public void SettingUpAProxyUsingFirefoxDriver()
{
//Create a new Firefox profile
var firefoxProfile = new FirefoxProfile();
//Create a new proxy object
var proxy = new Proxy();
//Set the http proxy value, host and port.
proxy.HttpProxy = "localhost:8888";
//We then add this proxt setting to the Firefox profile we created
firefoxProfile.SetProxyPreferences(proxy);
@FriendlyTester
FriendlyTester / gist:9387503
Created March 6, 2014 11:11
Using TakeScreenshot Extension
webDriver.TakeScreenshot(@"C:\Temp\Richard.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
@FriendlyTester
FriendlyTester / gist:9387475
Created March 6, 2014 11:09
IWebDriver Screenshot Extension
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using System;
using System.Drawing.Imaging;
namespace Richard.WebDriverExtensions
{
public static class WebDriverExtensions
{
/// <summary>
BlogObject blogObject = new BlogObject (webDriver, 60);