First of all open your keypad
Then dial the secret code *#0*#. Now you get a screen with title LCD TEST and below that you have lots of option to test various hardware parts of your phone such as speaker, sensor, lcd, etc
To go back use right physical button
while testing the touch, TSP Hovering you have to touch and mark all the squares back button does not work
Other use full secret codes for android phone tested on Galaxy S4
* #1234# to check software version of phone.
*#12580*369# to check software and hardware information.
*#0228# Battery status (ADC, RSSI reading)
*#0011# Service Menu