Jaycean commented on pull request #1245:
URL: https://github.com/apache/apisix-dashboard/pull/1245#issuecomment-765077174


   > > > > Hi, @Jaycean. Need unit test.
   > > > 
   > > > 
   > > > At present, the function interface needs to export the existing route 
data and ensure the correctness of the exported data, so I think E2E should be 
written more perfectly. I think if the simple unit test only tests whether the 
interface can export data, it does not represent whether the function of the 
interface is correct, and if the relevant route data is not created, the 
interface will not work normally use.
   > > 
   > > 
   > > Not agree with you.
   > > First of all, unit testing is very important. It helps find bugs easily 
and quickly if someone changes the code.And unit testing can cover more code 
than e2e test.
   > > For example, in this case.
   > > We need to test these situations at least:
   > > 
   > > 1. route can't found
   > > 2. Uris contain "*"
   > > 3. plugins with `request-validation`
   > > 4. different route method
   > >    ...
   > > 
   > > > and if the relevant route data is not created, the interface will not 
work normally use.
   > > 
   > > 
   > > We can mock data in etcd.
   > > See 
https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/server_info/server_info_test.go
 for more details.
   > 
   > @starsz Now I have encountered a problem in unit testing, exporting the 
data that needs to create route, upstream and service. After reading the 
example you gave me, I still don't know how to write it. Can you give me some 
advice. Thks
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to