2022-06-02

Diffblue Cover now allows writing tests for code that calls JNI libraries

The Java Native Interface (JNI) mechanism allows your Java applications to load native libraries written in C, C++, assembly, etc. Diffblue Cover executes your application in a sandboxed environment, so that its behavior can be analyzed without external effects, and by default this blocks the execution of JNI libraries. If you believe that Diffblue Cover is safe to call a native library that you use, then you can add it to the list of JNI libraries that are allowed to be loaded.

Using the CLI

Use the --allow-jni option to specifically allow JNI libraries with the given name prefix to be loaded. In this case, either --allow-jni custommagic or --allow-jni custom allows a JNI library custommagic to be loaded.

Using the Intellij plugin Select Diffblue Cover Settings > Sandboxed Environment Options > Allowed JNI prefixes.

For more information, please see our documentation at: https://docs.diffblue.com/knowledge-base/cli/jni/

Diffblue Cover provides additional guidance when using custom rules

Using custom rules allows you to specify appropriate inputs necessary to write tests for a given method under test, should Diffblue Cover be unable to do them automatically. Custom rules must be formatted correctly.

Diffblue Cover now offers additional guidance if the formatting is incorrect. For further information on custom rules, please see our documentation at: https://docs.diffblue.com/knowledge-base/cli/custom-inputs/

Developer Edition trial available

We are delighted to now offer a 14-day trial version of our Developer Edition, which includes the Diffblue Cover CLI, as part of our new licensing option. We're really excited that you can now "try before you buy"! To download your trial of Diffblue Cover Developer Edition, please click here. Full information on all our options is also available here.

How do I automatically maintain all of these tests?

Use Diffblue Cover on any CI platform to automatically update your unit tests and catch regressions for every commit - watch this video to learn more.

Enhancements

  • Cover now allows additional JNI libraries to be used via the --allow-jni CLI option and Allowed JNI prefixes section of the IntelliJ Plugin settings. [Ref: TG-17102]

  • Cover now writes tests with MockitoJUnitRunner or MockitoExtension for Spring classes when spring-boot-test is not available. [Ref: TG-16457]

  • Cover now ensures that known-vulnerable Maven dependencies are not downloaded at runtime. [Ref: TG-17134]

  • Cover now provides improved guidance if R008 (Failed to instantiate class under test) is encountered whilst writing tests. [Ref: TG-17231]

  • CLI: Cover now provides a warning if an empty or malformed custom test inputs file is provided via DiffblueRules.yml. [Ref: TG-16982]

Resolved Issues

  • Resolved an issue, which, in some circumstances, would prevent Cover from writing tests with more than one element in a Collection if a test with a single element Collection was written. [Ref: TG-17190]

  • Resolved an issue which, in some circumstances, would cause Cover to fail to activate, or write tests, on MacOS. [Ref: TG-16659]

  • Resolved an issue which caused Cover to report There is no license linked to your product, rather than an L016 output code, if the computer's hardware configuration had changed. [Ref: TG-16368]

  • IntelliJ Plugin: Resolved an issue which caused Cover to not show a detailed failure message if it was unable to combine tests it had written with an existing test class. [Ref: TG-17228]

  • CLI: Resolved an issue which caused Cover to run integration tests (*IT.java classes) tests whilst using the --coverage-reports CLI option. [Ref: TG-17291]

Known Issues

  • CLI: The command dcover clean --failing does not work on Gradle projects. This command is now deprecated and dcover validate should be used instead. [Ref: TG-11707]

  • For multi-module projects, --coverage-reports needs to be run in the sub-modules, not from the root module with --working-directory. [Ref: TG-16876]

Last updated