Step 2: What aspects should the Test start from?

Source: Internet
Author: User

Preface

In general, the test conditions are nothing more than two aspects: ① Positive Test, ② reverse test!

If you think about it from these two aspects, you will surely be confused. That is to say, it is not comprehensive. Therefore, we should make a specific division based on the above two situations, so long as we can follow these conditions, we can basically achieve comprehensive (if we can, about 80% of the problems should be solved), so we will see the following six points to be discussed!

The predecessors summarized these test conditions:Right-bicep

 1. Right-do the right thing. It can be said to be "positive test"

This pre-test task requires the preparation of sufficient data (the premise is to ensure the correctness of the data, this is very important ), the value or impact returned after the code is run must be consistent with your expectation!

Note: If the prepared data is too large or easy to lose, we recommend that you put it in the data file and then let the unit test read the file. This method will be discussed in the next article!

 

 2. B-Boundary Condition)

The boundary condition is the top priority in the test and must be well understood and valued!

It is divided into seven sub-conditions. Let's get familiar with it one by one!

① Conformance)

Is the data in the format specified by me (it can be said that it is an invalid character )!

Case: for example, if the file name of the input parameter needs to be in the format of file name + date (yy-mm-dd) + extension, I will write a file name for the input test as follows: "Sa #$ #" format!

② Ordering)

In this regard, we mainly need to test the data sequence in arrays and sets that have strict requirements on the data sequence!

For example, the order of each dish in the ordering system recipe, or the queuing system that goes to the bank to handle the business, etc!

③ Range, Range)

Whether the value exists between a maximum value and a minimum value is mainly used to test the data of the value type!

Another important test point is to test the index values in arrays, sets, tables, and Dataset. For example, the index value cannot be negative or exceed the index range!

For example, a function that searches for information by ID should test the maximum and minimum values of this ID!

④ Reference)

This is mainly because the code references external factors that are not controlled by the Code itself (such as calling third-party interfaces and calling interfaces of other modules )!

We have no way to control these cases, so we can only simulate them during testing, and we will use the "mole" Technology During simulation, let it help us create a simulated environment (next article will introduce )!

For example, some projects call the bank interface. In this case, only one virtual bank interface can be created before testing!

⑤ Existence (exist)

Fixed tests, such as null, empty, and non-zero must be considered!

⑥ Cardinality)

It is still hard to understand this test. This test will only be considered for specific occasions!

It follows a principle: "0-1-n "!

7. Time (timer)

Software or systems that depend on time should be tested in this respect!

Major Considerations: whether the tasks are executed in chronological order, whether they are executed at the right time, and whether the execution is delayed!

Relative time: website timeout, data update timeout, and so on!

Absolute Time: whether to synchronize the time between different clients!

Concurrency problems are important in the time test!

  

 3. I-inversion)      

A reverse thinking when preparing or verifying data involves a personal way of thinking!

For example, a function operates the database, but it does not return any values or prompts. If you test the correct data, so how do you know that the test results are consistent with your expectations? Here you should look for the database to see if the data in the database has been actually changed. This is a reverse way of thinking!

 

 4. C-cross)

Use one quantity to check the other quantity (not many situations need to be considered )!

 

 5. E-Force Error)

Use the code to forcibly generate special circumstances that may occur when the software is running!

You can refer to the following test aspects: memory consumption, full disk usage, power failure, network disconnection during data update, and severe network load paralysis, the system time may be inconsistent with the international time!

 

 6. P-Properties)

I have not studied performance testing tools for the use of performance testing tools. I know your experience!

Carry out stress testing, increase the data volume by 1.1, 10000, 100000, and 1000000!

 

Conclusion: I am not very familiar with the two test conditions of reverse Association and cross-check. If you know this, you can leave a message to me. I will add it to the article!

Next article: Go to unit test 3: Create your own unit test

Finally, the following is my summary of the test conditions!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.