Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the Cucumber automated testing tool like?

Shulou Source: shulou.com Published: 2022-06-03 06:06:35 09月30日 Update

This article introduces what the Cucumber automated testing tool is like, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Cucumber is a very popular automated functional testing tool in agile teams, but it is not just a testing tool, it can create an easy-to-read, executable feature document for us.

What is Cucumber?

Cucumber is a tool that can execute automated test cases using a text description language called Gherkin.

Gherkin is used to describe the behavior of the software without knowing the specific implementation. There are two main purpose documents and automated test cases for using Gherkin (we hope to be able to be consistent with manual test cases). Gherkin supports more than 40 languages, including English and Chinese. Gherkin can add comments anywhere, starting with #, and each file ends with .feature. Enter the function description, scene, and steps in the feature file. When performing this function, each step needs to write ruby code blocks to achieve specific functions. Currently, cucumber supports multiple languages. In addition to ruby, you can also use java and javascript to write specific definition layer implementations.

Cucumber usage

View cucumber--i18nhelp, the languages supported by cucumber

View the keyword cucumber-i18nzh-CN that supports languages

Create Demo

1. Create a new demo file

2. Create a new features folder under the demo folder

3. Create a new "Chinese .feature" file under the features folder with a suffix ending with .fearure.

In Chinese, you must add # language:zh-CN at the front.

# language:zh-CN

Function: the first Chinese program

Chinese implementation

Scenario: Chinese implementation scenario

If it is currently in Chinese

When input is a test

Then you can see the Chinese test.

4. Create a new step_denfinitions folder

5. Create a new step_steps.rb file writing step definition in step_denfinitions (Ruby is used by default here)

Given/ ^ is currently (. *) / do | action |

@ action=action

End

When/ ^ input is (. *) / do | subject | @ subject=subject

End

Then/ ^ can see (. *) / do | greeting |

Ifgreetingwitness = "# {@ action} # {@ subject}" raise "expect to see, actually see"

End

End

About how the Cucumber automated testing tools are shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Tests files Chinese languages tools functions test tools folders support automation scenarios steps input content documentation more comments help good agile Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS NVidia Xiaomi Microsoft