Sometimes it can be useful to group comparison results or error logs into specific sections. This simplifies the handling of the evaluation and gives an illustrated insight into the data.
Squish will thereby show results nested and if wanted over several levels. If test run from command-line the log messages are added to the test when a section begins or ends - unless the XML3 report generator is used.
Please note that test.startSection should always be closed with test.endSection to prevent erroneous test reports.
Snippet
Grouping test results into logical units
[code]test.startSection(title);[/code]
or
[code]test.startSection(title, description);[/code]
and
[code]test.endSection();[/code]
Example:
[code]
def main():
startApplication("Addressbook")
clickButton(waitForObject(":New_Button"))
clickButton(waitForObject(":Add_Button"))
test.startSection("Form , Surname & Name")
type(waitForObject(":_Edit"), "Peter")
test.log("Peter")
type(waitForObject(":_Edit_2"), "Lustig")
test.log("Lustig")
test.endSection()
test.startSection("Form , E-Mail & Telefon")
type(waitForObject(":_Edit_3"), "peter@lustig.de")
test.log("peter@lustig.de")
type(waitForObject(":_Edit_4"), "123")
test.log("123")
test.endSection()
clickButton(waitForObject(":Address Book - Add.OK_Button"))
mouseClick(waitForObject(":File_MenuItem_2"))
mouseClick(waitForObject(":_Menu"), 91, 110, MouseButton.PrimaryButton)
mouseClick(waitForObject(":Address Book.No_Button"), 49, 5, MouseButton.PrimaryButton)
[/code]
Example test results after running the test case
Note
To avoid misleading test reports always call test.endSection after calling test.startSection!
As calls can also be nested, i.e. multiple subsequent calls to startSection it is required that endSection gets called multiple times as well.