Skip to content

toast-tk/toast-tk-plugin-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TOAST TK - Agent Plugin Example

This is an example of a web action adapter plugin.
Plugins are used to extend the agent test execution vocabulary and SUT (System Under Test) driving capabilities.

How to create a plugin

Create a new maven project

Add a dependency to both the adapter and the agent api

	<dependency>
		<groupId>io.toast-tk</groupId>
		<artifactId>toast-tk-adapters-api</artifactId>
		<version>0.1.5-SNAPSHOT</version>
	</dependency>
	<dependency>
		<groupId>io.toast-tk</groupId>
		<artifactId>toast-tk-agent-api</artifactId>
		<version>0.1.5-SNAPSHOT</version>
	</dependency>

Create a class that extends IAgentPlugin (i.e: my.first.plugin.MyAgentPlugin)

Bind your actions adapters (example from PluginExample.java)

	@Override
	public Collection<? extends Module> getModules() {
		Module module = new AbstractActionAdapterModule() {
			@Override
			protected void configure() {
				bindActionAdapter(WebActionAdapter.class);			
			}
		};
		return Arrays.asList(module);
	}

Add the plugin service locator to your project META-INF folder

	src/main/resources
	 |__ META-INF
	 |____ services
	 |______ io.toast.tk.plugin.IAgentPlugin

Reference your plugin Class Qualifid name in io.toast.tk.plugin.IAgentPlugin file

my.first.plugin.MyAgentPlugin

Package a standalone version of your plugin:

  • Use maven-assembly plugin (the plugin must include it's runtime dependencies)
  • assembly.xml example:
<assembly
	xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
	<id>plugin</id>
	<formats>
		<format>jar</format>
	</formats>
	<includeBaseDirectory>false</includeBaseDirectory>
	<dependencySets>
		<dependencySet>
			<outputDirectory>/</outputDirectory>
			<useProjectArtifact>true</useProjectArtifact>
			<unpack>true</unpack>
			<scope>runtime</scope>
			<excludes>
			</excludes>
		</dependencySet>
	</dependencySets>
</assembly>
  • Maven assemble plugin example:
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-assembly-plugin</artifactId>
	<version>2.5.3</version>
	<executions>
		<execution>
			<goals>
				<goal>attached</goal>
			</goals>
			<phase>package</phase>
			<configuration>
				<finalName>toast-tk-example</finalName>
				<descriptor>src/assembly/bin.xml</descriptor>
			</configuration>
		</execution>
	</executions>
</plugin>

Enjoy, you're done !
The assembled jar (here: /target/toast-tk-example-plugin.jar) can be copied to your agent plugin directory.

Contribution

Toast TK is a young Open Source Love project.

For contribution rules and guidelines, See CONTRIBUTING.md

If you'd like to help, get in touch and let us know how you'd like to help. We love contributors!!

Licence

See Toast-tk Apache License 2.0

About

Toast TK Agent Plugin Example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages