Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the Cucumber automated testing tool like?

2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report