In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Hello, everyone. I'm National Day holiday.
Today we talk about the types of tests-black, white and gray tests. So how do you classify the tests?
Let's go straight to the picture. I've prepared a big picture for you. Look at it carefully. It's hard to come by.
Note: the functional testing part is sorted according to the degree of importance and order.
At first glance, does your mood look like this?
Photo source: Baidu
Mo Fangha, in fact, this picture only classifies tests according to different latitudes. It does not mean that there are so many kinds of tests, and there is still a lot of overlap, but this picture needs to be understood and kept in mind, because interviews and jobs are commonly used. Next, we will use rich examples to show you how to understand this picture one by one.
Such as the title: in this article, we explain the meaning and differences of black box, white box and gray box tests (the so-called black and white ash).
We will put the rest in the following chapters and use examples to tell you one by one.
All right, let's get down to business.
The meaning and difference of Black, White and Grey Box Test
According to the above figure, we can see that according to whether to view the internal code / structure, we divide software testing into black-box testing, white-box testing and gray-box testing.
Black box test (Black-box Testing)
Black box testing, also known as functional testing, data-driven testing or testing based on requirements specifications, is strictly tested by using the whole software or a certain software function. In the test, the software under test is regarded as a black box, not concerned about the internal structure of the box, but only concerned with the input data and output data of the software. It mainly tests the software interface and software functions.
In black box testing, software test engineers only need to know what the software is going to do-and cannot see how the software in the box works. As long as you make some input, you can get some kind of output. For example: let's test the login function of QQ. Enter 11 for the account name and 11 for the password (this user does not exist), as shown in the following figure
Then click the "log in" button, and the QQ pops up as follows:
This is a typical black box test, which belongs to the business logic test in the black box test. The input and output of this test are as follows:
Enter 11User11 (username / password)
Output: "the account name or password you entered is incorrect" and so on.
Compare the input and output messages with the requirements specification to see if they are consistent, pass if they are consistent, and fail if they are inconsistent. (of course, the login test is not so simple. Here we just take one of the points as an example. Don't worry, I will take you to study slowly.)
White-box testing (White-box Testing)
White-box testing is also known as structural testing, transparent box testing, logic-driven testing, or code-based testing. White box refers to opening the box to study the source code and program results.
Neither unit testing nor code review falls within the scope of the work of junior test engineers. This part of the work is generally done by software development engineers, and the development team writes unit tests, code reviews, and reviews of both. There are also some tools for simple reviews, such as sonar, go, and so on. In short, any kind of situation is fine, as long as it suits your own situation.
We will not make a specific description or use case presentation here.
Source of picture: library
Gray box test (Gray-Box Testing)
Grey-box testing is a kind of test between white-box testing and black-box testing. Grey-box testing is mostly used in the integration testing phase, which pays attention not only to the correctness of output and input, but also to the internal situation of the program. Grey-box testing is not as detailed and complete as white-box testing, but it pays more attention to the internal logic of the program than black-box testing, often judging the internal running state through some characteristic phenomena, events and flags.
What's the difference between a gray box and a white box?
The testing period is different: White-box testing is carried out in the unit testing phase, and gray-box testing is carried out in the early stage of integration testing.
The focus of testing is different: White-box testing is more concerned about whether the internal implementation is carried out in accordance with the specification. Grey-box testing not only needs to pay attention to the content of white-box testing, but also considers the problem from the business level. Consider more combined testing business scenarios.
The scope is different: White-box testing pays more attention to a single code segment, the correctness of functions, gray-box testing objects have been able to basically complete a complete business function.
Whether the code is independent or not: the code of gray-box testing is relatively independent, unlike white-box testing, which basically corresponds to the program code.
This part is also a simple understanding. For beginners, it is still too early for both gray boxes and white boxes. You just need to know:
Black box testing does not need to pay attention to the code and internal structure of the program, white box and gray box need.
The white box pays attention to the correctness of a single code pair and function, which needs to correspond to the program code one by one, while gray box testing focuses on the whole business function.
Give an example
Finally, a simple example is given to compare black-box testing, white-box testing and gray-box testing.
The baby was having fun playing with the robot, when suddenly the robot stopped moving and didn't press it, so:
Baby: mom ~ my robot is not moving.
Me: did you turn on the switch? I turned on the switch repeatedly, but there was still no response, so I came to the conclusion that the robot was broken and needed to buy a new robot.
This scene happened to be heard by my father.
Dad: I came to have a look, so I took the toolbox and took apart the battery.
1. Well, with a new battery, it still won't work.
two。 Take apart the screw part of the robot, check the circuit, the line connection is good, it is not loose
Finally my father came to the conclusion: well, it's broken. Let's buy a new one.
At this time, Grandpa came back and said, let me have a look. Grandpa took his electric pen and began to test one line after another. Finally, oh, I found that the contact of this line was not good. Let's change the line. After changing the line, the robot finally started.
Everyone is very clear, as in the above story:
As a mother, I am a black box test: turn on the power to see if it works; only according to the input and output image test
Dad, it's a gray box test: turn on the robot and look at the internal structure, but only check the connection part of the line.
The awesome grandpa is the white box test: turn on the robot and check whether each line is connected and whether each line works properly.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.