Setup help #21
-
Hi, As a user of Cucumber for many years with Ruby and .js, but a complete newbie with Xcode and Swift, I'm not able to get a setup working. Basically, I have no clue how to execute the feature and step definitions I have created. I got the impression that a func had to start with "test" for Xcode to be able to recognize it as a test, but I do not have any of those. I cloned the CucumberSwiftExample repo and was also not able to get Xcode to recognize a test. It said 0 tests from the test tab. I have a .feature file in the Feature folder (with reference) and I have a .swift file with the StepImplementation extension. import Foundation extension Cucumber: StepImplementation {
} I would expect this to work but I'm also sure I'm missing something totally obvious. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Hey thanks for reaching out! Sorry you've had some trouble getting things up and running. If it's possible for you to zip up a sample project or link to one on GitHub I'll be able to give direct help, but let me take a crack at a few things. So the fact you've got 0 tests is telling, CucumberSwift on its own actually has 1 test it just includes to validate your gherkin. So this tells me it doesn't see your NOTE: By default it uses "Features" (case sensitive). You do not have to add functions that start with the name "test". If you were just using the XCTest runner that's how it identifies tests, but CucumberSwift as a runner does it based off of those Given/When/Then/And/But global functions. You'll notice in your test explorer that the tests are purple (indicating they were added at runtime by CucumberSwift) vs the blue ones that XCTest finds that are prefixed with test. Hopefully that helps! Let me know if that was in fact your problem, it's bitten enough people it's probably worth me adding something that does a case insensitive search for a features folder by default. |
Beta Was this translation helpful? Give feedback.
-
Hi again. Thanks for the fast feedback. And thanks for what seems to be an awesome Cucumber library. As a tester working with Cucumber for more than 11 years, I wanted to try a different approach to apps UI testing (no more Appium) and learn about Xcode and Swift. I almost quit the idea due to the other Cucumber libraries for Xcode. This looks really cool. I was not able to get anything running by setting the FeaturesPath unfortunately. In regards to a .zip of my project, I believe we can just use the CucumberSwiftExample. I'm also getting 0 tests - no "purple" (or blue for that matter) tests are available. I've tried removing all pods and re-installing them. Same result. Can you think of any prerequisites I might miss? A dev account or something I'm not familiar with. Have a great weekend. |
Beta Was this translation helpful? Give feedback.
-
Reposting cause I'm learning how to do GitHub discussions still and I don't like how it marked my answer, because it won't let me use a part of the thread as an answer: Alrighty, here's an official sample repo: https://github.com/Tyler-Keith-Thompson/CucumberSwiftSample/tree/main/Cocoapods It's got detailed instructions for setup with CocoaPods and you're welcome to clone it and try it out! Hopefully that helps you (and others interested in this library) get started. Let me know if you've got any issues, especially if those steps still don't help you get it working. |
Beta Was this translation helpful? Give feedback.
Reposting cause I'm learning how to do GitHub discussions still and I don't like how it marked my answer, because it won't let me use a part of the thread as an answer:
Alrighty, here's an official sample repo: https://github.com/Tyler-Keith-Thompson/CucumberSwiftSample/tree/main/Cocoapods
It's got detailed instructions for setup with CocoaPods and you're welcome to clone it and try it out! Hopefully that helps you (and others interested in this library) get started. Let me know if you've got any issues, especially if those steps still don't help you get it working.