PHPackages                             jordigiros/minkfieldrandomizer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. jordigiros/minkfieldrandomizer

ActiveLibrary[Testing &amp; Quality](/categories/testing)

jordigiros/minkfieldrandomizer
==============================

Random field filling generator for Behat/Mink/Selenium form tests

1.3.3(5y ago)745.4k5[1 PRs](https://github.com/JordiGiros/MinkFieldRandomizer/pulls)PHP

Since Sep 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/JordiGiros/MinkFieldRandomizer)[ Packagist](https://packagist.org/packages/jordigiros/minkfieldrandomizer)[ RSS](/packages/jordigiros-minkfieldrandomizer/feed)WikiDiscussions master Synced today

READMEChangelog (8)Dependencies (10)Versions (10)Used By (0)

Behat Mink Field Randomizer
===========================

[](#behat-mink-field-randomizer)

`MinkFieldRandomizer` is a random (with sense) information generator for filling form fields in Behat Mink tests. It brings the option to run your tests in a more realistic way changing the information you use to fill in the forms in every test you run.

[![CircleCI](https://camo.githubusercontent.com/3cf8e9a17911b3d5a0de448a4949f3563abd888b747a3f4fef8699cc91d149fe/68747470733a2f2f636972636c6563692e636f6d2f67682f696e7465677261746564657870657274732f4d696e6b4669656c6452616e646f6d697a65722e7376673f7374796c653d736869656c64)](https://circleci.com/gh/integratedexperts/MinkFieldRandomizer)

Installing with Composer
------------------------

[](#installing-with-composer)

```
composer require jordigiros/MinkFieldRandomizer

```

How to use
----------

[](#how-to-use)

`MinkFieldRandomizer` includes a trait `FieldRandomizerTrait` that has some extra methods that will permit you to randomize your features involving forms.

You only need to add that trait to your main `FeatureContext` Behat Context as follows:

```
class FeatureContext extends MinkContext {

    use FieldRandomizerTrait;

}

```

This way you can use the new steps added by the trait directly in the gherkin feature.

Steps added by `MinkFieldRandomizer`
====================================

[](#steps-added-by-minkfieldrandomizer)

Documentation

Common methods
--------------

[](#common-methods)

### Generate and fill with new random values

[](#generate-and-fill-with-new-random-values)

- When I fill in :field with a random mail
- When I fill in :field with a random name
- When I fill in :field with a random surname
- When I fill in :field with a random phone
- When I fill in :field with a random number
- When I fill in :field with a random text
- When I fill in :field with a random loremipsum

### Fill in with previously generated random values

[](#fill-in-with-previously-generated-random-values)

- When I fill in :field with an existent mail
- When I fill in :field with an existent name
- When I fill in :field with an existent surname
- When I fill in :field with an existent phone
- When I fill in :field with an existent number
- When I fill in :field with an existent text
- When I fill in :field with an existent loremipsum

Note: If you didn't generate the random information previously (Generate and fill with new random information) they won't work.

### Filling multiple fields with a TableNode object:

[](#filling-multiple-fields-with-a-tablenode-object)

- Fills in form fields with provided table.

Gherkin:

```
When I fill in fields with provided table:
| f_outbound_accommodation_name 			| {RandomName} 		|
| f_outbound_accommodation_phone_number 	| {RandomNumber} 	|
| f_outbound_accommodation_address_1 		| {RandomText(10)}	|

```

PHP:

```
$hotel = new TableNode ([
    ['f_outbound_accommodation_name', '{RandomName}'],
    ['f_outbound_accommodation_phone_number', '{RandomNumber}'],
    ['f_outbound_accommodation_address_1', '{RandomText(10)}'],
]);
$this->fillFilteredFields($hotel);

```

#### Checking that a field has an specific previous random generated information:

[](#checking-that-a-field-has-an-specific-previous-random-generated-information)

Gherkin:

```
Then the ":field" field should contains ":value" value

```

PHP:

```
$this->frtAssertFieldContainsValue('f_customer_first_name', 'name');

```

It will fail if field contains a value different than the one given.

### Filling a field with a custom random value

[](#filling-a-field-with-a-custom-random-value)

Gherkin:

```
When I fill in :field with :value

```

PHP:

```
When I fill in "#text" with "{RandomText(100)}"

```

It brings the option to customize some properties of the random values.

Values and customization
========================

[](#values-and-customization)

NameValueComment`Email``{RandomEmail}`
`{RandomEmail(domain)}`RandomEmail accepts at most a parameter, the domain for the random email address - if none is given gmail.com is provided.`Name``{RandomName}`RandomName does not accept parameters`Surname``{RandomSurname}`RandomSurname does not accept parameters`Number``{RandomNumber}`
`{RandomNumber(N,M)}`RandomNumber accepts at most two parameters, returns a random number between the two given or between 0 and 9 if no params given.`Phone``{RandomPhone}`
`{RandomPhone(N)}`RandomPhone accepts at most a parameter, the number of numbers in the string. If no parameter is given, it will return a 15 digits number.`Text``{RandomText}`
`{RandomText(N)}`RandomText accepts at most a parameter, the number of characters in the string.If no parameter is given, it will return a 15 chars string.`LoremIpsum``{RandomLoremIpsum}`
`{RandomLoremIpsum(N)}`RandomLoremIpsum accepts at most a parameter, the number of paragraphs in the string. If no parameter is given, it will return a 2 paragraphs string.Copyright
=========

[](#copyright)

Copyright (c) 2016 Jordi Girós Guerrero. See LICENSE for details. Contributors: Jordi Bisbal, Alex Skrypnyk.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 68% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~231 days

Recently: every ~182 days

Total

8

Last Release

1955d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc4f8ed63ab06ec79aab74106ff185d49d67db7089cd35a9dcffb11097a47953?d=identicon)[jordigiros](/maintainers/jordigiros)

---

Top Contributors

[![JordiGiros](https://avatars.githubusercontent.com/u/2546206?v=4)](https://github.com/JordiGiros "JordiGiros (17 commits)")[![das-peter](https://avatars.githubusercontent.com/u/177531?v=4)](https://github.com/das-peter "das-peter (5 commits)")[![AlexSkrypnyk](https://avatars.githubusercontent.com/u/378794?v=4)](https://github.com/AlexSkrypnyk "AlexSkrypnyk (1 commits)")[![danielkorte](https://avatars.githubusercontent.com/u/518273?v=4)](https://github.com/danielkorte "danielkorte (1 commits)")[![jrfnl](https://avatars.githubusercontent.com/u/663378?v=4)](https://github.com/jrfnl "jrfnl (1 commits)")

---

Tags

behatminkmink-driverphpselenium

### Embed Badge

![Health badge](/badges/jordigiros-minkfieldrandomizer/health.svg)

```
[![Health](https://phpackages.com/badges/jordigiros-minkfieldrandomizer/health.svg)](https://phpackages.com/packages/jordigiros-minkfieldrandomizer)
```

###  Alternatives

[drupal/drupal-extension

Drupal extension for Behat

22215.7M173](/packages/drupal-drupal-extension)[drevops/behat-steps

Collection of steps for Behat

27432.2k4](/packages/drevops-behat-steps)[wp-cli/wp-cli-tests

WP-CLI testing framework

423.1M142](/packages/wp-cli-wp-cli-tests)[ezsystems/behatbundle

Behat bundle for help testing eZ Bundles and projects

45867.3k17](/packages/ezsystems-behatbundle)[devinci/devinci-behat-extension

Provides extra behat goodies.

17598.0k](/packages/devinci-devinci-behat-extension)[drevops/behat-screenshot

Behat extension and step definitions to create HTML and image screenshots on demand or when tests fail

231.7M30](/packages/drevops-behat-screenshot)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
