Forum Discussion

Vitaliu2000's avatar
Vitaliu2000
New Contributor
5 years ago

How do I ignore a piece of data in a feature cucumber file?

English: How do I ignore a piece of data in a feature cucumber file?

Russian: Как в feature файле cucumber сделать игнорирование части данных?

 

Example:

English:  I want the test to work positively. The text "ignoring_String" must be ignored.

Russian: Я хочу, чтобы тест отработал положительно. Текст «ignoring_String» должен быть игнорирован.

 

Feature file:

 

        When compare text with reference

            |Stream launched 2019-10-2315:40 by admin|

            |Stream launched ignoring_String by admin|

 

java class:

import io.cucumber.java.en.When;

import java.util.List;

import static org.junit.Assert.assertTrue;

 

public class MyTestStepdefs {

    @When("compare text with reference")

    public void compareTextWithReference(io.cucumber.datatable.DataTable dataTable) {

        List<List<String>> rows = dataTable.asLists(String.class);

        String text = "Stream launched 2019-10-2315:40 by admin";

        assertTrue(text.equals(rows.get(0).get(0)));

        assertTrue(text.equals(rows.get(1).get(0)));

    }

}

 

Added a link to the repository - https://github.com/gitosic/gradest.git

  • sonya_m's avatar
    sonya_m
    5 years ago

    Vitaliu2000 we don't yet have a dedicated Cucumber Community, but you can always address your question to the Cucumber Slack channel. Details here.