TestLink-API-Python-client
TestLink-API-Python-client copied to clipboard
Problem attaching a .png file via TestLink integration
Here's code:
def update_Status_TestCase(TestCaseName, Status):
tl_helper = TestLinkHelper()
myTestLink = tl_helper.connect(TestlinkAPIClient)
DateExec = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
TestPlan = myTestLink.getTestPlanByName(Projeto, TestPlanName)
TestPlanID = TestPlan[0]['id']
Test = myTestLink.getTestCaseIDByName(TestCaseName)
TestCaseID = Test[0]['id']
TCExternalID = Test[0]['tc_external_id']
newResult = myTestLink.reportTCResult(
TestCaseID,
TestPlanID,
BuildName,
Status,
Note,
user=user,
overwrite=OverWrite
)
TestCaseName = TestCaseName + ".png"
ROOT_DIR = os.path.abspath(os.curdir)
ROOT_DIR = os.path.join(ROOT_DIR, "screenshot", TestCaseName)
newResultID_B_f = newResult[0]['id']
a_file_path=open(ROOT_DIR, mode='rb')
newAttachment = myTestLink.uploadExecutionAttachment(a_file_path, newResultID_B_f,
'Attachment', 'Attachment Test')
Following error message:
Several failures occurred:
- TLResponseError: 6002: (uploadExecutionAttachment) - Error inserting attachment on DB uploadExecutionAttachment({'filename': 'Caixa - Forma de Pagamento PIX com Sitef.png', 'filetype': 'image/png', 'content': b'iVBORw0KGgoAAAANSUhEUgAADSAAAARtCAIAAABwBZ0FAAEAAElEQVR4nOy9eZwdVZn//zznVNW9\nt/fu7IE0ZAMCISGARBPURJYhSUMIDqKMjmiEDDOyzFeYrxtOFL7jAioJM8MP+GYUdXDAr2KkSRRE\ngmMyRCMhEQiQEDQQyNZZer9Vdc7z++NU1a279b7cTp43/Wrq1nZOnfrU6Uo/n34eBIZhGIZhGIZh\nGIZhGIZhGIYZBC4+6TrE4e4EU3oQkQYFAIiIMYkQUfS9i6MBut6h62MhT5IIgAgiWs7dFPSwP+0y\nxzNEQIFyMgpBRAACJCIiUmbHbAlR7Ii+TZRF9EwAeXpGxGx5EwDw/Hz8EhebKLQDhlLJEQERkAYP\ngBCh9/Nzf+hqfqbYkxL2SpgFRCQiAD1oHWNKmYLyjiACTaBz5BEJ20zQg9Mx1jPTB7rTM2kNasjn\n50ivcVlGbxTRj5IsJYcIft843jlu3jcMeatj8jadtAatWwzDMAzDMAzDMAzDMAzDMAzDML1gMKMp\nDDN45OqWyEQcB8+9wTBDDYuZOT6IlMySZo4DWMbM8Ucpq5oNdgzDMAzDMAzDMAzDMAzDMAzDDCEI\nCLmJCqAUoymInHOD6SsEBFQSiQ9ZxkxxIn1i9H+MJVcs4fmZYfoO65kZkcTm55zJuTR+0PNrM9MF\nx8n7BhvsGIZhGIZhGIZhGIZhGIZhmEGBgyxMMSKLXU40Jfo47CG6Ye8AM2II1IwQ13Mmfd0wF0cr\nqOSggi1zghOVv85djUaypTM/m+KZBUu6lXgknhl2WM/McQMCIAoKihtnSWUIlVO0jm3BJ4nfNxiA\nkfS+UYyoJ2ywYxiGYRiGYRiGYRiGYRiGYRhm6MmJoQQfuz1qcDsFAKUUzmFGEKGCjUR1VCUWAAoa\nKQafArlkwjUc7WZyoPB74SB3Sfl+8oRdQn1jhpaub31mK+uZGQn0VM/B55iMB/PFtTuHHAIAYt57\nDr9vMEUYSe8b+fJmgx3DMAzDMAzDMAzDMAzDMAzDMEMPxUIskL3AMCMaPdwdYJg+my14HmZGECxX\n5niixPXchx8rJX5FzIBwHL9vFMjX... [ Message content over the limit has been removed. ]
Note: The image is attached to the TestLink, but the Test Case fails, and the Test Case was successful, generating a false positive.
I point out that the attachment is being attached, but it is generating this error message.
hi @WilliamMega
Not sure you've solved this but.
I think the problem comes from the name of the uploading_file,
I have the same problem and can solve it by changing to simple and short names before calling API upload attachments.
( you can test error by directly uploading that file on Testlink)
Hope this helps!