0

I currently have a problem with Java and Cucumber. Accessing a website's element by using Selenium, I want to use phrases like the following:

Then the value of the attribute XYZ should be 1000

That example is quite trivial and works fine for each attribute name by using the Java annotation

@Then("the value of the attribute (.*) should be (.*)")

except for the following use-case: an attribute name contains parentheses like ABC(s).

While using Eclipse and JUnit, a Cucumber test with a string containing parentheses like that is not even recognized completely but just the part of the string before the opening bracket. Any ideas or solutions?

Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
sascha_lamp
  • 179
  • 2
  • 12

1 Answers1

1

It doesn't matter whether the attribute name contains any parentheses.

When using this method:

@Then("^the value of the attribute (.*) should be (.*)$")
public void checkAttributeValue(String name, String value)
        throws Throwable {
    System.out.println("Name: " + name + " value: " + value);
}

And

Then the value of the attribute XYZ(s) should be 1000

I get

Name: XYZ(s) value: 1000

Which I think is what you expect.

Pieter Kuijpers
  • 7,247
  • 5
  • 28
  • 36
  • Okay, it turned out that only Eclipse's JUnit-View doesn't print the test-cases correctly. For example for the case `Then the value of the attribute XYZ(s) should be 1000` the following is printed: `Then the value of the attribute XYZ`. – sascha_lamp May 06 '14 at 12:43