01 - Plugin architecture
Physical architecture
All the Squash TA plugins need to be architectured the same way.
All the plugins are maven projects, with four folders:
src/main/java
src/main/resources
src/test/groovy
src/test/resources
Look for example at the Sahi plugin:
Directory src/main/java
This directory contains the classes and interfaces of the plugin.
These classes must be put in several packages. The Squash team uses the following formalism: org.squashtest.ta.plugin.{{pluginname}}, following by:
resources: contains the resources+ the plugin needs.
converters: contains the type of converter
commands: contains the command (for EXECUTE instructions)
assertions: contains the kind of assertions (for ASSERT instructions)
exceptions: contains the customed exceptions that causes a build failure
library: contains all the necessary classes for the engine of the plugin
We recommand you to use the same formalism, especially if you want to share your code with the community.
Directory src/main/resources
Configure macros
If the plugin needs default macros, those are defined in src/main/resources/builtin/macros.
Configure squashTA-components.mf
Every plugins needs to define its name and its packages in a file named src/main/resources/META-INF/squashTA-components.mf.
Example for the Sahi plugin:
squashTA-components.mf
pluginName: org.squashtest.ta.plugin.sahi
basePackage: org.squashtest.ta.plugin.sahi.assertions
basePackage: org.squashtest.ta.plugin.sahi.commands
basePackage: org.squashtest.ta.plugin.sahi.converters
basePackage: org.squashtest.ta.plugin.sahi.resources
Configure resources
Work in progress
Directory src/test/groovy
This directory contains the Groovy unitary tests (know more about those tests here).
Directory src/test/resources
This directory manage the resources the groovy tests need, if any.
Configuration
artifactId : org.squashtest.ta.plugin
groupId : squash-ta-plugin-xxx
Modify the new plugin's pom.xml
The plugin's pom.xml must be rattached to the parent's pom.xml of ta.plugin.umbrella.
Example for sahi plugin's pom.xml:
new plugin pom.xml
[...]
<parent>
<groupId>org.squashtest.ta.plugin</groupId>
<artifactId>squash-ta-plugin-parent</artifactId>
<version>{{squash ta version number}}</version>
</parent>
<artifactId>{{your-project-name}}</artifactId>
[...]
Modify the plugin-umbrella's pom.xml (not required for third party plugins)
You need to add your new developped plugin to squash-ta-plugin-umbrella's pom.xml by adding this new dependency:
plugin-umbrella pom.xml
[...]
<dependency>
<groupId>org.squashtest.ta.plugin</groupId>
<artifactId>squash.ta.plugin.{{your-project-name}}</artifactId>
<version>${project.version}</version>
</dependency>
[...]
Modify the plugin-parent's pom.xml (not required for third party plugins)
You also need to add your new developped plugin to Squash-TA plugin parent pom.xml by adding this new module:
plugin-umbrella pom.xml
[...]
<modules>
[...]
<module>squash.ta.plugin.{{your-project-name}}</module>
</modules>
[...]