title: Parsing dynamic values in Behat/Mink Yml file configurations through Mink Extension.php(Selenium2) for Saucelabs
body: <p>I was wondering if there's a possible way to parse dynamic values, specifically the <code>name</code> by using the <code>*.feature</code> Behat/Mink tests as it's running the into the Yml configuration file with Selenium2 Capabilities</p>
  
  <p>The <code>behat.yml</code> file uses <code>Behat/Mink/Extension</code> extension file with Selenium 2 Capabilities parameters in the file.</p>
  
  <pre><code>    default:
        context:
          class:  'FeatureContext'
        extensions:
          Behat\MinkExtension\Extension:
           base_url: 
           javascript_session:  'selenium2'
           goutte:
           selenium2:
              browser: firefox
              wd_host: &lt;sauce username&gt;:&lt;accesscode&gt;@ondemand.saucelabs.com/wd/hub
              capabilities: {  "platform": "Windows 7" , "version": "21" , "name":"Test" }
  </code></pre>
  
  <p>Within the <code>Extension.php file</code>:
  <a href="https://github.com/Behat/MinkExtension/blob/2.0/src/Behat/MinkExtension/Extension.php" rel="nofollow">https://github.com/Behat/MinkExtension/blob/2.0/src/Behat/MinkExtension/Extension.php</a></p>
  
  <pre><code>            arrayNode('selenium2')-&gt;
                  children()-&gt;
                      scalarNode('browser')-&gt;
                          defaultValue(isset($config['selenium2']['browser']) ? $config['selenium2']['browser'] : '%behat.mink.browser_name%')-&gt;
                      end()-&gt;
                      arrayNode('capabilities')-&gt;
                          normalizeKeys(false)-&gt;
                          children()-&gt;
                              scalarNode('browserName')-&gt;
                                  defaultValue(isset($config['selenium2']['capabilities']['browserName']) ? $config['selenium2']['capabilities']['browserName'] : 'firefox')-&gt;
                              end()-&gt;
                              scalarNode('version')-&gt;
                                  defaultValue(isset($config['selenium2']['capabilities']['version']) ? $config['selenium2']['capabilities']['version'] : "9")-&gt;
                              end()-&gt;
                              scalarNode('platform')-&gt;
                                  defaultValue(isset($config['selenium2']['capabilities']['platform']) ? $config['selenium2']['capabilities']['platform'] : 'ANY')-&gt;
                              end()-&gt;
                              scalarNode('browserVersion')-&gt;
                                  defaultValue(isset($config['selenium2']['capabilities']['browserVersion']) ? $config['selenium2']['capabilities']['browserVersion'] : "9")-&gt;
                              end()-&gt;
                              scalarNode('browser')-&gt;
                                  defaultValue(isset($config['selenium2']['capabilities']['browser']) ? $config['selenium2']['capabilities']['browser'] : 'firefox')-&gt;
                              end()-&gt;
                              scalarNode('ignoreZoomSetting')-&gt;
                                  defaultValue(isset($config['selenium2']['capabilities']['ignoreZoomSetting']) ? $config['selenium2']['capabilities']['ignoreZoomSetting'] : 'false')-&gt;
                              end()-&gt;
                              scalarNode('name')-&gt;
                                  defaultValue(isset($config['selenium2']['capabilities']['name']) ? $config['selenium2']['capabilities']['name'] : 'Behat Test')-&gt;
                              end()-&gt;
                              scalarNode('deviceOrientation')-&gt;
                                  defaultValue(isset($config['selenium2']['capabilities']['deviceOrientation']) ? $config['selenium2']['capabilities']['deviceOrientation'] : 'portrait')-&gt;
                              end()-&gt;
                              scalarNode('deviceType')-&gt;
                                  defaultValue(isset($config['selenium2']['capabilities']['deviceType']) ? $config['selenium2']['capabilities']['deviceType'] : 'tablet')-&gt;
                              end()-&gt;
                              scalarNode('selenium-version')-&gt;
                                  defaultValue(isset($config['selenium2']['capabilities']['selenium-version']) ? $config['selenium2']['capabilities']['selenium-version'] : '2.31.0')-&gt;
                              end()-&gt;
                              scalarNode('max-duration')-&gt;
                                  defaultValue(isset($config['selenium2']['capabilities']['max-duration']) ? $config['selenium2']['capabilities']['max-duration'] : '300')-&gt;
                              end()-&gt;
                              booleanNode('javascriptEnabled')-&gt;end()-&gt;
                              booleanNode('databaseEnabled')-&gt;end()-&gt;
                              booleanNode('locationContextEnabled')-&gt;end()-&gt;
                              booleanNode('applicationCacheEnabled')-&gt;end()-&gt;
                              booleanNode('browserConnectionEnabled')-&gt;end()-&gt;
                              booleanNode('webStorageEnabled')-&gt;end()-&gt;
                              booleanNode('rotatable')-&gt;end()-&gt;
                              booleanNode('acceptSslCerts')-&gt;end()-&gt;
                              booleanNode('nativeEvents')-&gt;end()-&gt;
                              booleanNode('passed')-&gt;end()-&gt;
                              booleanNode('record-video')-&gt;end()-&gt;
                              booleanNode('record-screenshots')-&gt;end()-&gt;
                              booleanNode('capture-html')-&gt;end()-&gt;
                              booleanNode('disable-popup-handler')-&gt;end()-&gt;
                              arrayNode('proxy')-&gt;
                                  children()-&gt;
                                      scalarNode('proxyType')-&gt;end()-&gt;
                                      scalarNode('proxyAuthconfigUrl')-&gt;end()-&gt;
                                      scalarNode('ftpProxy')-&gt;end()-&gt;
                                      scalarNode('httpProxy')-&gt;end()-&gt;
                                      scalarNode('sslProxy')-&gt;end()-&gt;
                                  end()-&gt;
                                  validate()-&gt;
                                      ifTrue(function ($v) {
                                          return empty($v);
                                      })-&gt;
                                      thenUnset()-&gt;
                                  end()-&gt;
                              end()-&gt;
                              arrayNode('firefox')-&gt;
                                  children()-&gt;
                                      scalarNode('profile')-&gt;
                                          validate()-&gt;
                                          ifTrue(function ($v) {
                                              return !file_exists($v);
                                          })-&gt;
                                              thenInvalid('Cannot find profile zip file %s')-&gt;
                                          end()-&gt;
                                      end()-&gt;
                                      scalarNode('binary')-&gt;end()-&gt;
                                  end()-&gt;
                              end()-&gt;
                              arrayNode('chrome')-&gt;
                                  children()-&gt;
                                      arrayNode('switches')-&gt;
                                          prototype('scalar')-&gt;end()-&gt;
                                      end()-&gt;
                                      scalarNode('binary')-&gt;end()-&gt;
                                      arrayNode('extensions')-&gt;
                                          prototype('scalar')-&gt;end()-&gt;
                                      end()-&gt;
                                  end()-&gt;
                              end()-&gt;
                          end()-&gt;
                      end()-&gt;
                      scalarNode('wd_host')-&gt;
                          defaultValue(isset($config['selenium2']['wd_host']) ? $config['selenium2']['wd_host'] : 'http://localhost:4444/wd/hub')-&gt;
                      end()-&gt;
                  end()-&gt;
              end()-&gt;
              arrayNode('saucelabs')-&gt;
                  children()-&gt;
                      scalarNode('username')-&gt;
                          defaultValue(getenv('SAUCE_USERNAME'))-&gt;
                      end()-&gt;
                      scalarNode('access_key')-&gt;
                          defaultValue(getenv('SAUCE_ACCESS_KEY'))-&gt;
                      end()-&gt;
                      booleanNode('connect')-&gt;
                          defaultValue(isset($config['saucelabs']['connect']) ? 'true' === $config['saucelabs']['connect'] : false)-&gt;
                      end()-&gt;
                      scalarNode('browser')-&gt;
                          defaultValue(isset($config['saucelabs']['browser']) ? $config['saucelabs']['browser'] : 'firefox')-&gt;
                      end()-&gt;
                      arrayNode('capabilities')-&gt;
                          children()-&gt;
                              scalarNode('name')-&gt;
                                  defaultValue(isset($config['saucelabs']['name']) ? $config['saucelabs']['name'] : 'Behat feature suite')-&gt;
                              end()-&gt;
                              scalarNode('platform')-&gt;
                                  defaultValue(isset($config['saucelabs']['platform']) ? $config['saucelabs']['platform'] : 'Linux')-&gt;
                              end()-&gt;
                              scalarNode('version')-&gt;
                                  defaultValue(isset($config['saucelabs']['version']) ? $config['saucelabs']['version'] : '21')-&gt;
                              end()-&gt;
                              scalarNode('deviceType')-&gt;
                                  defaultValue(isset($config['saucelabs']['deviceType']) ? $config['saucelabs']['deviceType'] : null)-&gt;
                              end()-&gt;
                              scalarNode('deviceOrientation')-&gt;
                                  defaultValue(isset($config['saucelabs']['deviceOrientation']) ? $config['saucelabs']['deviceOrientation'] : null)-&gt;
  </code></pre>
  
  <p>Under <code>Extension.php</code> in the MinkExtension directory, it loads up the <code>selenium2.xml</code> file with a set of arrays to parse the information in that file onto the <code>behat.yml</code>. </p>
  
  <p>I noticed that if there isn't any parameters from the Selenium2 capabilities specified in the yml file, the <code>Extension.php</code> will assign a default value based on the array name:</p>
  
  <p><code>
  scalarNode('name')-&gt;
                                      defaultValue(isset($config['selenium2']['capabilities']['name']) ? $config['selenium2']['capabilities']['name'] : 'Behat Test')-&gt;
  </code></p>
  
  <p>With this said, I was wondering if there's any possible way to use the name of the Behat/Mink Feature tests <code>&lt;test&gt;.feature</code> within my local directory to parse a title within the <code>name</code> while the tests are running.</p>