Skip to content

Instantly share code, notes, and snippets.

View FriendlyTester's full-sized avatar

Richard Bradshaw FriendlyTester

View GitHub Profile
@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>
@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 / 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);
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 / 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 / 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 / DBPGenericBuilder.java
Created June 23, 2015 22:01
A simple builder method
public class UserBuilder
{
public User buildGenericUser()
{
User user = new User();
user.setFirstName("Richard");
user.setSurname("Bradshaw");
user.setAge(29);
user.setEmailAddress("richard@richard.com");
return user;
@FriendlyTester
FriendlyTester / DBPPersonaBuilder.java
Created June 23, 2015 22:05
A persona builder example
public class UserBuilder
{
public User buildGenericUser()
{
User user = new User();
user.setFirstName("Richard");
user.setSurname("Bradshaw");
user.setAge(29);
user.setEmailAddress("richard@richard.com");
return user;
@FriendlyTester
FriendlyTester / OPBManipulation.java
Last active August 29, 2015 14:23
Manipulations the output form the builder
public UserChecks
{
public void DataCreation()
{
User user = UserBuilder().buildGenericUser();
user.setSurname("Richards");
user.setAge(35);
}
}
public UserChecks
{
public void DataCreation()
{
User user = UserBuilder().buildGenericUser();
user.setSurname("Richards");
user.setAge(35);
UserCreator.create(user);
}
}