Robot Framework Plugin for Gradle

This plugin for Gradle enables calling Robot Framework using Robot's jython jar. The plugin assumes that the java keyword libraries are taken from src/integ/java and run robot tests from src/integ/robot. It provides multiple tasks for running the tool: robotRun, robotDryRun, robotRebot, robotLibdoc, robotTestdoc and robotTidy. Current development state is at experimental level.

Applying the plugin

plugins {
    id "org.theotherorg.poros.robot" version: 0.9.4
}

apply "org.theotherorg.poros.robot"

Configuring the plugin

This plugin will create the src/integ sourceSet and creates also a configuration named robot, which can be used to add dependencies to the Robot runtime.

dependencies {
    robot "com.google.guava:guava:27.0.1-jre"

    implementation "com.google.guava:guava:27.0.1-jre"
}

robotRun and robotDryRun

Executes the run command on all tests found in src/integ/robot. RobotDryRun is a utility command which applies the --dryrun option to the normal run command. Output is directed to build/reports/robot/... by default. The following options are supported for both tasks:

robot {
    toolVersion = "3.1.2"

    common {
        argumentFiles = ["common.conf"]
        doc = "common doc"
        excludes = ["commonTag"]
        includes = ["commonTag"]
        metadata = ["task_common_key": "task_common_pair"]
        name = "task common doc"
        pythonPaths = []
        suites = ["task common name"]
        tags = ["poros:common:task"]
        tests = ["Common Test"]
    }

    report {
        consoleColors = "auto"
        criticals = ["criticalTag"]
        flattenKeywords = ["foritem"]
        log = file("build/reports/robot/log.html")
        logLevel = "DEBUG"
        logTitle = "Task Log Title"
        nonCriticals = ["nonCriticalTag"]
        noStatusRc = true
        //output = config("build/reports/robot/output.hml")
        //outputDir = config("build/reports/robot")
        preRebotModifiers = []
        removeKeywords = ["tag:notexist"]
        report = file("build/reports/robot/report.html")
        reportBackground = "blue:red"
        reportTitle = "Task Report Title"
        rpa = true
        splitLog = true
        suiteStatLevel = 3
        tagDocs = []
        tagStatCombines = []
        tagStatExcludes = []
        tagStatIncludes = []
        tagStatLinks = []
        tasks = []
        timeStampOutputs = true
        xunit = null
        xunitSkipNonCritical = true
    }

    run {
        argumentFiles = ["arguments.conf"]
        doc = "task doc"
        excludes = ["excludeTag"]
        includes = ["includeTag"]
        metadata = [:]
        name = "task run name"
        pythonPaths = []
        suites = ["task run name"]
        tags = ["poros:task"]
        tests = ["Test Echo String", "Test Echo String 2"]
        consoleMarkers = "auto"
        consoleType = "verbose"
        consoleWidth = 120
        debugFile = file("build/reports/robot/debug")
        exitOnError = true
        exitOnFailure = true
        extensions = ["robot", "html"]
        listeners = ["org.theotherorg.poros.robot.test.SampleListener"]
        maxErrorLines = 20
        preRunModifiers = []
        randomize = "all"
        //rerunFailed = file("build/reports/robot/output.xml")
        //rerunFailedSuites = file("build/reports/robot/output.xml")
        runEmptySuite = true
        skipTearDownOnExit = true
        //variableFiles = ["somefile"]
        variables = ["somevar":"somevalue"]
    }
}

robotRebot

Executes the rebot command on the default output file found in build/reports/robot. The following rebot options are supported:

robot {
    toolVersion = "3.1.2"

    common {
        argumentFiles = ["common.conf"]
        doc = "common doc"
        excludes = ["commonTag"]
        includes = ["commonTag"]
        metadata = ["task_common_key": "task_common_pair"]
        name = "task common doc"
        pythonPaths = []
        suites = ["task common name"]
        tags = ["poros:common:task"]
        tests = ["Common Test"]
    }

    report {
        consoleColors = "auto"
        criticals = ["criticalTag"]
        flattenKeywords = ["foritem"]
        log = file("build/reports/robot/log.html")
        logLevel = "DEBUG"
        logTitle = "Task Log Title"
        nonCriticals = ["nonCriticalTag"]
        noStatusRc = true
        //output = config("build/reports/robot/output.hml")
        //outputDir = config("build/reports/robot")
        preRebotModifiers = []
        removeKeywords = ["tag:notexist"]
        report = file("build/reports/robot/report.html")
        reportBackground = "blue:red"
        reportTitle = "Task Report Title"
        rpa = true
        splitLog = true
        suiteStatLevel = 3
        tagDocs = []
        tagStatCombines = []
        tagStatExcludes = []
        tagStatIncludes = []
        tagStatLinks = []
        tasks = []
        timeStampOutputs = true
        xunit = null
        xunitSkipNonCritical = true
    }

    rebot {
        argumentFiles = ["arguments.conf"]
        doc = "task doc"
        excludes = ["excludeTag"]
        includes = ["includeTag"]
        metadata = [:]
        name = "task run name"
        pythonPaths = []
        suites = ["task run name"]
        tags = ["poros:task"]
        tests = ["Test Echo String", "Test Echo String 2"]
        endTime = null
        //outputXml = file("build/reports/robot/output.xml")
        processEmptySuite = true
        startTime = null
    }
}

robotLibdoc

Executes the libdoc command on all keyword libraries found in src/integ/java. This command has limitations on all JDK below 9. It uses the JDK javadoc tool for which Robot has difficulties with passing 3rd party libraries on the classpath. The following options are supported:

robot {
    toolVersion = "3.1.2"

    libdoc {
        format = "HTML"
        docFormat = "HTML"
        version = "0.2"
    }
}

robotTestdoc

Executes the testdoc command on all robot script files in src/integ/robot. By default test documentation is written to build/reports/robot/output.html. The following options are supported:

robot {
    toolVersion = "3.1.2"

    testdoc {
        argumentFiles = ["arguments.conf"]
        //doc = "task doc"
        excludes = ["excludeTag"]
        includes = ["includeTag"]
        metadata = ["task_key": "task_pair", "task key 2" : "task pair 2"]
        name = "task testdoc name"
        suites = ["task testdoc name"]
        tags = ["poros:task"]
        tests = ["Test Echo String"]
        // outputFile = file("testdoc.html")
        title = "task_testdoc_title"
    }
}

robotTidy

Executes the tidy command in place, by default, on all supported script files. The following options are supported:

robot {
    toolVersion = "3.1.2"

    tidy {
        format = "robot"
        usePipes = false
        lineSeparator = "unix"
        spaceCount = 4
    }
}

Examples

Examples are available in the Poros project tree.