Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Make mapping possible between XCTestCase & correct StepDefiner: Duplicate steps #17

Open
joristimmerman opened this issue May 24, 2016 · 6 comments

Comments

@joristimmerman
Copy link

joristimmerman commented May 24, 2016

We are currently using your library and ran into some trouble.
We have the same step definition in 3 different XCTestCase-classes and a StepDefiner-subclass per testcase.
The library only executes the last definition it found, thus not associating the right automation code with a test.

Request:
Make XCTestCase & StepDefiner mappable to avoid super long steps.
The current implementation as default.

We currently have around + 20 feature files to test, so this would be handy.

@deanWombourne
Copy link
Contributor

Hey - that's a use case we never thought of! We've always just written different step definitions or used regular expressions to solve it.

Can you add an example of what you mean so I can be sure I understand what you're trying to do?

@kerrmarin
Copy link
Member

@joridor do you have any examples of this issue? We're not 100% sure what you mean.

@joristimmerman
Copy link
Author

joristimmerman commented Jun 9, 2016

@kerrmarin One of the use cases I can think about is a step like:
'the user is logged in'

Depending on where you are in the application, different steps need to be taken to check if a user is logged in or not.
Yes, true, you can try and guess where you are, but this ends up in very long step definition and is harder to maintain. (I'm covering +50 feature files)
For now I rewrote your code to have both TestCase level (using a subclass of XCUITestCase) and global level step definitions. (test case level overrides global)

@kerrmarin
Copy link
Member

That sounds great, we'd be very happy to review & merge a PR that contains these changes :)

@joristimmerman
Copy link
Author

@kerrmarin For now it was directly integrated into this project, because we have a different work flow (Test Cases are generated by build server from feature files, also takes tags in mind).
Happy to fork your code & create a pull request if I have some spare time.

@ilyapuchka
Copy link
Collaborator

ilyapuchka commented Aug 18, 2018

Wouldn't be better to make this "mapping" between something like PageObject (or more generic StepContext) and StepsDefiner which defines steps for this PageObject?
The pattern we are following is to have StepsDefiner for each PageObject. But then we can't have steps with the same expression which act on different PageObjects (i.e. on one screen Learn More is a button but on another it is link, so we need to have two steps like "tap Learn More on this screen" and "tap Learn More on that screen").
It's very likely that single feature (subclass of XCTestCase) is operating on multiple PageObjects, so mapping between test case and steps is not enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants