test iPhone 6s Home Button

hi

I want to develop a project when the user pressed home button if the home button working fine so the user sees an alert that the home button is working fine.

please give me the advice to achieve this feature.

Thanks
similarly i want the same feature for the lock button.
You want to do it in your app, right ?

If user presses home button in your app, he/she'll quit the app, hence know for sure button is working.

I do not understand what you want to prove in addition. What the user value of this ?
Maybe I missed something ?
Do you want a feature like guided accesss ?
You can not overwrite default behavior of the home button, which is handled by the OS, so it’s outside of the app.
You can try to send a notification on applicationWillResignActive (Docs) which might help you to achieve desired behavior (notify user, that button works fine), but overall you can’t keep home button from working as expected and put your app into background on press.
dear  Claude

I am working on the application where I want to test all iPhone buttons (home, lock, volume up and down, mute) is working fine. I tests all buttons expect home, and lock button, I want to check when the user clicks the home button if the home button is working fine so use alert your home button is working fine otherwise user sees home is not working correctly. 
dear Negenii

is it possible when my application going to background, i launch my application programatically.
This is not possible. There is no connection between pressing the home button and your app (other than your app goes to the background, but that might happen for reasons other than pressing the home button).
test iPhone 6s Home Button
 
 
Q