Skip to content

Find dependencies on test and mock frameworks that are in Fat JAR #34

Closed
@viktoriia-fomina

Description

@viktoriia-fomina

Description

When users try to generate tests by UTBot Java CLI JAR, they get an exception java.lang.IllegalStateException. As a result, tests are not generated.
But when users try to generate tests with UTBot Java CLI application, not JAR, everything is Ok.

It happens because of we check existence of test frameworks dependencies looking at the JAR's MANIFEST file.

Thus, when we run Java CLI as an application, its dependencies, such as test frameworks or mock frameworks, can be found in the classpath as JAR files.

As an example, we look at some JAR that's in the classpath (imagine we run UTBot Java CLI as an application). We open its MANIFEST file and get the information clarifying this is JUnit4 test framework dependency. But when we run JAR file, all the dependencies are packed into Fat JAR. So if we check the Fat JAR's (such as utbot-cli-{version}.jar, utbot-junit-contest-{version}.jar) MANIFEST file, we realize this is not a test framework dependency such as JUnit4.

To Reproduce

For instance, run UTBot Java CLI .jar file with correct keys and parameters.

Expected behavior

Whether we run application or Far JAR, tests and mock frameworks are detected.

Actual behavior

When we run Far JAR tests and mock frameworks are not detected.

Visual proofs

That's what happens when we try to run utbot-cli-{version}.jar generate command:
image

Environment

Java: Amazon Corretto 8

Additional context

Fat JAR contains single MANIFEST file giving us the information about itself.

Metadata

Metadata

Labels

ctg-bugIssue is a bug

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions