Reputation: 116
include a random number in the specific steps you want Example:
Feature: Zonas
@TEST
Scenario Outline: TEST
Given Insert <Descripcion>
And insert <CodigoDeInterfaz>
And Validate Description <Descripcion>
And Validate CodigoDeInterfaz <CodigoDeInterfaz>
Examples:
| Descripcion | CodigoDeInterfaz |
| DescTH6456565 | CodDeIntHT45645645
i need include random number in values
Examples:
| Descripcion | CodigoDeInterfaz |
| Desc <RANDOM> | CodDeIntHT <RANDOM> | <---- here
so the input parameters all include the random number
Upvotes: 1
Views: 1272
Reputation: 32936
The easiest way to do this IMHO is to use a StepArgumentTransformation
, something like this:
[Then("And Validate Description (.*)")]
public void ThenValidateDescription(RandomisedValue description)
{}
[StepArgumentTransformation]
public RandomisedValue ToRandomisedValue(string initialInput)
{
return initialInput + GetRandomData();
}
specflow will call your step argument transformation method with the data in the method, you add your random element and return the class that represents the data that has been randomised. As long as you have a distinct class for each type of randomisation you want then specflow will be able to determine which of the step argument transformations it should call...
Upvotes: 1
Reputation: 10592
You can try to use Specflow.DSL.
Feature: Zonas
@TEST
Scenario Outline: TEST
Given Insert <Descripcion>
And insert <CodigoDeInterfaz>
And Validate Description <ValidateDescripcion>
And Validate CodigoDeInterfaz <ValidateCodigoDeInterfaz>
Examples:
| Name | Descripcion | ValidateDescripcion | CodigoDeInterfaz | ValidateCodigoDeInterfaz |
| Random | [[Descripcion=RegEx([0-9]{7})]] | [[Descripcion]] | [[CodigoDeInterfaz=RegEx([0-9]{7})]] | [[CodigoDeInterfaz]] |
Upvotes: 3