MavenPlugin icon indicating copy to clipboard operation
MavenPlugin copied to clipboard

Generating keyword documentation with robotframework-maven-plugin libdoc goal fails

Open bioneyez opened this issue 4 years ago • 0 comments

I have a Maven project that creates a Remote Robotframework Library using Java. I'm trying to generate documentation for the remote keywords using robotframework-maven-plugin's libdoc goal. The libraries are created using Spring.

Unfortunately when the plugin runs it throws an error:

Test Library 'com.statlogics.lam.ta.robot.ApplicationLibrary' expected 3 arguments, got 0.

I'm pretty sure it fails at the constructor. But how can I resolve this issue? Can I somehow exclude the constructor from the generation since I don't even need it?

(I have to use the 1.4.9 version since this is the last version which supports Java 7)

pom.xml

<plugin>
                <groupId>org.robotframework</groupId>
                <artifactId>robotframework-maven-plugin</artifactId>
                <version>1.4.9</version>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>libdoc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <libdoc>
                        <outputFile>${project.build.directory}/robot/libdoc/*.html</outputFile>
                        <libraryOrResourceFile>com.statlogics.lam.ta.robot.ApplicationLibrary</libraryOrResourceFile>
                    </libdoc>
                    <testdoc></testdoc>
                </configuration>
</plugin>

The example library looks like this:

ApplicationLibrary.java

@RobotKeywords
public class ApplicationLibrary extends BaseLibrary {
    public static final String ROBOT_LIBRARY_SCOPE = "GLOBAL";
    public static final String ROBOT_LIBRARY_VERSION = "1.0.0";

    private final OpenAccountAction openAccount;

    public ApplicationLibrary(final GlobalVariableStorage variableStorage, final StepResults stepResults, final OpenAccountAction openAccount) {
        super(variableStorage, stepResults);
        this.openAccount = openAccount;
    }

    @RobotKeyword("Creates an application with the given arguments. \n\n" +
            "Example:\n" +
            "libOpenAccountDict | POSPF | 3 | ${applicationDataDictionary}")
    @ArgumentNames({"variablePrefix", "quantity", "applicationData"})
    public List<String> libOpenAccountDict(String variablePrefix, Integer quantity, Map<String, String> applicationData) throws Throwable{
        OpenAccountParameter param = createOpenAccountParameterWithAppData(applicationData);
        setOpenAccountParameterCredentials(param);
        param.setVariableName(variablePrefix);
        param.setQuantity(quantity);
        this.openAccount.processWithErrorHandling(param, getStepResults(), this.getVariableStorage(), true);
        return param.getOpenedAccounts();
    }

Libraries.java

@Configuration
@Lazy
public class Libraries {

    @Bean(name = "applicationLibrary")
    public ApplicationLibrary getApplicationLibrary() {
        return new ApplicationLibrary(this.variableStorage, this.stepResults, this.openAccountAction);
    }

...

bioneyez avatar Oct 13 '20 11:10 bioneyez