Skip to content

iv4xr-project/aplib

Repository files navigation

iv4xr-core

Despite the packaging name 'aplib' this project should be called iv4XR-core, of which aplib is part of. Iv4xr-core is a Java Library providing intelligent agents for automated testing. The primary use case is for testing highly interactive systems such as computer games though the library is generic enough to also be able to handle other types of systems. Within this Core, the aplib part forms its original agent programming inner-core.

Iv4xr-core forms the core of a bigger framework with the same name: iv4xr Framework. The latter integrates other approaches such as model-based testing (MBT), automated scriptless testing (through TESTAR), and player/user experience testing along side the Core.

The simplest setup to use iv4xr-core is:

  1. Create a Java method m() where you create one agent a.
  2. An agent is typically used to control some environment (e.g. a game). Attach an interface that would connect the agent a to the environment.
  3. formulate a goal for the agent a (e.g. to win the game), and program a tactic to accomplish/solve the goal.
  4. run the method m().

When the agent is used for testing, then we need an agent that is also a test agent; this would have some extra functionalities such as collecting test verdicts. For concrete examples see the tutorials povided here (general about agent) and here (for test-agent).

The inner-core aplib (shorthand of Agent Programming Library) is btw actually general purpose, and can be used to program agents for purposes other than testing. On top of aplib, the Core adds testing-related functionalities and few other extra functionalities like a common world representation. Using iv4xr-core can be seen as a special case of using aplib, where you get some testing-specific extra capabilities, such as expressing test oracles.

Features:

  • Fluent interface style of APIs.
  • BDI-inspired agents: they have their own states (their belief) and goals. The latter allows them to be programmed in a goal-oriented way.
  • Combinators for high level goal and tactical programming.
  • Multi agent: programming multiple agents controlling the a shared environment and communicating through channels.
  • Prolog binding: allowing agents to do prolog-based reasoning to help them solving goals.
  • Bounded LTL: for expressing temporal properties that can be checked during testing, or on traces generated by the tests.
  • An LTL model checker: can be used for solving goals, e.g. when the problem to solve can be converted to a model/program that can be targeted by the model checker.
  • Data collection: agents can collect traces for post-mortem data analyses.

Papers

Manuals, Reference, and Tutorials: see above.

Some code snippets:

  • Specifying a goal. The goal below is solved when offered a value x == 10.
goal("Magic number is guessed!").toSolve((Integer x) -> x == 10)
  • Specifying a tactic. A tactic specifies a program/heuristic for solving a goal. It could look like this:
FIRSTof(guessLowerbound.on_((Belief belief) -> ! belief.feelingVeryLucky() ,
        ANYof(speculate1,
              speculate2,
              ...)
  • Creating and configuring an agent in the fluent interface style:
new AutonomousBasicAgent()
    . attachState(new StateWithMessanger() .setEnvironment(new ConsoleEnvironment()))
    . setGoal(topgoal)
    . setSamplingInterval(1000)
  • Launching an autonomous agent on a new thread:
new Thread(() -> agent.loop()) . start()

Building with Maven

You need Java-11 or higher.

You can run mvn (Maven) at the project root to do the things listed below. Maven will put artifacts it produces under the directory ./target in the project root.

  • To compile the project: mvn compile
  • To run the project unit tests: mvn test
  • To produce a jar of the project: mvn package. This will invoke compile and test, and then produce a jar containing the whole project. This is the jar you want to use if you want to include in your own project if you want to use aplib.
  • To generate the javadoc APIs documentation: mvn javadoc:javadoc. The resulting documentations can be found in ./target/site/apicdocs.
  • To clean ./target: mvn clean

Projects dir. structure

  • ./src/main/java : the root of aplib Java source code.
  • ./src/test/java : the root of Java source code of aplib unit tests.
  • ./docs/manual : contain some tutorials and documentations.
  • ./libs: external jars provided for convenience. You should not need these jars if you build using Maven. They are needed if you want to work on aplib itself and want to just link the jars immediately.

License

Copyright (c) 2019, Utrecht University.

Aplib is an open source software. It can be used and distributed under the LGPL version 3 license.

Credits

Contributors:

  • Wishnu Prasetya, Naraenda Prasetya, Saba Ansari, Samira Shirzadeh, Fitsum Kifetew.