TrueLog Sections

You can add sections to TrueLogs to add structure to complex scripts and to logically divide scripts into smaller named parts.

TrueLog sections can be nested and the same name can be used for multiple sections, which means the names do not have to be unique.

To create a new section in a TrueLog file, use the following code:
openTrueLogSection("section_name")
To close the last TrueLog section that was opened, use the following code:
closeCurrentTrueLogSection()
Sections are automatically closed in the following cases:
  • The test case ends.
  • The test class ends.
  • The test run ends.
  • A keyword ends.
  • An exception occurs.
The following code sample demonstrates the usage of TrueLog sections:
@Test
public void subSections() {
  Desktop desktop = new Desktop();
  desktop.openTrueLogSection("Section a");
  desktop.logInfo("In section a");
  desktop.openTrueLogSection("Section b");
  desktop.logInfo("In section b");
  desktop.closeCurrentTrueLogSection();
  desktop.logInfo("In section a again");
}

For additional information on the supported methods, refer to the API documentation of your Silk Test client.