0
votes

I use Java + Robot Framework to test micro services. So I have created a several test projects for each service. For testing I create a few java classes with keywords to work with HTTP and JSON on low level. I separated these classes into a library which I plan to add to test project as maven dependency.

Also I want to add common keywords into robot-file to this external library.

enter image description here

But the problem is I cannot import those robot-files in my tests.

enter image description here

Please pay attention that first picture is external project, and second picture is project with tests.

Does anyone faced with such problem and if so which decision have you come up with?

1
You want to package the Java Robot-Keywords + Common Robot keywords (Robot File) into a jar and you want to import that jar into a Robot test case file. Am I right? - william cage
Yes, you are right. - Seploid
Gotcha! Can you include the error that you are receiving? (+ if you can include a code snippet that you tried it would be more helpful) - william cage
I have added screenshots. - Seploid

1 Answers

0
votes

I managed to apply hack with maven plugins. So I just copy resources in current project.

<build>
       …
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>prototype-apitesting</groupId>
                                    <artifactId>apitesting</artifactId>
                                    <version>${acceptence.test.library.version}</version>
                                    <type>jar</type>
                                    <includes>com.robot.common/*</includes>
                                    <outputDirectory>${basedir}/src/main/resources</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

Structure of External library

├── java
│   └── com
│       └── robot
│           └── sample
│               └── keywords
│                   └── APITestingKeywords.java
└── resources
    └── com.robot.common
        ├── Config.robot
        ├── HttpAssertions.robot
        └── keywords
            ├── AccountServicesKeywords.robot
            └── SessionServicesKeywords.robot