Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the nature and example of cucumber?

Shulou Source: shulou.com Published: 2022-06-02 02:30:50 10月02日 Update

This article shows you the nature of cucumber and how the examples are. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Noun interpretation Feature

Feature is the beginning of all tests. It is followed by a descriptive text indicating what the test file is for.

Description

Description is an extensible text description that can be followed under Feature, Example, Background, Scenario, and Scenario Outline.

Example and Scenario

Example and Scenario are a pair of synonyms, a specific test case that contains multiple step. In general, it is made up of Given (given an initial condition), When (what happened), and Then (what is the result).

Steps

Step is the smallest unit of cucubmer, and each step is composed of Given, When and Then.

Example Feature: merchant management test Scenario: login test Given open login address "https://localhost:8080/sso/login" When login link is normal Then login has tokenpublic class LoginStepdefs {private String token; private Response response; @ Given (" open login address {string} ") public void opens login address (String url) {System.out.println (" url = "+ url) InputStream inputStream = getClass () .getResourceAsStream ("/ io/cucumber/mryt/srm/login.json"); response = given () .body (inputStream) .with () .contentType (ContentType.JSON) .config ((RestAssured.config (). SslConfig (new SSLConfig (). RelaxedHTTPSValidation () .post (url) } @ When ("whether the login link is normal") whether the public void login link is normal () {System.out.println ("response.getBody (). AsString () =" + response.getBody () .asString ()); response.then () .assertThat () .statusCode } @ Then ("whether there is token after login") is there any token () {token = response.path ("data.token"); Assert.assertTrue (StringUtils.isNotBlank (token)) after public void login;}} the above is the nature of cucumber and what the examples are like. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Login test address link instance essence content skill text is explained by knowledge minimum concise concise example initial condition unit synonym noun noun Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Docker OPPO Reno MySQL Huawei