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/

Software Engineer with focus on computer engineering

0 Comments

Leave a reply

电子邮件地址不会被公开。 必填项已用*标注

*