I've recently begun working on a PHP application, replacing another developer. I believed the application was using an API to communicate with a remote service but when I looked through the code I found that it was using a set of functions to actually log in, fill out forms and submit them as a user might do in a browser.
My intention is to replace this code, to use the services API instead. I've considered leaving the code as is and not replace it. It makes me wonder though is this a common practice in the software industry? To have a programme simulate a users actions in a browser to perform a set of actions? It feels to me that this is clever but poor programming, Have any other developers seen this?
Edit: Sorry, should have added this in the first place, the code I describe isn't part of a testing suite, its live code.