When, for example, to test (5)
I believe the answer is:
assay
'test' is the definition.
('assay' can be a synonym of 'test')
'when for example' is the wordplay.
'when' becomes 'as'.
'for example' becomes 'say' (I've seen this before).
'as'+'say'='ASSAY'
'to' is the link.
(Other definitions for assay that I've seen before include "Examine (ore or alloy?)" , "Test quality of metals" , "'Analyse, precious metal, say (5)'" , "Test, or say, to establish quality" , "Trial" .)