Advertisement
Guest User

cucumber param

a guest
Jul 28th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // demo.feature ---------------------------------------------------------------------
  2. Feature: Demo
  3.     Scenario: Param
  4.         When    I want to print the configuration config param "param1" from config.xml
  5.  
  6. // step_definitions/demo.js ---------------------------------------------------------
  7.  
  8. var xml2js = require('xml2js')
  9. module.exports = function () {
  10.     var config
  11.     xml2js.parseString(`<?xml version="1.0" encoding="UTF-8"?>
  12.         <config>
  13.             <param1>Foo</param1>
  14.             <param2>Bar</param2>
  15.         </config>`, function (err, result) {
  16.             config = result.config
  17.         });
  18.     this.When('I want to print the configuration config param "$configParamName"', function(configParamName) {
  19.         var value = config[configParamName]
  20.         console.log(`param ${configParamName} = ${value}`)
  21.     })
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement