Java test step

The Java test step executes arbitrary Java code using the set Java version. Java version 8 and 11 are supported. The maximum length of the script is 10240 characters.

The step fails if the script execution fails or if it ends with a non-zero exit code. The content of the standard output and standard error is recorded as the result of the test step and can be viewed using the Wenenu UI or accessed using the Wenenu API. The maximum combined length of the standard output and error is 20000 characters. The output is truncated if it exceeds the maximum length.

Note For Java version 8 the class name must be WenenuTest
Note The variables of the test scenario are available as environment variables during the execution.
Note Filesystem operations are available. Every test step runs in separate docker containers. Test steps in the same test scenario have a common directory mounted into the container, sharing files between test steps is possible. The mounted directory is under /tests which is the current directory when the test execution starts.
Warning For security reasons, do not display any sensitive information in the step result.

UI settings

Java step UI settings
Figure 1. Java step UI settings

1

Arbitrary name of the test step up to 64 characters

2

Test agent that is going to execute the test step

3

Version of Java that executes the code

4

Arbitrary Java code that gets executed

JSON

{
  "displayName": "Java", 1
  "type": "java", 2
  "id": "27a1ad2d-3dc4-4a5d-9c91-ba5eb7fe4db9", 3
  "version": "8", 4
  "code": "public class WenenuTest {\n\n    public static void main(String[] args) {\n        System.out.println(\"Hello World\");\n    }\n}", 5
  "agent": { 6
    "type": "standard",
    "id": "162dff466f92c372005cf7055d006b77ac377e01c60ae59f942d74680f2496d1"
  }
}
1 Arbitrary name of the test step up to 64 characters
2 Type of the test step, must be 'java'
3 Version 4 unique identifier of the test step, must be unique within the test scenario
4 Version of Java that executes the code
5 Arbitrary Java code that gets executed
6 Agent object defining the agent that will execute the test step

Available modules, commands and libraries

OpenJDK 1.8.0_292

Name Type Version

hibernate-entitymanager

package

3.4.0.GA

guava

package

30.1.1-jre

junit

package

4.12

commons-lang

package

2.6

httpclient

package

4.5.13

assertj-core

package

3.19.0

commons-logging

package

1.2

commons-codec

package

1.15

testng

package

7.40

jackson-annotations

package

2.12.3

commons-collections4

package

4.4

httpclient

package

4.5.13

rxjava

package

2.2.21

mysql-connector-java

package

8.0.25

okhttp

package

4.9.1

rest-assured

package

4.3.3

okio

package

2.10.0

grpc-netty

package

1.38.0

joda-time

package

2.10.10

junit-jupiter-api

package

5.7.0

jackson-databind

package

2.12.3

jackson-annotations

package

2.12.3

commons-io

package

2.8.0

mongo-java-driver

package

3.12.8

postgresql

package

42.2.20

jedis

package

3.6.0

lombok

package

1.18.20

mockito-all

package

1.10.19

slf4j-log4j12

package

1.7.30

gson

package

2.8.6

log4j

package

1.2.17

commons-lang3

package

3.12.0

logback-classic

package

1.2.3

mockito-core

package

3.10.0

slf4j-api

package

1.8.0-beta4

java-sql-odbc

package

1.0.2

OpenJDK 11.0.11

Name Type Version

hibernate-entitymanager

package

3.4.0.GA

guava

package

30.1.1-jre

junit

package

4.12

commons-lang

package

2.6

httpclient

package

4.5.13

assertj-core

package

3.19.0

commons-logging

package

1.2

commons-codec

package

1.15

testng

package

7.40

jackson-annotations

package

2.12.3

commons-collections4

package

4.4

httpclient

package

4.5.13

rxjava

package

2.2.21

mysql-connector-java

package

8.0.25

okhttp

package

4.9.1

rest-assured

package

4.3.3

okio

package

2.10.0

grpc-netty

package

1.38.0

joda-time

package

2.10.10

junit-jupiter-api

package

5.7.0

jackson-databind

package

2.12.3

jackson-annotations

package

2.12.3

commons-io

package

2.8.0

mongo-java-driver

package

3.12.8

postgresql

package

42.2.20

jedis

package

3.6.0

lombok

package

1.18.20

mockito-all

package

1.10.19

slf4j-log4j12

package

1.7.30

gson

package

2.8.6

log4j

package

1.2.17

commons-lang3

package

3.12.0

logback-classic

package

1.2.3

mockito-core

package

3.10.0

slf4j-api

package

1.8.0-beta4

java-sql-odbc

package

1.0.2