Replaying a Test from the Command Line

You must update the PATH variable to reference your JDK location before performing this task. For details, reference the Sun documentation at: http://java.sun.com/j2se/1.5.0/install-windows.html.

  1. Include the following in the CLASSPATH:
    • junit.jar.
    • The org.hamcrest.core JAR file.
    • silktest-jtf-nodeps.jar.
    • The JAR of folder that contains your tests.
    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
  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: http://junit.sourceforge.net/doc/faq/faq.htm#running_1.
  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;
    
    @RunWith(SilkTestSuite.class)
    @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