I'm developing an app which is like a file-sync-client (like Dropbox).
I'd like to have acceptance (black-box) tests kind of like:
- (void) testLocalFolderCreation
{
// assert there is no folder on the server
// create folder (either via NSFileManager or system('mkdir ...'))
// wait a few seconds
// assert there is now a relevant folder on the server
}
and bunch of other tests which test local and remote changes and sync client behavior.
I tried creating unit-testing bundle in Xcode, but that one doesn't actually start the app which I need for this kind of tests.
I'd like to test the app in one-go, not to restart the whole app for every test method or test class.
Does anyone have an idea how to approach this problem? I guess, one option would be to create separate app (in Xcode or some completely other language), which would start the app (my sync client) and conduct tests while the app is running; but I'm not sure if this would be a proper approach.
I ended up writing tests in python. Python program would do: 1. prepare test environment with test data (delete old user account and create fresh new user login account) 2. delete any old cached app data on disk and launch the application 3. conduct tests like: 3.1. modify file system locally 3.2. sleep for 3 sec 3.3. assert the state on the server is expected
and vice versa (make remote server change, sleep for 5s, assert local state is as expected).
This turned out pretty nicely in the end, but I guess this solution suits this kind of app (virtual file system) and it cannot be adopted to general purpose apps.