Serenity with Cucumber and requirements in other languages

385 views
Skip to first unread message

Paulo Henrique Lerbach Rodrigues

unread,
Jul 14, 2015, 11:10:02 AM7/14/15
to thucydid...@googlegroups.com
My dear friends,

Sometime ago I did some tests using Thucydides and now I'm returning the tool studies.

At that time the Thucydides did not get along with the use of Cucumber in other languages!

Now with the Serenity I was wondering if that has changed!

Can anyone tell me if now we can integrate it with the cucumber and use requirements in other languages?

Thanks,
PH

John Smart

unread,
Jul 14, 2015, 6:06:01 PM7/14/15
to Paulo Henrique Lerbach Rodrigues, thucydid...@googlegroups.com
--
___________________________________________________
John Smart | Wakaleo Consulting  |  +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com  |  john....@wakaleo.com
___________________________________________________

We love breaking down silos and helping smart teams collaborate better! Ask about our tailored on-site workshops in Agile Requirements Discovery, Behaviour Driven Development, Agile Development Practices, and Test Automation!
___________________________________________________

Paulo Henrique Lerbach Rodrigues

unread,
Jul 15, 2015, 4:10:33 PM7/15/15
to John Smart, thucydid...@googlegroups.com
Dear John,

When I run the 'mvn verify' command with the code available here: https://github.com/palerique/cucumber-serenity-webtests

An exception occurs!

The tests are usually performed but the Serenity can not generate the report!

Here are some code snippets (you can check completely on Github):

.feature:
# language: pt
@component:ui
@version:Release-2
Funcionalidade: Search by keyword
In order for buyers to find what they are looking for more efficiently
As a seller
I want buyers to be able to search for articles by keywords
Cenário: Search for articles by keyword
Dado I want to buy a wool scarf
Quando I search for 'wool'
Então I should see only articles related to 'wool'
Cenário: Search by shop name
Dado I want to see articles from a particular shop
Quando I search by shop for 'docksmith'
Então I should find 1 shop called 'docksmith'
Delineação do Cenário: Search for many articles by keyword
Dado I would like to buy a <article>
Quando I search for '<article>'
Então I should see only articles related to '<keyword>'
Exemplos:
| article | keyword |
| wool scarf | wool |
| cotton shirt | cotton |


SearchByKeyword.java:
package net.thucydides.showcase.cucumber;
import cucumber.api.CucumberOptions;
import net.serenitybdd.cucumber.CucumberWithSerenity;
import org.junit.runner.RunWith;
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features="src/test/resources/features/search/search_by_keyword.feature")
public class SearchByKeyword {}

serenity.properties:
#webdriver.driver=chrome
webdriver.driver=firefox
serenity.project.name = Demo Project using Serenity and Cucumber
serenity.use.unique.browser = false
serenity.browser,height = 1200
serenity.browser,width = 1200
serenity.dry.run=false
# How long does Serenity wait for elements that are not present on the screen to load
webdriver.timeouts.implicitlywait = 5000
serenity.take.screenshots=AFTER_EACH_STEP
#like code:
feature.file.language=pt #like documentation
feature.file,language=pt

Steps:
package net.thucydides.showcase.cucumber.steps;
import cucumber.api.java.pt.Dado;
import cucumber.api.java.pt.Entao;
import cucumber.api.java.pt.Quando;
import net.thucydides.core.annotations.Steps;
import net.thucydides.core.util.Inflector;
import net.thucydides.showcase.cucumber.steps.serenity.BuyerSteps;
import java.text.ParseException;
public class SearchScenarioSteps {
@Steps
BuyerSteps buyer;
@Dado("I (?:want|would like) to buy (.*)")
public void buyerWantsToBuy(String article) {
buyer.opens_home_page();
}
@Quando("I search for '(.*)'")
public void searchByKeyword(String keyword) {
buyer.searches_by_keyword(keyword);
}
@Entao("I should see only articles related to '(.*)'")
public void resultsForACategoryAndKeywordInARegion(String keyword) throws ParseException {
buyer.should_see_results_summary_containing(keyword);
}
@Dado("I want to see articles from a particular shop")
public void givenIWantToSeeArticlesFromAParticularShop() {
buyer.opens_home_page();
}
@Quando("I search by shop for '(.*)'")
public void whenISearchByShopFor(String shopName) {
buyer.should_see_nonexistant_field();
buyer.searches_for_shop_called(shopName);
}
@Entao("I should find (\\d+) (?:shop|shops) called '(.*)'")
public void thenIShouldFindShopsCall(int count, String shopName) {
String expectedMessage = String.format("%d %s encontrada para %s", count, pluralized(count, "loja"), shopName);
buyer.should_see_shop_search_result_summary_of(expectedMessage);
}
private String pluralized(int count, String word) {
return Inflector.getInstance().pluralize(word, count);
}
}
I did not change other files

Exception: (Line 22 =     Então I should see only articles related to '<keyword>')
1398 [main] ERROR net.thucydides.core.model.TestOutcome - Tag provider net.thucydides.core.requirements.FileSystemRequirementsTagProvider@39fcbef6 failure
gherkin.parser.ParseError: Parse error at search_by_keyword.feature:22. Found examples when expecting one of: background, comment, scenario, scenario_outline, tag. (Current getState: feature).
        at gherkin.parser.Parser$Machine.event(Parser.java:207)
        at gherkin.parser.Parser.event(Parser.java:159)
        at gherkin.parser.Parser.examples(Parser.java:124)
        at gherkin.lexer.Pt.scan(Pt.java:966)
        at gherkin.lexer.I18nLexer.scan(I18nLexer.java:36)
        at gherkin.parser.Parser.parse(Parser.java:62)
        at net.thucydides.core.requirements.model.cucumber.CucumberParser.loadFeatureNarrative(CucumberParser.java:45)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.loadFromFeatureFile(FileSystemRequirementsTagProvider.java:515)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.readRequirementsFromStoryOrFeatureFile(FileSystemRequirementsTagProvider.java:496)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider$2.convert(FileSystemRequirementsTagProvider.java:475)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider$2.convert(FileSystemRequirementsTagProvider.java:472)
        at ch.lambdaj.function.convert.ConverterIterator.next(ConverterIterator.java:37)
        at ch.lambdaj.Lambda.convert(Lambda.java:986)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.loadStoriesFrom(FileSystemRequirementsTagProvider.java:459)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.getRequirements(FileSystemRequirementsTagProvider.java:138)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.readChildrenFrom(FileSystemRequirementsTagProvider.java:579)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.requirementFromDirectoryName(FileSystemRequirementsTagProvider.java:538)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.readRequirementFrom(FileSystemRequirementsTagProvider.java:488)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider$1.convert(FileSystemRequirementsTagProvider.java:466)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider$1.convert(FileSystemRequirementsTagProvider.java:463)
        at ch.lambdaj.function.convert.ConverterIterator.next(ConverterIterator.java:37)
        at ch.lambdaj.Lambda.convert(Lambda.java:986)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.loadCapabilitiesFrom(FileSystemRequirementsTagProvider.java:454)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.getRequirements(FileSystemRequirementsTagProvider.java:137)
        at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.getTagsFor(FileSystemRequirementsTagProvider.java:263)
        at net.thucydides.core.model.TestOutcome.getTagsUsingTagProviders(TestOutcome.java:1271)
        at net.thucydides.core.model.TestOutcome.getTags(TestOutcome.java:1261)
        at net.thucydides.core.model.TestOutcome.addTags(TestOutcome.java:1286)
        at net.thucydides.core.steps.StepEventBus.addTagsToCurrentTest(StepEventBus.java:475)
        at net.serenitybdd.cucumber.SerenityReporter.startScenario(SerenityReporter.java:395)
        at net.serenitybdd.cucumber.SerenityReporter.startOfScenarioLifeCycle(SerenityReporter.java:387)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at cucumber.runtime.Utils$1.call(Utils.java:37)
        at cucumber.runtime.Timeout.timeout(Timeout.java:13)
        at cucumber.runtime.Utils.invoke(Utils.java:31)
        at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:243)
        at com.sun.proxy.$Proxy19.startOfScenarioLifeCycle(Unknown Source)
        at cucumber.runtime.junit.JUnitReporter.startOfScenarioLifeCycle(JUnitReporter.java:219)
        at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:40)
        at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91)
        at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
        at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
        at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93)
        at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at cucumber.api.junit.Cucumber.run(Cucumber.java:98)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Reply all
Reply to author
Forward
0 new messages