Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Retrieving the location of a TrueLog file

Retrieving the location of a TrueLog file

When replaying a multiple Silk4J or Keyword Driven Tests via a suite, it is possible that a user may need to print or log the location of the TrueLog file to the console or log file so that it can be easily located for review. In order to print such information we must access some internal methods of the Silk Test JTF framework to stop the TrueLog and return its location. To ensure that a complete TrueLog is generated for all tests in the suite, we must add an @AfterClass method to the suite class, that will we use for stopping the TrueLog and retrieving the file location.

package truelog;

import org.junit.AfterClass;
import org.junit.runner.RunWith;

import com.borland.silktest.jtf.internal.TrueLogProxy;
import com.borland.silktest.jtf.keyworddriven.KeywordTestSuite;
import com.borland.silktest.jtf.keyworddriven.KeywordTests;

@RunWith(KeywordTestSuite.class)
@KeywordTests({"Transaction"})
public class SuiteTest {

     @AfterClass
     public static void stopTrueLogAndPrintTrueLogFileLocation()
     {
          // caution: only do this at the end of the complete test run! Otherwise you would break your TrueLog.

          TrueLogProxy.getInstance().stopTrueLog();
          System.out.println("TrueLog location: " + TrueLogProxy.getInstance().getActualTrueLogFileName());

     }
}


DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2018-04-17 09:37
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.