Two questions about Automated Test / ssr

1 how to add unit tests and E2E tests to an existing project (are there any other tests)
a. How do unit tests divide units? so many function points each function point is a series of processes how to ensure coverage?
b.e2e test determines which interactions to test (read in an article that you shouldn"t write too many interaction tests or you can"t finish the test in a short time)
c.vue project usually uses vue-test to do automated testing.
2 ssr
a. Ssr is to improve seo search results and then directly return the entire html static page on the server when the crawler visits the page (is there any other use)
b. How to use ssr in a vue project that has already been built


first of all, you are not two questions, but five questions.

  1. how do I add unit tests and E2E tests to an existing project? There are many test packages available, including Jest, Karma, Mocha, etc., each of which is not simple enough for you to study for half a day.
  2. how do unit tests divide units? To put it simply, a source file is a unit, and you need to write test cases one by one for all the functions in this file, which is called unit testing. There is no such thing as a string of processes. Testing a series of processes made up of multiple functions is called system testing, or some people call it E2E testing or end-to-end testing, but the two are actually different.
  3. what interactions should be tested for the E2E test? In a comprehensive way, it should be all the interactions. An incomplete test cannot be called a test, or it is better than an accident. Since it is an end-to-end test, it means testing every end of the whole system, including PC, mobile phone, front-end, back-end, management end, and all end-to-end joint testing, so that it can be said that the end-to-end test of the whole system has passed completely.
  4. there is no such thing as automated testing. All automated tests only allow the machine to perform some of the least time-consuming human tests, and you spend three to five times as much time writing test case scripts, and when product managers modify requirements at will, you have to change not only the code, but also the test cases. And then spend three to double the time to debug and solve the errors caused by the wrong writing of test cases. So to put it simply: yes, the vue project is automated with vue-test, and of course you can use karma, mocha, or any test package you can imagine, as long as you are willing to spend three times more time familiarizing with and adapting to them one by one.
  5. SSR does a lot of things, definitely more than SEO optimization, which is just the least important of them. In fact, the real function of SSR is to speed up the loading speed of the first page and slow down the loading speed of the second page and the third page. Everyone hates the slow loading of the page. Because the traditional single-page application loads the JS file and the CSS file needed on the second page, the third page and the fourth page when loading the home page, some people think that this is relatively slow, so they use SSR to organize the data page by page according to the request sent by the server, which effectively reduces the amount of data transmitted on the home page. At the same time, it effectively increases the amount of data transmitted on the second page, the third page and the fourth page.
  6. there are many tutorials on the Internet that teach you how to transform a single-page vue project into SSR, specifically, to split your program into two parts, one running in a small node server and the other compiled into a js file, sent to the front end by this small node service. In my experience, the best thing to do is to do it with SSR in the first place instead of modifying it halfway. If you have to, it's best not to add SSR to an existing vue project, but to create an empty SSR project and move your old code in.
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-1ea1a04-47945.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-1ea1a04-47945.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?