Using the Squish Function ‘attachFile’ to Your Advantage

Using the Squish Function ‘attachFile’ to Your Advantage

Copying test results in the form of files to your test result directory can be automated.

Imagine the following scenario: your application interacts with certain files, and those files change from test to test. For logging purposes, you want to export the files to your test directory. Additionally, the attached file will also be visible in the test report.

Example

Add test.attachFile(“/Path/to/folder/MyAddresses.adr”) to your script:

...
test.compare(table.rowCount, 125)
test.attachFile("/Path/to/folder/MyAddresses.adr")
activateItem(waitForObjectItem(names.address_Book_MyAddresses_adr_QMenuBar, "File"))
...

(The code for this example can be found in squish/examples/qt/addressbook/suite_py/tst_general).

This will result in the copy of “MyAddresses.adr” to the result directory.

With the option --resultdir for the squishrunner you can further specify the direction to copy your reports and attached files to.

In the IDE, you find the option to set the result directory under:

Edit > Preferences > Squish > Logging

Find more information about attachFile in our documentation.

For more information about Squish, visit https://www.froglogic.com/squish/

Sebastian Paulsen studied computer engineering in Hamburg and joined froglogic in early 2018 as a student intern. Before joining froglogic, Sebastian worked for an IT security and a prototype company. He is part of the development of Squish Coco and other hardware-related tasks.

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*