Datasets


A dataset allow you to loop on the sames steps for each element.

#Declaration

To declare a new dataset, you simply use an array.

Copied!
1$dataset = [
2 [
3 'productId' => 1,
4 'productPrice' => '123,00€',
5 ],
6 [
7 'productId' => 2,
8 'productPrice' => '42,00€',
9 ],
10];

#Attach to suite

Copied!
1->with($dataset)

#Use inside a step

To use a element of the dataset, you will use the getParam() method.

Copied!
1->it('should check product price', function () use ($frontOfficeProductPage) {
2 $productPrice = $frontOfficeProductPage->getPrice();
3 
4 Expect::that($productPrice)->samePriceAs($this->getParam('productPrice'));
5})