Skip to content

Instantly share code, notes, and snippets.

View leviwilson's full-sized avatar

Levi Wilson leviwilson

  • Northwoods
  • Colorado, USA
View GitHub Profile
@leviwilson
leviwilson / HttpUrlActivityTest.java
Created September 4, 2012 16:24
Mock HttpURLConnection Example
package com.example.robolectric;
import static com.xtremelabs.robolectric.Robolectric.shadowOf;
import static org.mockito.Mockito.verify;
import java.io.IOException;
import java.net.*;
import org.junit.Before;
import org.junit.Test;
@leviwilson
leviwilson / count_lines.sh
Created September 6, 2012 07:14
Lines Of Code Count
find . -name '*.java' | xargs wc -l
@leviwilson
leviwilson / jarjar.sh
Created September 7, 2012 03:37
jarjar
java -jar jarjar.jar process rules.txt gson-1.5.jar myjson-1.5.jar
@leviwilson
leviwilson / example.rb
Created January 31, 2013 14:36
Example Furter screen definition
class Login
include Furter
text(:username, :label => 'UsernameAccessibilityId')
text(:password, :label => 'PasswordAccessibilityId')
button(:login, :text => 'Login')
end
include Furter::Navigation
@leviwilson
leviwilson / example_list_accessor.rb
Created January 31, 2013 22:21
example augmented list accessor
def list(name, locator)
define_method("click_#{name}_with_text") do |which_text|
platform.click_list_item_with_text(which_text)
end
end
class Notes
list(:notes, :id => "notesGridId")
end
@leviwilson
leviwilson / TestRunner.rb
Created March 18, 2013 14:58
Custom app path in Robolectric 2.0
public CustomTestRunner(Class<?> testClass) throws InitializationError {
super(RobolectricContext.bootstrap(CustomTestRunner.class, testClass, new Factory() {
@Override
public RobolectricContext create() {
return new RobolectricContext() {
@Override
protected AndroidManifest createAppManifest() {
return new AndroidManifest(new File("../YourAppDirectory"));
}
};
@leviwilson
leviwilson / codmash_abstract_2013.md
Last active March 30, 2018 21:03
Abstract for Codemash 2014: Automating Windows Applications with Ruby.

Codemash 2014 Pre-Compiler

Automating Windows Applications with Ruby

Abstract

When we think of writing automated tests with ruby and cucumber, Windows desktop applications are not the first thing that come to mind. If you have looked into writing acceptance tests for Windows applications (native, WinForms or WPF), chances are you have come across solutions such as SpecFlow or Raconteur, but what are the options if we want to drive our tests from ruby using cucumber or RSpec?

This pre-compiler session will take you through building an acceptance test suite using some ruby gems (mohawk, RAutomation and cucumber) that tap into the Microsoft UI Automation accessibility framework to automate native, WinForms and WPF applications.

Target Audience

@leviwilson
leviwilson / save_ssh.bat
Created March 26, 2013 17:16
Generates a batch file to do ssh-add so you do not have to continually enter your git password.
ssh-agent | sed -n 's/\(\b.\+\)=\(.*\); export.*/set \1\=\2/p' > %TEMP%\store_ssh.bat && echo ssh-add >> %TEMP%\store_ssh.bat
%TEMP%\\store_ssh.bat
@leviwilson
leviwilson / DynamicAssemblyResolver.cpp
Last active December 15, 2015 13:58
Dynamic assembly resolver in MC++
#include "StdAfx.h"
#include "DynamicAssemblyResolver.h"
void DynamicAssemblyResolver::PrivatePath::set(String^ path) {
_PrivatePath = path;
AppDomain::CurrentDomain->AssemblyResolve += gcnew ResolveEventHandler(Resolve);
}
Assembly^ DynamicAssemblyResolver::Resolve(Object^ sender, ResolveEventArgs^ args)
{
@leviwilson
leviwilson / build.xml
Created April 19, 2013 14:52
Override android integration test target
<project>
...
<target name="levi-test" depends="-test-project-check">
<property name="test.runner" value="android.test.InstrumentationTestRunner" />
<run-tests-helper>
<extra-instrument-args>
<arg value="-r" />
</extra-instrument-args>
</run-tests-helper>