Skip to content

Instantly share code, notes, and snippets.

View jweden's full-sized avatar

Jason Weden, CISSP jweden

View GitHub Profile
/**
* Example Pattern to use to quickly create continuous Performance tests along side Functional Acceptance Tests for REST APIs
*/
package example
import static org.junit.Assert.assertEquals
import org.junit.Test
/**
* Always good to have a parent class for test plans to centralize code across all test plans
@jweden
jweden / FunctionN.java
Last active December 12, 2015 07:59
Demonstration of the power of java 8 lambdas with generics.
public interface FunctionN<T,R> {
R apply(T...t);
}
@jweden
jweden / ScalaRestTester.scala
Created March 14, 2012 01:38
Spray Rest Client with ScalaTest
package weden.jason.restTests
import org.testng.annotations.Test
import org.scalatest.testng.TestNGSuite
import org.apache.log4j.{Logger, LogManager}
import cc.spray.http._
import cc.spray.http.HttpMethods._
import cc.spray.can.HttpClient
import akka.config.Supervision._
import akka.actor.{PoisonPill, Actor, Supervisor}
@jweden
jweden / ScalaFunctionalTests.scala
Created December 29, 2011 03:03
Connecting to a postgres database via Squeryl
package weden.jason.dbaseFuncTests
import org.testng.annotations.Test
import org.scalatest.testng.TestNGSuite
import org.apache.log4j.{Logger, LogManager}
import org.squeryl.adapters.PostgreSqlAdapter
import java.util.Date
import org.squeryl.{Schema, Session}
class ScalaFunctionalTests extends TestNGSuite {
@jweden
jweden / sql.sql
Created December 29, 2011 02:57
SQL in database
CREATE TABLE customer
(First_Name char(50),
Last_Name char(50),
Address char(50),
City char(50),
Country char(25),
Birth_Date date)
insert into customer values (jason,weden,4 Mow Lane, Albany, NY, 12-2-1972)
@jweden
jweden / ScalaFunctionalTests.scala
Created December 11, 2011 04:22
ScalaTest TestNG Test Class
package weden.jason.authServerFuncTests
import org.testng.annotations.Test
import org.testng.Assert._
import org.scalatest.testng.TestNGSuite
class ScalaFunctionalTests extends TestBase with TestNGSuite {
@Test(invocationCount = 3)
def easyTest() {
import TestBase._
@jweden
jweden / pom.xml
Created May 4, 2011 01:26
Maven pom configuration file snippet incorporating groovy
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>${gmaven-version}</version>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
@jweden
jweden / TestBase.java
Created May 4, 2011 00:38
Superclass for tests that calls into the groovy class to obtain data for the data-driven tests
package weden.jason.qa.someProduct;
import java.util.List;
import java.util.Map;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.testng.annotations.DataProvider;
/**
@jweden
jweden / TestcaseGrabber.groovy
Created May 4, 2011 00:36
Reads in groovy-style properties file
package weden.jason.qa.someProduct;
/**
* This is the groovy class which puts the test cases in the external testCases.properties
* file into a data structure for the java program to use.
*/
public class TestcaseGrabber {
protected List<Map<String,String>> getTestcases() {
def testConfig = null;
try {
@jweden
jweden / gist:954536
Created May 4, 2011 00:35
testCase.properties -- Groovy Properties File
testCases = [
['testDescription': 'Initial Test',
'xmlToUse' : '''<searchWithXML>
<id>40014</id>
<date></date>
<enddate></enddate>
<value>true</value>
</searchWithXML>'''],
['testDescription': 'Second Test',