SlideShare a Scribd company logo
jBhave + Serenity
*
Criar um pequeno caso de teste automatizado
com o objetivo de fomentar o uso do jBehave e
das ferramentas para a automação de tese de
software, assim como discutir os padrões de
projeto em automação de teste.
*
*Criando um projeto com jbehave + Serenity
*Criando story
*Gerando os steps
*Executar um caso de teste e visualizar os
relatórios de teste gerados pelo Serenity
<!-- https://mvnrepository.com/artifact/net.serenity-
bdd/serenity-jbehave-archetype -->
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-jbehave-archetype</artifactId>
<version>1.2.0</version>
</dependency>
*Help > Install New Software...
*Add the new site
location http://jbehave.org/reference/eclipse
/updates/
*Select JBehave Eclipse feature and follow
standard Eclipse installation procedure
*Título
*Narrativa
Search for definitions
In order to understand a
word that I don't know
As a user
I want to be able to
look up the meaning of
the word
Titulo
Narrativa:
Cenário1
Cenário2
...
CenárioN
Lookup a definition
Narrative:
In order to talk better
As an English student
I want to look up word definitions
Scenario: Looking up the definition of 'apple'
Given the user is on the Wikionary home page
When the user looks up the definition of the word 'apple'
Then they should see the definition 'A common, round fruit produced by
the tree Malus domestica, cultivated in temperate climates.'
Scenario: Looking up the definition of 'pear'
Given the user is on the Wikionary home page
When the user looks up the definition of the word 'pear'
Then they should see the definition 'An edible fruit produced by the
pear tree, similar to an apple but elongated towards the stem.'
Given Pré-Condição
When Procedimento
Then Resultado esperado
Scenario: Conjunto de passo/procedimentos
Scenario: Sum of two numbers
Given a calculator
When I add 2 and 2
Then the outcome should 4
Scenario: Show shipping cost for an
item in the shopping cart
Given I have searched for docking
station
And I have selected a matching item
When I add it to the cart
Then the shipping cost should be
included in the total price
Scenario: Search for an available product
Given I am on the home page of the virtual store
When I look for the shirt item
Then I should see the option women's shirt
When I click on the option for women's shirts
Then I should see the message Search Result:
shirts
Scenario: login in the system
Given I am on the login page
When I put maria in the login lable
And I put 123456 in the password lable
And I click in the login button
Then I should have access to the system
Scenario: Sum of two numbers
Given a calculator
When I add 2 and 2
Then the outcome should 4
And I should see the message
Do you want to make a new sum
Scenario: login or password incorrect
Given I am on the login page
When I put <login> in the login labale
And I put <password> in the password labale
And I click in the login button
Then I should see the message invalid login or
password!
Examples:
|login|password|
|LoginCorreto|SenhaIncorreta |
|LoginIncorreto|SenhaCorreta |
||SenhaCorreta |
|LoginIncorreto||
PageObject
Steps.serenit / EndSteps
Steps
Story
public class AcceptanceTestSuite extends SerenityStories {
private final Locale defaultlanguage = new Locale("pt");
@Override
public Configuration configuration(){
Configuration configuration = super.configuration();
Keywords keywords = new LocalizedKeywords(defaultlanguage);
configuration.useKeywords(keywords)
.useStoryParser(new RegexStoryParser(keywords))
.useStoryLoader(new UTF8StoryLoader())
.storyReporterBuilder().withKeywords(keywords);
return configuration;
}
}
*Jessica nunes jessica@usto.re
*Marina Viana marina@usto.re
*Rafael Jordão rafael@usto.re
*Este foi um material desenvolvido pelo time de
teste da Ustore

More Related Content

Similar to Jbehave + serenity

Behat for writing tests in a stylized way
Behat for writing tests in a stylized wayBehat for writing tests in a stylized way
Behat for writing tests in a stylized way
Ravindra Singh
 
Shopify Theme Building Workshop
Shopify Theme Building WorkshopShopify Theme Building Workshop
Shopify Theme Building Workshop
Keir Whitaker
 
Behat, Test Driven Framework for BDD by Jeevan Bhushetty
Behat, Test Driven Framework for BDD by Jeevan BhushettyBehat, Test Driven Framework for BDD by Jeevan Bhushetty
Behat, Test Driven Framework for BDD by Jeevan Bhushetty
Agile Testing Alliance
 
Software Testing
Software TestingSoftware Testing
Software Testing
superphly
 
Java spring mysql without hibernate(2) (1)
Java spring mysql without hibernate(2) (1)Java spring mysql without hibernate(2) (1)
Java spring mysql without hibernate(2) (1)
AmedJacobReza
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with CucumberBrandon Keepers
 
Building a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing StrategiesBuilding a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing Strategies
CiaranMcNulty
 
Modeling Requirements Using Examples
Modeling Requirements Using ExamplesModeling Requirements Using Examples
Modeling Requirements Using Examples
Excella
 
Build the Perfect WordPress Website
Build the Perfect WordPress WebsiteBuild the Perfect WordPress Website
Build the Perfect WordPress Website
Sinergia Labs
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018
Berend de Boer
 
Cart creation-101217222728-phpapp01
Cart creation-101217222728-phpapp01Cart creation-101217222728-phpapp01
Cart creation-101217222728-phpapp01
Jason Noble
 
E-Bazaar
E-BazaarE-Bazaar
E-Bazaar
ayanthi1
 
WordPress-like plugins for Next.js - Sanket Sahu
WordPress-like plugins for Next.js - Sanket SahuWordPress-like plugins for Next.js - Sanket Sahu
WordPress-like plugins for Next.js - Sanket Sahu
Kumar Sanket
 
How React Native Appium and me made each other shine
How React Native Appium and me made each other shineHow React Native Appium and me made each other shine
How React Native Appium and me made each other shine
Wim Selles
 
Introduce cucumber
Introduce cucumberIntroduce cucumber
Introduce cucumber
Bachue Zhou
 
Customer Development Power-Ups
Customer Development Power-UpsCustomer Development Power-Ups
Customer Development Power-Ups
Lean Startup Co.
 
Functional testing the_good_the_bad_and_the_ugly
Functional testing the_good_the_bad_and_the_uglyFunctional testing the_good_the_bad_and_the_ugly
Functional testing the_good_the_bad_and_the_ugly
John Ferguson Smart Limited
 
x 13118706 Artur Janka Project Presentation
x 13118706 Artur Janka Project Presentation x 13118706 Artur Janka Project Presentation
x 13118706 Artur Janka Project Presentation Artur Janka
 
Web driver selenium simplified
Web driver selenium simplifiedWeb driver selenium simplified
Web driver selenium simplified
Vikas Singh
 
OLT open script
OLT open script OLT open script
OLT open script
Sujay Raghuraj
 

Similar to Jbehave + serenity (20)

Behat for writing tests in a stylized way
Behat for writing tests in a stylized wayBehat for writing tests in a stylized way
Behat for writing tests in a stylized way
 
Shopify Theme Building Workshop
Shopify Theme Building WorkshopShopify Theme Building Workshop
Shopify Theme Building Workshop
 
Behat, Test Driven Framework for BDD by Jeevan Bhushetty
Behat, Test Driven Framework for BDD by Jeevan BhushettyBehat, Test Driven Framework for BDD by Jeevan Bhushetty
Behat, Test Driven Framework for BDD by Jeevan Bhushetty
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Java spring mysql without hibernate(2) (1)
Java spring mysql without hibernate(2) (1)Java spring mysql without hibernate(2) (1)
Java spring mysql without hibernate(2) (1)
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
 
Building a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing StrategiesBuilding a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing Strategies
 
Modeling Requirements Using Examples
Modeling Requirements Using ExamplesModeling Requirements Using Examples
Modeling Requirements Using Examples
 
Build the Perfect WordPress Website
Build the Perfect WordPress WebsiteBuild the Perfect WordPress Website
Build the Perfect WordPress Website
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018
 
Cart creation-101217222728-phpapp01
Cart creation-101217222728-phpapp01Cart creation-101217222728-phpapp01
Cart creation-101217222728-phpapp01
 
E-Bazaar
E-BazaarE-Bazaar
E-Bazaar
 
WordPress-like plugins for Next.js - Sanket Sahu
WordPress-like plugins for Next.js - Sanket SahuWordPress-like plugins for Next.js - Sanket Sahu
WordPress-like plugins for Next.js - Sanket Sahu
 
How React Native Appium and me made each other shine
How React Native Appium and me made each other shineHow React Native Appium and me made each other shine
How React Native Appium and me made each other shine
 
Introduce cucumber
Introduce cucumberIntroduce cucumber
Introduce cucumber
 
Customer Development Power-Ups
Customer Development Power-UpsCustomer Development Power-Ups
Customer Development Power-Ups
 
Functional testing the_good_the_bad_and_the_ugly
Functional testing the_good_the_bad_and_the_uglyFunctional testing the_good_the_bad_and_the_ugly
Functional testing the_good_the_bad_and_the_ugly
 
x 13118706 Artur Janka Project Presentation
x 13118706 Artur Janka Project Presentation x 13118706 Artur Janka Project Presentation
x 13118706 Artur Janka Project Presentation
 
Web driver selenium simplified
Web driver selenium simplifiedWeb driver selenium simplified
Web driver selenium simplified
 
OLT open script
OLT open script OLT open script
OLT open script
 

Recently uploaded

Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 

Recently uploaded (20)

Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 

Jbehave + serenity

  • 2. * Criar um pequeno caso de teste automatizado com o objetivo de fomentar o uso do jBehave e das ferramentas para a automação de tese de software, assim como discutir os padrões de projeto em automação de teste.
  • 3. * *Criando um projeto com jbehave + Serenity *Criando story *Gerando os steps *Executar um caso de teste e visualizar os relatórios de teste gerados pelo Serenity
  • 5. *Help > Install New Software... *Add the new site location http://jbehave.org/reference/eclipse /updates/ *Select JBehave Eclipse feature and follow standard Eclipse installation procedure
  • 6.
  • 7. *Título *Narrativa Search for definitions In order to understand a word that I don't know As a user I want to be able to look up the meaning of the word
  • 8.
  • 10. Lookup a definition Narrative: In order to talk better As an English student I want to look up word definitions Scenario: Looking up the definition of 'apple' Given the user is on the Wikionary home page When the user looks up the definition of the word 'apple' Then they should see the definition 'A common, round fruit produced by the tree Malus domestica, cultivated in temperate climates.' Scenario: Looking up the definition of 'pear' Given the user is on the Wikionary home page When the user looks up the definition of the word 'pear' Then they should see the definition 'An edible fruit produced by the pear tree, similar to an apple but elongated towards the stem.'
  • 11. Given Pré-Condição When Procedimento Then Resultado esperado Scenario: Conjunto de passo/procedimentos
  • 12. Scenario: Sum of two numbers Given a calculator When I add 2 and 2 Then the outcome should 4
  • 13. Scenario: Show shipping cost for an item in the shopping cart Given I have searched for docking station And I have selected a matching item When I add it to the cart Then the shipping cost should be included in the total price
  • 14. Scenario: Search for an available product Given I am on the home page of the virtual store When I look for the shirt item Then I should see the option women's shirt When I click on the option for women's shirts Then I should see the message Search Result: shirts
  • 15. Scenario: login in the system Given I am on the login page When I put maria in the login lable And I put 123456 in the password lable And I click in the login button Then I should have access to the system
  • 16. Scenario: Sum of two numbers Given a calculator When I add 2 and 2 Then the outcome should 4 And I should see the message Do you want to make a new sum
  • 17. Scenario: login or password incorrect Given I am on the login page When I put <login> in the login labale And I put <password> in the password labale And I click in the login button Then I should see the message invalid login or password! Examples: |login|password| |LoginCorreto|SenhaIncorreta | |LoginIncorreto|SenhaCorreta | ||SenhaCorreta | |LoginIncorreto||
  • 19. public class AcceptanceTestSuite extends SerenityStories { private final Locale defaultlanguage = new Locale("pt"); @Override public Configuration configuration(){ Configuration configuration = super.configuration(); Keywords keywords = new LocalizedKeywords(defaultlanguage); configuration.useKeywords(keywords) .useStoryParser(new RegexStoryParser(keywords)) .useStoryLoader(new UTF8StoryLoader()) .storyReporterBuilder().withKeywords(keywords); return configuration; } }
  • 20. *Jessica nunes jessica@usto.re *Marina Viana marina@usto.re *Rafael Jordão rafael@usto.re *Este foi um material desenvolvido pelo time de teste da Ustore

Editor's Notes

  1. https://mvnrepository.com/artifact/net.serenity-bdd/serenity-jbehave-archetype
  2. import java.util.Locale; import net.serenitybdd.jbehave.SerenityStories; import org.jbehave.core.configuration.Configuration; import org.jbehave.core.configuration.Keywords; import org.jbehave.core.i18n.LocalizedKeywords; import org.jbehave.core.parsers.RegexStoryParser; import net.serenitybdd.jbehave.UTF8StoryLoader;