1. A liveness testing method for an electronic device, the method comprising: testing a liveness of an object included in a received input image based on whether an image of the object has a characteristic indicative of a flat surface or a characteristic indicative of a three-dimensional (3D) structure, wherein the testing includes calculating diffusion speeds for a plurality of pixels corresponding to the image of the object based on values of the plurality of pixels before diffusion and diffusion values of the plurality of pixels after diffusion, and determining whether the image of the object has the characteristic indicative of the flat surface or the characteristic indicative of the 3D structure based on the diffusion speeds for the plurality of pixels corresponding to the image of the object.