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:
[TestMethod]
public void SubSections()
{
  Agent.OpenTrueLogSection("Section a");
  Agent.LogInfo("In section a");
  Agent.OpenTrueLogSection("Section b");
  Agent.LogInfo("In section b");
  Agent.CloseCurrentTrueLogSection();
  Agent.LogInfo("In section a again");
}

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