We develop automated user interface tests. The application under test is quite complex and it can be configured by the user (the real user) in many ways. Our tests to be automated are quite complex as well and perform many actions on the application.
My dilema is which strategy to take:
1.Tests are executed in a secure and well known application configuration. In every test execution this environment is restored to the previous state (by restoring the database, or by restoring the virtual machine, using Vagrant or any other technique).
2.Test are executed in any application configuration so the tests embody themselves the intelligence to detect the configuration at run time and change it so the test will not break due to a bad configuration from a previous test.
The first aproach lets you to develop tests quickly and execute them in a stable application. You know that tests will not disturb each other. On the other hand, tests can be executed through any installation and configuration and but these tests are more complex to implement so the time to develop them is higher.
Which aproach do you use? Which are the pros and cons of both techniques?