Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Unit testing via Jtest in command line

fatmanur61
fatmanur61 Posts: 82

Hi,

I want to unit test in command line with jtest. First of all I generate unit test in intellij ide using jtest then I try to run test via Jtestcli in command line. But at the end of the process "executed test cases :0" why can't I run these test?
Normally these generated tests run in intellij ide successfully. How can I fix this problem? Related screen shot is added to discussion.

Answers

  • MichaelC
    MichaelC Posts: 28 admin
    edited June 2019

    Hello @fatmanur61,

    I would recommend using a build system supported by Jtest such as Ant, Maven, or Gradle. The Demo project that you're currently working on offer three different build files to help you get started. Be sure to verify that your version of Ant, Maven, and/or Gradle is supported with your version of Jtest.

    • You will also need an internet connection to use the Jtest plugin for the various build systems.

    Integrating with Build System:
    https://docs.parasoft.com/display/JTEST1042/Integrating+with+Build+Systems

    • build.xml and jtest.xml for Ant builds
    • pom.xml for Maven builds
    • build.gradle and the gradlew executable for Gradle builds

    Ant Unit Test Command line:

    ant -file jtest.xml jtest-utc

    Maven Unit Test Command Line:

    mvn clean test-compile jtest:agent test jtest:jtest -Djtest.config="builtin://Unit Tests"

    Gradle Unit Test Command Line:

    gradlew clean jtest-agent test jtest -Djtest.config="builtin://Unit Tests"

    The Jtest plugin should produce a jtestcli command that will look similar to the following:

    This will generate the necessary jtestcli command line to run your Unit Tests.

    • This command can be run without an internet connection as long as you can license your tool without an internet connection.

    After this is ran you should see the following results:

    There is also a README file within the demo project directory that also provide the command line used for running Unit Tests on the command line and provides more examples on how to run Static Analysis, run Test Impact Analysis, and Collect Application Coverage using the Jtest example Calculator project via command line.