-
-
Notifications
You must be signed in to change notification settings - Fork 192
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
provide some transforms for machine names/random data #293
Comments
Actually here it is, it's the same format as Drupal random tokens (at least in 7), with a name argument appended. Example:
|
Interesting idea. I could see this coming in quite handy (usernames in-particular are tricky if created via a form since they have to be manually deleted in an after scenario if the same username is used more than once). I think this could go into a new context that only handles transforms. |
I'm working on a project now that uses |
``` Given I am viewing an "Article" with the title "<title>" Then I should see the header "<title>" ``` When the `RandomContext` is included, then `<title>` will be replaced with a random string during the scenario. It will have a consistent value throughout a given scenario, but a new value in subsequent scenarios. - Fixes #293
``` Given I am viewing an "Article" with the title "<title>" Then I should see the header "<title>" ``` When the `RandomContext` is included, then `<title>` will be replaced with a random string during the scenario. It will have a consistent value throughout a given scenario, but a new value in subsequent scenarios. - Fixes #293
``` Given I am viewing an "Article" with the title "<title>" Then I should see the header "<title>" ``` When the `RandomContext` is included, then `<title>` will be replaced with a random string during the scenario. It will have a consistent value throughout a given scenario, but a new value in subsequent scenarios. - Fixes #293
``` Given I am viewing an "Article" with the title "<title>" Then I should see the header "<title>" ``` When the `RandomContext` is included, then `<title>` will be replaced with a random string during the scenario. It will have a consistent value throughout a given scenario, but a new value in subsequent scenarios. - Fixes #293
``` Given I am viewing an "Article" with the title "<title>" Then I should see the header "<title>" ``` When the `RandomContext` is included, then `<title>` will be replaced with a random string during the scenario. It will have a consistent value throughout a given scenario, but a new value in subsequent scenarios. - Fixes #293
We have to work with machine and user names a lot in Drupal, so when writing 1000s of tests they'll eventually conflict. Sometimes we copy/paste tests to test slightly different scenarios and have to change all the specific references. "testuserC2456_S1" starts to get old after a while and in most cases, we don't care what that user is called, however we do need to refer back to it.
Tag1 did something in a really old custom context https://github.com/tag1consulting/behat-drupalextension
Maybe drupalextension could provide something similar? Or does it already?
These would be great as it would take a lot of load off of testwriting.
For now I wrote a very simple transform but it could be extended with a static random string cache.
The text was updated successfully, but these errors were encountered: