Tyler-Keith-Thompson / CucumberSwift

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

CucumberSwift doesn't run my feature files #14

Closed c-st closed 4 years ago

c-st commented 4 years ago

I'm trying to get a basic setup of CucumberSwift up and running but so far I haven't been successful 😕. Since I already spent a few hours investigating I thought someone else could have a look. I don't see what I am missing. The problem is that CucumberSwift doesn't run the feature file in my Unit Testing bundle. When running the tests it only runs CucumberTest.testGherkin() but nothing else. Steps to reproduce:

My sample code is here https://github.com/c-st/CucumberSwiftExample

Tyler-Keith-Thompson commented 4 years ago

First thank you for reaching out AND for having a sample application, that helped a ton when debugging your problem. The issue is that CucumberSwift looks for the path "Features" on your testing bundle.

With Xcode 11.4.1 and a macOS target like you have i noticed the actual folder path was Contents/Resources/Features.

THE FIX:

Add an entry to your info.plist (in your tests) who's key is FeaturesPath and who's value is Contents/Resources/Features

Or open your info.plist and add this to the bottom:

    <key>FeaturesPath</key>
    <string>Contents/Resources/Features</string>

How I debugged it

Sorry that cost you so much time, as Apple changes these things between Xcode versions and platforms it can be tricky to have documentation that can help point people to an easy fix.

I'm going to go ahead and leave this open for a bit in case you run into any more issues or the fix doesn't immediately solve your problem. I got your sample app working and if the fix wasn't so trivial I'd do a PR.

Tyler-Keith-Thompson commented 4 years ago

Aaaand just for kicks I made CucumberSwift 2.2.36 ask the Bundle to find the "Features" folder. This should help isolate us from these kinds of Xcode changes in the future.

c-st commented 4 years ago

Awesome 🎉, that fixed it!

Thanks so much for looking into it and also for describing how you tracked it down. I'm fairly new to macOS/iOS development and that is definitely helpful.

Setting the property solves it for my project with version 2.2.35. And I can also confirm that the latest release works without any additional configuration.

Now I am looking forward to converting most of my tests to BDD scenarios. That will make them so much more readable 🙂.

Last but not least: thank you for this library. I looked around and didn't find anything better for BDD testing in iOS/macOS projects. It deserves many more stars.