Not sure what you mean by "torque test", but I presume you mean using a torque wrench or similar tool to tighten a nut (or bolt) to a specific torque value. It should not matter what type of socket you use because the torque exerted and measured is done by the torque wrench and your arm - the socket only transmits that force to the nut or bolt head. Now, of course there is a practical limit involved, just as there would be with any regular socket wrench use. That is, the socket (of whatever design) must be strong enough to handle the torque being used. Where that MIGHT become a factor is if you are trying to exert a very high torque on something - say, the bolts on a diesel engine head or on nuts holding a major suspension part in place.
No you absolutely cannot use any socket that has give in it like the type you pictured. The variation from actual torque could vary wildly depending on the minute design details, metal type, tolerances, specific torque value, temperature, humidity/rust, lubrication of the moving parts, etc, etc.
It should be the size of the bolt head, as short as possible and no extension on it if you want as close as possible. Granted as close as possible is not always all that important but those universal fit sockets are about as far from predictable as it gets.