Code Monkey home page Code Monkey logo

jinteg's Introduction

jinteg

A super-simple integration testing framework for Java

I created this project to fill a need that I had for a simple way to write consistent integration tests designed to be run in a terminal in a production (or near-production) environment. I didn't want to rely on specifically tailored environments, complicated mocking constructs, or funky test runners. jinteg provides a simple framework for writing integration tests that can be run directly from java (via a main method) and whose results are easily parsed.

Usage is simple:

  • The test class inherits the base class IntegrationTest
  • Test methods are public, static, and return an instance of ITResult
  • Finally, the test class needs a main method that runs one of the run methods

Here's a simple example:

public class FooIT {
	
	public static ITResult fooConnectsToDatabase() throws DBConnectionException {
		DBConnection conn = new Foo().getDBConnection();
		
		if (conn != null) {
			return new ITPass();
		} else {
			return new ITFail("DatabaseConnector didn't return a connection");
		}
	}
	
	public static ITResult fooConnectsToWebService() throws WebServiceConnectionException() {
		boolean isLoggedIn = Foo.connectToWebService("testuser", "testpassword");
		
		if (isLoggedIn) {
			return new ITPass();
		} else {
			return new ITFail("Login to web service failed");
		}
	}
	
	public static void main(String[] args) {
		run(FooIT.class);
	}
}

For more advanced usage and more detailed documentation, visit the wiki.

Installing

A pre-built jar is available for download in the releases section.

Hacking and Building

Gradle is the build tool of choice for this project. There are no special Gradle tasks implemented here, so building is quite simple:

  • gradle eclipse builds the project and classpath files needed to work in Eclipse
  • gradle jar builds the jar

Note: if your workstation does not have Gradle installed, use ./gradlew or ./gradlew.bat in place of gradle in the previous commands

jinteg's People

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.