Git Product home page Git Product logo

simplefunctionaltest's Introduction

# SimpleFunctionalTest

A JUnit extension to easily adopt functional testing and acceptance testing

step 1: make your test readable

In JUnit test: refactor your test in order to make it more readable by non java native speaker.

  • Add comment before class or test method
  • Use expressive names (camelCase or underscore) for your class, test methods and other methods
  • In your test ONLY use method calls

A 'more' readable JUnit test for a non native java speaker:

...
/*
As an Account Holder
I want to withdraw cash from an ATM
So that I can get money when the bank is closed
*/
public class AccountHolderWithdrawCash {
	...
	@Test
	public void accountHasSufficientFunds() {
		givenTheAccountBalanceIs100Dollars();
		andTheCardIsValid();
		andTheMachineContainsEnoughMoney();

		whenTheAccountHolderRequests20Dollars();

		thenTheAtmShouldDispense20Dollars();
		andTheAccountBalanceShouldBe80Dollars();
		andTheCardShouldBeReturned();
	}

	private void givenTheAccountBalanceIs100Dollars(){
	    ...
	}
    ...
}

step 2: add SimpleFunctionalTest

In your pom file: insert dependencies to SimpleFunctionalTest

<project>
	...
	<dependencies>
		...
		<dependency>
			<groupId>com.github.slezier</groupId>
			<artifactId>SimpleFunctionalTest</artifactId>
			<version>1.8</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>

and specify SimpleFunctionalTest as JUnit runner:

...
@RunWith(SimpleFunctionalTest.class)
public class AccountHolderWithdrawCash {
	...

step 3: enjoy

Run the test.

Open the html file generated:

A simple acceptance test using SFT

Other fixtures

Use weirds characters or specify the way is displayed.

Parameterize your fixture.

Links use cases together.

Manage test context.

Decorate: Table of content, breadcrumb, group fixtures, fixture displayed as table.

Deeper

How to use SimpleFunctionalTest

See also

Available release:

  • 1.9: New usecase decorator: Synthesis jar doc
  • 1.8: Can add new decorator, context is displayed even if failure occurs jar doc
  • 1.7: Better ide integration, Fix configuration uses, add Group decorator for scenarios jar doc
  • 1.6: Table decorator, @Displayable @Before @After @BeforeClass @AfterClass from FixturesHelper, preserve empty line in scenario jar doc
  • 1.5: Bug fix jar doc
  • 1.4: Bug fix jar doc
  • 1.3: Decorators and setting jar doc
  • 1.2: Using test context jar doc
  • 1.1: Basic testing: UseCase Scenario Fixture SubUseCase and FixtureHelper jar doc

simplefunctionaltest's People

Contributors

slezier avatar

Stargazers

Marwen avatar

Watchers

James Cloos avatar Marwen avatar

Forkers

renovate-bot

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.