Replaying a Test from the Command Line

You must update the PATH variable to reference your JDK location before performing this task. For additional information, see JDK Installation for Microsoft Windows.

  1. Include the following in the CLASSPATH:
    • junit.jar.
    • The org.hamcrest.core JAR file.
    • silktest-jtf-nodeps.jar. This JAR is located in the ng\JTF subfolder of your Silk Test installation directory, for example C:\Program Files (x86)\Silk\SilkTest\ng\JTF.
      Note: Micro Focus recommends using %OPEN_AGENT_HOME% instead of the full path to the ng directory, for example %OPEN_AGENT_HOME%\JTF, as this is more flexible and will even work if Silk Test is not installed in the default location.
    • The JAR or folder that contains your compiled tests.
    • If you are using service virtualization, add the SV Lab Client library.
    The classpath should look similar to the following:
    set CLASSPATH=<eclipse_install_directory>\plugins\org.junit4_4.3.1\junit.jar;<eclipse_install_directory>\plugins\org.hamcrest.core_1.3.0.v201303031735.jar;%OPEN_AGENT_HOME%\JTF\silktest-jtf-nodeps.jar;C:\myTests.jar
    If you are using service virtualization, the classpath should look similar to the following:
    set CLASSPATH=<eclipse_install_directory>\plugins\org.junit4_4.3.1\junit.jar;<eclipse_install_directory>\plugins\org.hamcrest.core_1.3.0.v201303031735.jar;%OPEN_AGENT_HOME%\JTF\silktest-jtf-nodeps.jar;C:\myTests.jar;%OPEN_AGENT_HOME%\SVLabConnector\SVLabClient\lib\*;
  2. Run the JUnit test method by typing:
    java org.junit.runner.JUnitCore <test class name>
    Note: For troubleshooting information, reference the JUnit documentation at:
  3. To run several test classes with Silk4J and to create a TrueLog, use the SilkTestSuite class to run the Silk4J tests. For example, to run the two classes MyTestClass1 and MyTestClass2 with TrueLog enabled, type the following code into your script:
    package demo;
    import org.junit.runner.RunWith;
    import org.junit.runners.Suite.SuiteClasses;
    import com.borland.silktest.jtf.SilkTestSuite;
    @SuiteClasses({ MyTestClass1.class, MyTestClass2.class })
    public class MyTestSuite {}
    To run these test classes from the command line, type the following:
    java org.junit.runner.JUnitCore demo.MyTestSuite