GraphWalker Project Documentation
repository·master·Indexed 18 days ago
https://github.com/graphwalker/graphwalker-projectA model-based testing tool for visualizing and executing models. It includes a core engine (graphwalker-core), a graphical Studio (graphwalker-studio v4.3.3), a CLI, and a RESTful API for remote model execution. The project provides a DSL for graph definitions using ANTLR4, a model checker for validating vertices and contexts, and a Maven archetype for project bootstrapping.
What's inside GraphWalker
- The GraphWalker DSL (Domain Specific Language) module contains the core text parsing logic for GraphWalker. It utilizes ANTLR4 to parse graph definitions and execution scripts, enabling the transformation of text-based graph descriptions into executable models.
Use the GraphWalker RESTful API
masterThegraphwalker-restfulmodule provides a RESTful API that allows any tool or programming language capable of making HTTP requests to interact with GraphWalker. This enables remote model execution, state management, and statistics retrieval via standard HTTP methods (GET, POST, PUT).How GraphWalker Core components work together
masterGraphWalker Core is a model-based testing engine that uses the following components to generate and execute test sequences:
- Model: A finite state diagram consisting of
Vertex(states) andEdge(transitions). - Algorithms: Logic used by generators to traverse the model (e.g., A*, Depth-first Search, Eulerian).
- Generators: Use algorithms to decide how to traverse the model (e.g.,
RandomPath,QuickRandomPath,PredefinedPath). - Stop Conditions: Criteria used by generators to halt (e.g.,
VertexCoverage,EdgeCoverage,ReachedVertex,Time duration). - Context: An
ExecutionContextthat binds aModeland aPathGeneratortogether. - Machine: The execution engine (e.g.,
SimpleMachine) that takes theContextand produces the actual path steps.
- Model: A finite state diagram consisting of
Avoid using global scope
masterAvoid placing everything in the global scope. Doing so makes the application vulnerable to conflicts with 3rd-party code.Use a linter for consistent styling
masterUse a linter like ESLint to ensure consistent code styling across the project.Create a GraphWalker Maven project using the archetype
masterUse the
graphwalker-maven-archetypeto quickly generate a boilerplate Maven project configured for GraphWalker. This archetype sets up the necessary dependencies and structure to start running GraphWalker tests immediately.mvn archetype:generate -B \ -DarchetypeGroupId=org.graphwalker \ -DarchetypeArtifactId=graphwalker-maven-archetype \ -DgroupId=com.company \ -DartifactId=myProject \ -DarchetypeVersion=LATESTBuild and run a GraphWalker sample project
masterAfter generating a project with the archetype, navigate into the project directory and use the Maven
exec:javaplugin to compile and execute the runner class. By default, the archetype provides acom.company.Runnerclass to demonstrate the execution.cd myProject mvn compile exec:java -Dexec.mainClass="com.company.Runner"Maintain consistency between jQuery and native JS
masterBe consistent in your coding style. Whether using jQuery (e.g.,$('#foo')) or vanilla JavaScript (e.g.,document.getElementById('foo')), ensure you apply the same logic consistently across the codebase for DOM lookups and event handlers.Get the source code and build all modules
masterTo build the entire GraphWalker project from source, clone the repository and use Maven to install all modules.
git clone https://github.com/GraphWalker/graphwalker-project.git cd graphwalker-project mvn installAvoid initializing variables with `undefined`
masterDo not explicitly assign
undefinedto a variable during declaration. Declaring a variable without an assignment automatically initializes it toundefined.// No: var foo = undefined; // Yes: var foo;Build the GraphWalker command-line tool
masterTo build only the standalone command-line interface (CLI) tool, use the following Maven command. The resulting JAR file will be located in the
graphwalker-cli/target/directory.mvn package -pl graphwalker-cli -amBreak code down into external JS files and modules
masterKeep JavaScript in.jsfiles and break the code down into different modules. This approach makes the codebase more maintainable and easier to unit-test.