Headless versus UI
As mentioned before, headless testing is the preferred mode for automated tests as it is faster than UI testing. With test example 1 and 3, we did implement the same kind of test: check that a lookup value can be assigned to a customer. Test example 1 is in headless mode, while test example 3 uses the UI. Running both tests indeed shows that UI tests are slower than headless tests, measured over 12 different runs. Have a look at the graph of execution duration (in seconds) in Figure 6.10:
The average execution duration for the UI tests is 1.35 seconds, while the headless average is almost 7 times faster: 0.20 seconds.
Note
Recently an attendee of one of my online courses showed me an example of two of his tests achieving the same: one in headless mode and the other using the UI. In this specific case, the latter was even 50 times slower!