derbynet icon indicating copy to clipboard operation
derbynet copied to clipboard

Testing documentation

Open fastjames opened this issue 7 years ago • 3 comments

I would like to add a short document on how to run the test suite. Do you have anything like that already written down somewhere (even if it's rough)? I'm happy to clean it up, or if you just have "I usually run x y z" I can start with that. I don't want to submit changes that break stuff, so I'd like to take advantage of the existing tests if possible.

fastjames avatar Jan 24 '18 15:01 fastjames

I do primary development on a Mac, and there's a good chance the testing scripts have unintended reliance on my particular environment (e.g., specific directories).

From derbynet directory, the top-level command I usually run is

testing/suite-local-mac.sh localhost/derbynet

where the command argument tells where the derbynet server you want to test is. suite-local-mac tries to exercise both sqlite and mysql databases, mostly by invoking testing/exercise-one-database.sh.

If the server being testing is "localhost" in some form, then, for expediency, photo uploading is short-circuited and photos are just copied directly to the appropriate photo directories.

Many/most of the constituent test scripts are context-dependent, i.e., they expect the database to be in a certain state by virtue of the other tests that have run before it. This is a source of some brittleness, obviously.

If phantomjs is present, then testing/test-basic-javascript.sh (invoked from exercise-one-database) will run some really basic javascript tests, otherwise it'll warn that it's skipping these.

jeffpiazza avatar Jan 24 '18 15:01 jeffpiazza

Looking at the sources again, exercise-one-database.sh takes extra arguments to identify where to find the database. The default values of these arguments are specific to my personal development environment, but at least you can pass in values that would work in other environments.

suite-local-mac.sh relies on the default values from exercise-one-database.sh, which means this particular script is specific to my development environment. Until I fix that, a developer should probably just do something like:

test-ab-initio-setup.sh "$BASE_URL" exercise-one-database.sh "$BASE_URL" mysql "$dbname" "$dbuser" "$dbpassword" exercise-one-database.sh "$BASE_URL" sqlite "$path_to_sqlite_database_file"

jeffpiazza avatar Jan 25 '18 13:01 jeffpiazza

Thanks very much for the guidance. I'll see what I can come up with.

fastjames avatar Jan 25 '18 14:01 fastjames