Yes, it is possible if the underlying technology allows it and if you program your application to do so. Java for example contains class java.awt.Robot allowing you to perform mouse and key events in your application window. This enables you to create demos, and possibly even black box GUI automated test suite. It applies to Java desktop apps and not web apps.
From the white box perspective you can always add code to your app which runs module tests. The existing unit testing tools such as JUnit provide just a framework to make it easy for you. With a bit extra efforts you can avoid the framework and make the test code executable independently, for example through another application entry point (a class with main() method in Java app, or a "hidden" test page in a web app).
Robert Pes T-Plan Robot, open source cross-platform automated testing tool based on remote desktop technologies http://www.vncrobot.com