My first Cucumber example (part 1)

My first Cucumber example (part 1)

Objective: running your first Cucumber project

Project reference: LINK

1 - Requirements:

If you are using:

In the second step, create a simple MAVEN project in your IDE and add the dependencies:

2 - Theory:

  Cucumber uses the Gherkin syntax language to write test cases. For example:

No alt text provided for this image

We can do an analogy about the vocabulary used by Cucumber and the test domain:

No alt text provided for this image

PRACTICAL CODE:

Create the following packages and files in your project, under the TEST folder

No alt text provided for this image

ATTENTION: Look at the file extension FEATURE, it is the file where we write the tests using Gherkin.

Fill your files:

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

More theory:

In the feature file, you write the tests in high-level syntax, in the step definitions the java implementation of the sentences created, and finally, the test runner link the Gherkin and Java file.

The Cucumber uses Java annotations to mark and run their features.

3 - Conclusion:

Run the Maven "mvn verify" and look at the GREEN BAR. 

No alt text provided for this image


Joao Filho

Coordenador de Práticas e Performance na @RD Saúde | Gest?o de Dados | Gest?o de Projetos e Produtos Digitais

4 年

Joao Vale teria algum material sobre cucumber que possa compartilhar para quem está iniciando ?

回复

要查看或添加评论,请登录

Joao Vale的更多文章

  • Code Challenge - Interview / Entrevista

    Code Challenge - Interview / Entrevista

    Colegas developers, tudo bem com voces? Gostaria de compartilhar uma questao de code-interview de uma grande empresa na…

  • Torne seu LinkedIn visível para recrutadores.

    Torne seu LinkedIn visível para recrutadores.

    Neste post, vou apresentar a vocês duas funcionalidades importantes do LinkedIn: Tornar visível para recrutadores;…

    2 条评论
  • Principais Anota??es - JPA

    Principais Anota??es - JPA

    A Java Persistence API ou JPA utiliza diversas anota??es para configurar e identificar elementos utilizados no…

    1 条评论
  • O que s?o interfaces funcionais? (Java)

    O que s?o interfaces funcionais? (Java)

    De maneira direta e objetiva: uma interface é funcional quando possui somente um método abstrato. A partir do Java 8…

    3 条评论
  • Desenvolvedor Júnior, Pleno ou Sênior?

    Desenvolvedor Júnior, Pleno ou Sênior?

    Algumas vagas de emprego buscam profissionais classificando-os como Júnior, Pleno ou Sênior. Mas o que caracteriza o…

  • Aprenda Inglês mas n?o esque?a do Português

    Aprenda Inglês mas n?o esque?a do Português

    Os profissionais de ciência exata, principalmente os que trabalham com tecnologia da informa??o, engenharia…

社区洞察

其他会员也浏览了