Let's take a look at how the nickname modification process performs automated test splitting.

as shown in the figure, the following is the flow chart of nickname modification and decision. If you write a unit test, how to ensure that this function is successful

clipboard.png

my consideration is to take all the premises into account, and then to verify that there is too much code for unit tests. Even more than the implementation code.

-sharp , segmentfault 
Jul.15,2021

I think it's normal to test too much code.
of course, the tests written by programmers are different from those done by test engineers.
in my opinion, to develop unit tests written by yourself, is to ensure that the functions of the design can be realized , so the core function of your test is to ensure that

  • New user registration can be modified
  • the arrival time of old users can be modified
  • every special character cannot appear
  • changed to the same nickname (see the setting, you didn't mention what will happen, whether it will break the uniqueness or not)
  • modify nickname
  • modify the nickname again. The expected result is that the nickname cannot be modified

A joke is posted after work. Everyone is happy to get off work.
author: today's Feixue
link: https://www.zhihu.com/questio.
Source: Zhihu
copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please indicate the source.

A test engineer walked into a bar and ordered a glass of beer
A test engineer walked into a bar and ordered a cup of coffee
A test engineer walked into a bar and asked for 0.7 cups of beer
A test engineer walked into a bar and ordered-1 beer
A test engineer walked into a bar and ordered 2 ^ 32 glasses of beer
A test engineer walked into a bar. Asked for a glass of foot shampoo
A test engineer walked into a bar and asked for a lizard
A test engineer walked into a bar and ordered an asdfQwer24dgwash bar * (@
A test engineer walked into a bar and asked for nothing
A test engineer walked into a bar and went out through the window and through the back door and through the sewer.
A test engineer walked into a bar. He walked out again and again, and finally beat the boss outside.
A test engineer walked into a
A test engineer walked into a bar and asked for a hot handcuff

.

A test engineer walked into a bar, asked for a nan cup Null
1T test engineer rushed into a bar, ordered 500t beer, coffee, foot wash, wildcat tooth stick milk tea
1T test engineer dismantled the bar a test engineer disguised as the boss walked into a bar, ordered 500 cups of beer and did not pay
10,000 test engineers roared outside the bar
A test engineer walked into a bar and asked for a glass of beer. DROP TABLE Bar

the test engineers left the bar with satisfaction. Then a customer ordered fried rice and the bar blew up

what are the classic allusions or jokes in the computer field? -Feixue's answer today-Zhihu
https://www.zhihu.com/questio.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37d7b-2c0bc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37d7b-2c0bc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?