homberghp commented on issue #8160:
URL: https://github.com/apache/netbeans/issues/8160#issuecomment-2598266837

   # what about Fail Fast?
   
   From my observations I infer the following high level sequence diagram.
   The refactoring (the SUT) ise executed by the unit test, which also collects 
the results(files with names),
   writes them to some indexed file system, retrieves the files from there, and 
then asserts the content.
   
   
![Image](https://github.com/user-attachments/assets/314305c0-064f-4d23-a458-10aaf75a7f9c)
   
   This is more akin to an integration test where you test multiple cooperating 
parts. With the cost of extra execution time.
   
   A real unit test would do the minimum to achieve its goal. Only interact 
with a (minimal set of classes, the SUT and the essential collaborators. The 
essence here is that it runs quickly and fails fast.
   
   I always told my students: _A good test is a **RED** one, **iff for the 
right reason**._
   
   
![Image](https://github.com/user-attachments/assets/e2219357-6aba-4783-b11e-8bcc28afafd8)
   
   This unit test would fail a lot faster.
   
   ## Compromise
   
   Adapt the current tests such, that they test the content of the files before 
they are written to the file system.
   If the asserts testing this pass, then write resulting files to the file 
system and redo the tests after indexing, so that all current aspects of the 
tests are covered.
   
   ## Future version
   
   A future version may drop the indexing and test afterwards for **all** 
assert in a test class **but one**, so that both
   the unit and the file system/indexing part is tested.
   
   At this moment I think that the instability of the tests does NOT lie in the 
refactoring part, but in the interaction with file system, indexes and caches.
   
   Anyway, I will try this in a branch called `refactoring-fail-fast` on my own 
fork. 


-- 
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.

To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to