-
Notifications
You must be signed in to change notification settings - Fork 5
Generating data for tests
While dealing with tests, you'll probably need sometimes to generate dummy data to be used for some test cases. In EasyCukes, we implemented a DataInjector which makes it possible directly from the steps you're writing in your feature files.
Each time you're using the syntax $__variable__$ in a step provided by EasyCukes, this whole string will be replaced by a randomly generated value (a String containing 11 random alphabetic characters) and also stored in the ExecutionContext using the key variable. For sure, you can define and generate as much variables as you want, and all of those are identified by the names you provide: $__name__$ for example will generate some data, and store it in the ExecutionContext using the key name.
While developing some new steps on your own, you can also reuse this mechanics by simply calling the DataInjector.injectData(String s) method, which will replace your variables by randomly generated data, and store them in the ExecutionContext.