What is the purpose of long endurance test flights?
This particular test flight tested the engines, not the aircraft:


  At 15:38 local time N7874, the fourth 787 built, departed Boeing Field
  in Seattle for an 18-hour, 22 state test flight. The crew spent the
  overnight hours above the United States performing ETOPS testing on
  the new Rolls Royce Trent 1000 TEN engine, which will power the
  787-10.


https://www.flightradar24.com/blog/boeing-uses-a-787-to-draw-a-787-dreamliner-during-etops-test/