Ask a Question

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

SOLVED
Vitaliu2000
New Contributor

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

6 REPLIES 6
tristaanogre
Esteemed Contributor

Is this being executed in TestComplete?  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
sonya_m
SmartBear Alumni (Retired)

Hi @Vitaliu2000, did you figure out the solution?

If not, let's keep working on it here. Please provide more details about your case starting with what tristaanogre is asking - are you executing this in TestComplete? This will help get the investigation going, thank you!


Sonya Mihaljova
Community and Education Specialist

Hello @sonya_m  and @tristaanogre and maybe someone who knows the solution 🙂 

I added the project to github at https://github.com/gitosic/gradest, to show the essence of the problem in more detail.

True, I found an alternative solution, but I'm not sure if this is the best option - https://github.com/gitosic/gradest/blob/18a076a55a0e3741cd42e28b4e859cf450b0b973/src/test/java/com/e...

 

Once again, I will outline the problem.

On the https://github.com/gitosic/gradest/blob/18a076a55a0e3741cd42e28b4e859cf450b0b973/src/test/java/com/e... line you need to check that there would be a positive check result.

 

Run test:

RunCucumberTest

 

Hi,

 

I skimmed through the project in github and saw nothing related to TestComplete. Thus I assume that your question is not TestComplete-specific and you are just looking for Cucumber-specific one. Am I correct?

Also, all comments in github are in Russian which means an extermely low chances to get assistance from other but Russian-speaking part of this and github community.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================

Hello @AlexKaras !

Yes you are right. My question does not apply to TestComplete. It turns out that I incorrectly chose the resource where I wrote the question. Ready to delete the question, so as not to violate the policy of posting questions. I apologize! Yes, I'm from Russia and looking for an answer on foreign resources)) it seems like it's normal practice))

sonya_m
SmartBear Alumni (Retired)

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


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: