The idea of penetration testing stems from software engineers having to test a piece of software or code for security loopholes. The security weaknesses in a network or software are identified with penetration testing to eliminate them.