Talk about how to play the front end test

origin


After listening to the sermons of the big guys, I have been struggling with whether to write this content. There are two reasons. The first is that I feel that the initial investment is too much, and the output is in the later stage. The second reason is that for most small and medium-sized factories, it may be a little easier to test the little brother. Why did I decide to write it later? I still want to benefit everyone and give back to the community. Whether you use it or not, it is good to increase your knowledge.

The significance of front-end testing


There are two questions here, should the test be done by the front end? How to reasonably test the front end? In fact, the editor’s point of view is that it’s okay to do front-end testing, and it’s easier for students to test. Now there are many front-end testing tools that can be used. So if the front-end students took the test, does it mean that the test students will be rolled? The answer is not necessarily. The front-end students have done a lot of testing work, but some tasks must be handled by the test students. Therefore, the front-end testing is at most just a reduction in the number of test students in the company, but it cannot completely replace the test students. And the front-end testing is another manifestation of front-end students being responsible for their own code. The editor vaguely remembers that in the earliest company where there was no testing, development, product, and operation students were testing, because many small factories have limited budgets and may not have testing positions. Just like the previous sentence, everyone is a product manager. It can also be a simple test for everyone. In other words, users can be seen as tests.
The second question is how to reasonably test the front end. Everyone knows that when developers develop, there are actually blind spots, and it is difficult to cover everything. At this time, it may be necessary to test classmates to help developers find out the root cause of the problem. Let's talk about the types of tests, which can be roughly divided into three categories: unit testing, interface testing, and UI testing. If developers have time and energy, they can do unit testing to ensure code coverage. In fact, the interface test is usually done by the back-end students, or it can be handed over to the test students. The last is the ui test, which is to test the process and functions in the graphical interface, which is the bit by bit test that our familiar ui students often do.
Let’s briefly talk about interface testing:

  • Functional test: whether the interface is implemented according to the design document
  • Logical business test: whether the sequence of calls between interfaces will affect the logical business
  • Abnormal: parameter passing exception, data exception
  • Interface performance: the response time of a single interface call, the amount of returned data, etc.
  • Security test: whether sensitive information is encrypted, unique identification code, etc.

About automated testing


With the popularization of the above concepts, we can talk about automated testing. In fact, unit testing, interface testing, and UI testing can all use automated testing, and automated testing can actually save testing resources, reduce enterprise costs, and improve efficiency.
There are many automated testing tools, let’s simply popularize them:

  • Appium: mobile and app use
  • MiniTest: used to test small programs and games
  • AirTest IDE: Cross platform UI automation IDE
  • cyPress.io
  • Selenium
  • Playwright
  • httpRunner: for interface testing

Developers can write scripts for testing, and after accumulating a large number of script instances, they can reuse the accumulated instances in the later stage. Developers can find their own code loopholes in the development stage, save testing resources, and even enable testing.

Intelligent traversal test


Manual testing, that is, a little bit, everyone will feel that it is a waste of testing resources. Automated testing, in addition to accumulating test cases and generating a lot of value in the later stage, you may feel that it takes a lot of time to build in the early stage and maintain in the middle and late stages, which is troublesome. So let's take a look at the smart traversal test.
Intelligent traversal testing has the advantages of automated testing. In addition to the time-consuming learning and building in the early stage, automated models can be accumulated later, and there is no need to maintain code, which is simple and easy to use.
Smart traversal tools:

  • monkey
  • Smart_monkey transformed by Baidu
  • Tencent's newmonkey
  • Android App Crawler
  • appcrawler
  • macaca/nosmoke
  • fastbot

how to improve efficiency


How can the front end be done to improve efficiency? This cannot be done because of the front end, which reduces the overall efficiency of the enterprise. The editor briefly summarized:

  • Image diff comparison, in simple terms, is the ui test, compare the two versions of the same page under the same route, see what is different, and then conduct special tests according to different places to reduce the workload of test students.
  • Account creation tool, this point is actually very good, because many scenarios need to be simulated, and the test students often change the content of the account manually, so if you use the account creation tool to create a bunch of accounts, will it save a lot of time for the test students? time.
  • Mock data, link interception, this is used for interface testing, for details, please refer to the interceptor of axios
  • Custom handwritten eslint plug-in, this is actually to ensure the standardization of the company's code and add some own rules, which can be regarded as reducing code modification and enabling testing.

end


When many people are still clicking, a small number of people are playing automated testing, and more people are playing smart traversal. This is the attitude and difference of different people in the technical field. If you regard work as work, you can only follow the trend. If you want to learn and improve, then you can go farther than most people. If you want to make achievements, then you have the opportunity to become That little poke.
The good science time is always so short, see you next time!

Guess you like

Origin blog.csdn.net/zjscy666/article/details/128241366