Skip to content

Testing Generators

  1. Create a new Plugin-in Project.
  2. In “/src/test/java” create a Class for each test you want to run.
  3. Import the package “com.vd.jenerateit.server.test.util”.
  4. Extend the “AbstractGeneratorTest” in your newly created class.
  5. Implement the abstract methods.
    1. It is sufficient to only Override “getGensetBundleId()” (You can also Override “getGensetStream()” if your Genset is not bundled) and “getZippedInputModel()” for the first try.
    2. To manipulate the Test, read the JavaDoc of the “AbstractGeneratorTest” and Override the necessary methods.
  6. Add the Modelacces, Converter, Generation Group and the Genset Bundle to your Required Bundles.
  7. Add the necessary language definition to your Required Bundles (com.gs.gapp.language.dsl.ui.plugin)
  8. Import the package org.junit (org.junit;version=”[4.10.0,5.0.0)”)
  9. Add the “/src/test/resources” directory to your “build.properties”.
  10. Create a “pom.xml” file for your project, packaging is “eclipse-test-plugin”.
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <parent>
            <artifactId>com.gs.gapp.PARENT-maven</artifactId>
            <groupId>com.gs.gapp</groupId>
            <version>1.0.0</version>
        </parent>
    
        <artifactId>com.gs.gapp.PROJECT-test</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <name>gApp Test</name>
        <packaging>eclipse-test-plugin</packaging>
    
    
        <build>
            <plugins>
    
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-surefire-plugin</artifactId>
                    <version>${tycho-version}</version>
                    <configuration>
                        <!-- Uncomment to connect remote debugger -->
                        <!-- <debugPort>5000</debugPort> -->
    
                        <!-- Uncomment to debug with "telnet localhost 5555" to OSGI console -->
                        <!-- <appArgLine>-consoleLog -console 5555 -noExit</appArgLine> -->
                        <!-- <excludes>
                            <exclude>**/*Test.java</exclude>
                        </excludes> -->
                        <defaultStartLevel>
                            <level>4</level>
                            <autoStart>true</autoStart>
                        </defaultStartLevel>
    
                        <dependencies>
                            <dependency>
                                <type>p2-installable-unit</type>
                                <artifactId>org.eclipse.equinox.ds</artifactId>
                            </dependency>
                            <dependency>
                                <type>p2-installable-unit</type>
                                <artifactId>org.eclipse.equinox.cm</artifactId>
                            </dependency>
                            <dependency>
                                <type>p2-installable-unit</type>
                                <artifactId>org.eclipse.equinox.console</artifactId>
                            </dependency>
                            <dependency>
                                <type>p2-installable-unit</type>
                                <artifactId>org.apache.felix.gogo.shell</artifactId>
                            </dependency>
                            <dependency>
                                <type>p2-installable-unit</type>
                                <artifactId>org.apache.felix.gogo.command</artifactId>
                            </dependency>
                            <dependency>
                                <type>p2-installable-unit</type>
                                <artifactId>org.apache.felix.gogo.runtime</artifactId>
                            </dependency>
                        </dependencies>
    
                        <bundleStartLevel>
                            <bundle>
                                <id>javax.transaction</id>
                                <level>4</level>
                                <autoStart>false</autoStart>
                            </bundle>
                            <bundle>
                                <id>com.vd.jenerateit-server</id>
                                <level>4</level>
                                <autoStart>false</autoStart>
                            </bundle>
                            <bundle>
                                <id>org.eclipse.tycho.surefire.junit4</id>
                                <level>4</level>
                                <autoStart>false</autoStart>
                            </bundle>
                        </bundleStartLevel>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>
    
  11. Add the test module in your parent “pom.xml”.
  12. Run the test in your parent with “mvn verify”.