How EasyAccept Works
1. Clients (or whoever is assisting clients) write acceptance tests in
simple text files using any editor they choose.
Sample tests for a Monopoly
Game
2. Developers write a single Facade to the program being tested that
contains methods corresponding to the script commands used in the acceptance
tests. The Facade may even already exist, used for other purposes.
Facade for the Monopoly
test scripts
3. EasyAccept takes one or more script txt files and the Facade, runs
the scripts through the Facade methods, and compares expected results to the
actual results produced by the program. Divergences are promptly indicated,
otherwise a message stating all runs have passed is shown.
Result of running the test
script
How to Start Using EasyAccept
The overhead of getting started with EasyAccept is minimal. Simply download
the latest version of EasyAccept from its SourceForge
homepage and unzip it in your project's lib folder (or any folder included in
the classpath).
In order to call EasyAccept to test a program, two approaches are
available. The first one, using the EasyAccept API, gives the user more
flexibility when running tests and obtaining its results. The second approach
is focused on users that do not want the test execution full control. See below
how to execute testes.
1) Use the EasyAccept API:
The user needs to import EasyAccept and use its API (Application
Programming Interface). See below an example of how to test the Monopoly
Game when
using a simple client class:
================================================================================================================
import java.util.ArrayList;
import java.util.List;
import easyaccept.EasyAcceptFacade;
public class MonopolyGameTestClient {
public static void
main(String[] args) throws Exception {
List<String> files = new ArrayList<String>();
//Put
the us1.txt file into the "test scripts" list
files.add("us1.txt");
//Instantiate the Monopoly Game façade
MonopolyFacade monopolyGameFacade
= new MonopolyFacade();
//Instantiate EasyAccept façade
EasyAcceptFacade
eaFacade = new EasyAcceptFacade(monopolyGameFacade, files);
//Execute the tests
eaFacade.executeTests();
//Print the tests execution results
System.out.println(eaFacade.getCompleteResults());
}
}
===============================================================================================================
2) Use the following syntax:
java -classpath ... easyaccept.EasyAccept <FacadeClass> <scriptFile> [<scriptFile>] ...
where:
Examples:
java easyaccept.EasyAccept MonopolyFacade acctests\us1.txt acctests\us2.txt
java easyaccept.EasyAccept MonopolyFacade acctests - runs all files found in folder acctests
Sample Scripts
Suppose we are writing a Monopoly game and want to test its business
logic. See how a sample script for the "allow a Monopoly game to be
created" user story would be: us1.txt.
In this user story, the client simply wants to create a game by specifying the
number of players and each player's token color. The board must be correctly
set up with the Monopoly classic (
Additionally, check out this other user story, "Monopoly
turns", in which the client wants turns to be taken by players, using the
Monopoly game rules for paying rents, taxes, etc. All deeds are bought
automatically here. The sample scripts can be found in us2.txt. This is
an example of an inherently sequential type of testing, in which dice rolls are
made one after another.