Tyler-Keith-Thompson / CucumberSwift

A lightweight swift Cucumber implementation
https://tyler-keith-thompson.github.io/CucumberSwift/documentation/cucumberswift/
MIT License
74 stars 19 forks source link

Get result from scenario in afterScenario hook #29

Closed MarekSlaninka closed 3 years ago

MarekSlaninka commented 3 years ago

Hello,

is it possible to get result of scenario, in afterScenario hook? I need it for reporting results to TestRail. At the moment a can not find any option to get the result.

Thank You

Tyler-Keith-Thompson commented 3 years ago

Interesting! So CucumberSwift has its own report, and it has its own reporter class. What I could very reasonably do is provide hooks for you. The AfterScenario hook may be a bad place since it's designed for cleanup.

I'll see what I can do this weekend to expose an API for you to tie into events to report it however you'd like. You could also set up your own XCTestObserver if you needed something today but I think I can give you a much better experience than that.

MarekSlaninka commented 3 years ago

That would be great, thank you very much :)

Tyler-Keith-Thompson commented 3 years ago

Alright CucumberSwift v3.1.12 adds this: I've also added some docs to showcase how it works.

I'll leave this open to make sure it satisfies your needs.

MarekSlaninka commented 3 years ago

Hi, this looks pretty great. But was it necessary to bump minimum iOS version to 13?

Tyler-Keith-Thompson commented 3 years ago

Annoyingly, it has everything to do with the duration. Apparently it won't let me use .nanoseconds without iOS 13. Nanoseconds are, for some odd reason, what the Cucumber spec says should be used.

I can back that out and just use a double, or write something custom to try and bring back support for .nanoseconds on older versions if anybody needs it.

MarekSlaninka commented 3 years ago

If you just use TimeInterval, which is alias for Double? The problem is, our application support iOS 12, and it will be supported till release of iOS 15.

Tyler-Keith-Thompson commented 3 years ago

Just goes to show I should not make assumptions on behalf of my users. I will get you an iOS 12 compatible version ASAP

Tyler-Keith-Thompson commented 3 years ago

CucumberSwift 3.2.2 should reasonably solve your problem. Minimum iOS target of 10.

MarekSlaninka commented 3 years ago

Thank You again :)