A testing device for a packaging machine for packaging products, in particular medical or pharmaceutical products or foodstuffs or dietary supplements, in containers, wherein the testing device comprises: a conveying device, which is configured to convey a plurality of containers in a clocked fashion in a conveying plane in a conveying direction through the testing device; a plurality of sensors (26, 30), wherein each sensor (26, 30) of the plurality of sensors (26, 30) is arranged in a testing region (28, 32) of the testing device and is configured to detect foreign bodies, in particular metal foreign bodies, in a container to be tested of the plurality of containers; and a plurality of carrier elements (46, 48), wherein in each case a container (4a, 4b) to be tested of the plurality of containers is received in a testing region (28, 32) by a carrier element (46, 48) of the plurality of carrier elements (46, 48); wherein the plurality of sensors (26, 30) and/or the plurality of carrier elements (46, 48) of the testing device, by which the containers (4a, 4b) to be tested are received in the testing region (28, 32), are formed movably in such a way that a relative movement between the plurality of sensors (26, 30) and the containers (4a, 4b) to be tested in a movement direction between a first arrangement and a second arrangement can be generated, wherein the movement direction is oriented perpendicularly to the conveying plane; wherein the plurality of sensors (26, 30) in the first arrangement is arranged in the movement direction at a distance from the containers (4a, 4b) to be tested, and wherein the plurality of sensors (26, 30) in the second arrangement at least partially surrounds the containers (4a, 4b) to be tested; wherein the sensors (26, 30) of the plurality of sensors (26, 30) are arranged one behind the other in the conveying direction. a conveying device, which is configured to convey a plurality of containers in a clocked fashion in a conveying plane in a conveying direction through the testing device; a plurality of sensors (26, 30), wherein each sensor (26, 30) of the plurality of sensors (26, 30) is arranged in a testing region (28, 32) of the testing device and is configured to detect foreign bodies, in particular metal foreign bodies, in a container to be tested of the plurality of containers; and a plurality of carrier elements (46, 48), wherein in each case a container (4a, 4b) to be tested of the plurality of containers is received in a testing region (28, 32) by a carrier element (46, 48) of the plurality of carrier elements (46, 48); wherein the plurality of sensors (26, 30) and/or the plurality of carrier elements (46, 48) of the testing device, by which the containers (4a, 4b) to be tested are received in the testing region (28, 32), are formed movably in such a way that a relative movement between the plurality of sensors (26, 30) and the containers (4a, 4b) to be tested in a movement direction between a first arrangement and a second arrangement can be generated, wherein the movement direction is oriented perpendicularly to the conveying plane; wherein the plurality of sensors (26, 30) in the first arrangement is arranged in the movement direction at a distance from the containers (4a, 4b) to be tested, and wherein the plurality of sensors (26, 30) in the second arrangement at least partially surrounds the containers (4a, 4b) to be tested; wherein the sensors (26, 30) of the plurality of sensors (26, 30) are arranged one behind the other in the conveying direction.