Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Jbehave + serenity

231 views

Published on

Criando um projeto Com BDD usando Jbehave e serenity para automatizar testes web.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Jbehave + serenity

  1. 1. jBhave + Serenity
  2. 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. 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
  4. 4. <!-- 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>
  5. 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. 6. *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
  7. 7. Titulo Narrativa: Cenário1 Cenário2 ... CenárioN
  8. 8. 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.'
  9. 9. Given Pré-Condição When Procedimento Then Resultado esperado Scenario: Conjunto de passo/procedimentos
  10. 10. Scenario: Sum of two numbers Given a calculator When I add 2 and 2 Then the outcome should 4
  11. 11. 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
  12. 12. 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
  13. 13. 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
  14. 14. 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
  15. 15. 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||
  16. 16. PageObject Steps.serenit / EndSteps Steps Story
  17. 17. 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; } }
  18. 18. *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

×