Reputation: 135
How to attach screen shot to XCUITest report in Jenkins. Can only see screenshot if running through XCODE
Steps
I used xcpretty to generate HTML type report, but there also screenshot is not displayed. it has a -screenshot attribute but that only accepts screenshot with a sepecified name. (like TestcaseName_Classname.jpg) But xcuitest takes screenshot with name 'screenshot_<>.jpg"
Can anyone throw some information on this
Thanks
Upvotes: 4
Views: 1952
Reputation: 141
You need to point attachment.name
as here
func takeScreenshot() {
let screenshot = XCUIScreen.main.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
attachment.lifetime = .deleteOnSuccess
attachment.name = UITest.sharedInstance.testCase.name
add(attachment)
}
Upvotes: 0
Reputation: 48
Screenshot collection in xcpretty is broken as of now.
https://github.com/supermarin/xcpretty/issues/251
You may use xcsummary as a workaround.
https://github.com/supermarin/xcpretty/issues/251
Upvotes: 1