Commit Graph
164 Commits
Author SHA1 Message Date
Dannon Baker 623a5e165a Apply black formatting.
Apply isort.
2022-02-03 07:42:20 -05:00
John Chilton 3a9596a66f Cleanup galaxy_test.base.api_util.
- Rename get_master_api_key to get_admin_api_key - less offesnive and more accurate since it doesn't need to be the bootstrap key.
- Add types and cleanup docstrings.
2021-01-16 20:11:39 -05:00
John Chilton 2c2ed3f288 Decouple API and Selenium tests from galaxy-test-driver (and the whole app!)
I've been refactoring toward this for at least half a decade. Being able to pip install the API and Selenium tests without bringing in the whole app is important to make them usable outside the context of the app - for testing remote, running servers for instance.

If galaxy-test-driver is available the test cases will still spawn a Galaxy instance if needed, but this is not longer required for import or use.
2020-07-06 13:57:48 -04:00
John Chilton 72bae33923 Migrate selenium tests into lib/galaxy_test for packaging. 2019-11-12 09:05:08 -05:00
John Chilton 45019c3fbd Move galaxy testing utilities into more sane package structure.
Split test/base into lib/galaxy_test/base and lib/galaxy_test/driver. Dividing things on whether they import galaxy-app code or not - with the goal of a galaxy-test-base package that doesn't depend on galaxy-app and a galaxy-test-driver package that does.

I've been refactoring around this division for a long time. Certain tests (namely the integration tests) always need to bootstrap Galaxy - but the API tests and the Selenium tests should be installable and runnable without Galaxy in the Python environment. So future galaxy-test-api and galaxy-test-selenium packages should have only an optional dependency on galaxy-test-driver.

Properly sturcturing these namespaces is a precursor for real packages on PyPI, clean separation of the tool shed testing code, and cleans up all the flake8 noqa hacks in test/.
2019-11-12 09:03:06 -05:00
mvdbeek 3f032f6c38 Rework and simplify data manager testing
We don't rely on TwillTestCase anymore, that is now exclusively used by
ShedTwillTestCase. Then I've just re-used the infrastructure of
ToolsTestCase for discovering tests, while making sure that we do use an
admin API key during testing.
2018-08-13 17:19:25 +02:00
mvdbeek aaaf7b50a7 Enable conda_auto_init and conda_auto_install for framework tests 2018-01-17 17:11:41 +01:00
Nicola Soranzo 2cd95c48f6 Fix import order everywhere
- Add flake8-import-order to flake8 Pipfile and remove py27-lint-imports
  and py27-lint-imports-include-list tox envs
- Fix most E201 and E202 errors reported by flake8-import-order v0.15,
  but pin flake8-import-order to v0.14.3 until
  https://github.com/PyCQA/flake8-import-order/issues/123
  is fixed

This let us drop 2 jobs on Travis per each job.
2017-11-14 19:42:39 +00:00
Nicola Soranzo 21b44bf348 Fix all E201 and E202 style errors
using the following command:
```
autopep8 -i -r --exclude $(sed -e 's|^|./|' -e 's|/$||' .ci/flake8_blacklist.txt | paste -sd,) --select E201,E202 .
```
2017-08-17 11:35:39 +01:00
John Chilton a7818e3065 Remove workflow testing stuff in test/functional and references.
There are more fully developed approaches including Planemo and wft4galaxy (https://github.com/phnmnl/wft4galaxy).
2016-12-20 10:29:31 -05:00
John Chilton 82728df155 Replace CasperJS browser tests with Selenium tests.
See documentation added to run_tests.sh. This can be configured to target local web browsers or Selenium remote services as detailed in that script.

Individual tests can be executed with nosetests directly or groups of tests can share a common test Galaxy spin up when using ./run_tests.sh. If GALAXY_TEST_EXTERNAL=<url> is set - it will be respected and Galaxy will not be spun up (remember the URL needs to be reachable from the Selenium server inside the Docker container).

Every test failure writes a current screenshot of Galaxy to database/test_errors.

I will be honest that the desire to move toward selenium is based solely on failing to get the Casper tests to pass consistently due to bugs causing segfaults in the underlying tools (probably casperjs or phantomjs?). Over the past year I have tried multiple versions of dependencies, etc... and it never works out for me. Likewise Martin has never been able to get the tests to run consistently under Jenkins. I don't think Python or JavaScript is inherently better, this wasn't based on a personal preference about what kind of test I want to write.

Despite this being the primary reason, there are clear benefits to Selenium. It tests the actual web browsers we support, generates screenshots, has better documented and more robust tooling, can scale across clusters. Less clear, but certainly still a benefit of being Python based is that it fits with the rest of the test framework more cleanly than CasperJS.

Finally Carl's last words on CasperJS were "Ditch it".

The following specific tests were added or replaced:

- Implemented tour testing via Selenium (walk the two working stock tours and verify elements avaiable and clicks are valid). This is how I discovered #3206.
- Added completely new workflow GUI test (basic creation from URL and in editor).
- Replaced broken CasperJS registeration tests (text and expectations now wrong) with a Selenium variant that works against dev.
- Replaced broken anonymous history CasperJS tests with working Selenium tests.
- Replaced broken upload CasperJS tests with working Selenium tests.
- Replaced history options CasperJS tests with Selenium tests.
- Replaced login CasperJS tests with Selenium tests.
- Replaced history-share-tests.js with test_history_options.py
- Replaced history-panel-tests.js with test_history_panel.py
- Replaced a big part of hda-state-tests.js with test_history_dataset_state.py

I'm confident these utilities represent a sharable and higher-level abstraction around functional testing of Galaxy that can be used outside of Galaxy's testing framework. So a subset of the functional test stuff is in a separate module with minimal dependencies that I intend to make stand alone and pip installable like galaxy-lib.

This module consists of:

- Sizzle stuff in its own package. This code allows Selenium to reason with jQuery selectors instead of vanilla CSS selectors.
- Functionality for creating a Selenium driver and virtual display.
- The ``HasDriver`` mixin - this provides higher level navigation utilities not specifically tied to Galaxy.
- A package with abstractions for navigating Galaxy. This provides a higher-level interfactor for things such as logging in and out, registering a user, navigating menus, fetching Galaxy style tooltips and error messages, and walking Galaxy tours.

In order to demonstrate this new module is useful outside of Galaxy tests - I've included a CLI package to ease building argparse utilities around these abstractions and implemented a simple demonstration script that walks a Galaxy tour and dumps screenshots of Galaxy at each step to a folder. This is more of a demonstration of the utilities than an actual polished end user tool - though it might be helpful in linting and debugging tours.

In the future I hope to extend this scripting to implement

- Periodic deployment testing to ensure things like Jupyter work in production.
- A best practice recipe for Galaxy QA testing by deployers.
- An utility to generate dozens of screenshots of various aspects of Galaxy so we can quickly visually inspect ever part of the GUI before big releases.

xref https://github.com/galaxyproject/starforge/pull/115 xref #1419
2016-11-30 17:44:11 -05:00
Nicola Soranzo 1d17a29c79 Fixes for pycodestyle 2.2.0 2016-11-15 16:56:50 +00:00
John Chilton 7aa2d6840a Implement IntegrationTestCase and EmbeddedPulsarTestCase.
IntegrationTestCases differ from functional tests in that they start up a Galaxy instance configured on a per test class basis - so this new class of "integration tests" can test configuration modalities of Galaxy that cannot be tested with traditional Galaxy functional tests.
2016-04-04 20:08:55 -04:00
John Chilton 05a2f44126 Separate different style Galaxy testing behaviors into classes. 2016-03-29 08:04:28 -04:00
John Chilton 6faef4df2e Introduce a TestDriver class to reduce duplication between test drivers.
Classes allow de-duplicating logic and state organization in a different way than methods. Use a common setup, run, tear down paradigm for these tests.
2016-03-29 08:04:28 -04:00
John Chilton eac6c10ec9 Allow running Galaxy tests on an existing external instance. 2016-03-29 08:04:27 -04:00
John Chilton 915b7edcb7 Unify and simplify script driver argument processing. 2016-03-29 08:04:27 -04:00
John Chilton fc1861c4d9 Move "with framework test tools" logic out of nose driver and into run_tests. 2016-03-29 08:04:27 -04:00
John Chilton 8fdecbb3bf Another simplifcation to method structure in scripts/functional_tests.py. 2016-03-29 08:04:27 -04:00
John Chilton 93cfdff910 Eliminate last custom config value setup in scripts/functional_tests.py...
... outside of driver_util. So now we can just use the driver_util config object.
2016-03-29 08:04:27 -04:00
John Chilton 586fa6801b Move yet more logic into driver_util to reduce driver method for scripts/functional_tests.py. 2016-03-29 08:04:27 -04:00
John Chilton e1aa0b3acc Simplify/unify tool conf handling logic across two driver util... 2016-03-29 08:04:27 -04:00
John Chilton f3c757ff1c Move more galaxy config into driver_util...
Handle logging and enabling of beta formats consistently across driver scripts.
2016-03-29 08:04:26 -04:00
John Chilton a8033a543b Move galaxy test data manager setup logic into driver_util. 2016-03-29 08:04:26 -04:00
John Chilton 3546bdf22b Cleanup Galaxy tempdir handling in driver util. 2016-03-29 08:04:26 -04:00
John Chilton 362194b2c0 Cleanup logic for GALAXY_TEST_TMP_DIR add docs. 2016-03-29 08:04:26 -04:00
John Chilton 3c72c2129b Move data_manager_config_file setup into driver_util.
Seems it doesn't hurt tool shed tests to configure this.
2016-03-29 08:04:26 -04:00
John Chilton 1b80e6e8d1 Move another galaxy config (clean up job) into driver_util. 2016-03-29 08:04:26 -04:00
John Chilton 5b826a0839 Move more galaxy config logic into driver_util.
This time for galaxy master API key.
2016-03-29 08:04:26 -04:00
John Chilton 65806641c1 Simplify(?) tool data table config logic at lest in scripts/functional_tests.py. 2016-03-29 08:04:25 -04:00
John Chilton d657855b7f Remove unused test_conf variable. 2016-03-29 08:04:25 -04:00
John Chilton 3c47105732 Fix shed tool test file shed_tools_dict handling.
Instead of writing it below GALAXY_ROOT (which it shouldn't do at all) - add to the temp directory managed for the test so that special clean up logic isn't required for it. The global switch GALAXY_TEST_NO_CLEANUP can be used to recover the state of this file if needed now also.
2016-03-29 08:04:25 -04:00
John Chilton 671b6933dd De-duplicate test driver logic for closing apps and stopping severs... 2016-03-29 08:04:25 -04:00
John Chilton 0f36229400 Unify and simplify configuration and launch of test web servers.
- Sync up the logic for reading and setting GALAXY_TEST_HOST, GALAXY_TEST_PORT, TOOL_SHED_TEST_HOST, and TOOL_SHED_TEST_PORT.
 - Setup one high level method for taking a Galaxy-style "app" and creating a webapp from a factory method and then launching a paste server for that entity respecting the above variables.
2016-03-29 08:04:25 -04:00
John Chilton ee537a119b Restructure to simplify the main() in scripts/functional_tests.py.
Previously this was entering a conditional on the same condition twice. This simplifies this to just do that once and makes the galaxy and tool shed driver code look more similar with respect to launching a Galaxy webapp.
2016-03-29 08:04:25 -04:00
John Chilton ecbb732665 Move construction of test driver app objects into driver_util.
This de-duplicates some of the Galaxy stuff and makes the tool shed stuff look very uniform.
2016-03-29 08:04:25 -04:00
John Chilton ec0a123849 Unify and simplify how Galaxy is launched across test drivers. 2016-03-29 08:04:24 -04:00
John Chilton 2729699bf6 Further unification of how to setup Galaxy databases for testing.
Reuse setup_galaxy_config for this task.
2016-03-29 08:04:24 -04:00
John Chilton fe460008fa More work on syncrhonized test database configuration...
for test drivers.
2016-03-29 08:04:24 -04:00
John Chilton 528b74ca1e Remove unused test job conf stuff.
Not that this wouldn't be useful - it would be but it wasn't wired up to do anything currently.
2016-03-29 08:04:24 -04:00
John Chilton be0107b620 Simplify test tool_data_table_config logic.
Added with https://github.com/galaxyproject/galaxy/commit/246ea04cc7ee1d0d470a514302bf2623f845ed8f.
2016-03-29 08:04:24 -04:00
John Chilton 651b91248b Restructure scripts/functional_test.py's main() to reflect recent simplifications. 2016-03-29 08:04:24 -04:00
John Chilton e7b5293534 Refactor toolbox hacks used by installed and migration tool tests out...
into driver_util. This greatly simplifies the code structure of scripts/functional_tests.py's main method.

Add description of GALAXY_TEST_SHED_TOOL_CONF and some documentation to all of this.
2016-03-29 08:04:24 -04:00
John Chilton d03651f4ef Move more shared galaxy configuration into driver_util. 2016-03-29 08:04:24 -04:00
John Chilton 6b278478d3 Move tool_path logic into setup_galaxy_config. 2016-03-29 08:04:23 -04:00
John Chilton 5af770972d Fix naming and comment best practices for test driver scripts. 2016-03-29 08:04:23 -04:00
John Chilton dcbdcbe081 Unify tool dependency dir handling between test driver scripts. 2016-03-29 08:04:23 -04:00
John Chilton e309c7f6eb Make XXX_TEST_DBPATH and XXX_TEST_DB_TEMPLATE generic and shared with shed.
Now the variable TOOL_SHED_TEST_DB_TEMPLATE works as one might expect like GALAXY_TEST_DB_TEMPLATE.
2016-03-29 08:04:23 -04:00
John Chilton ec3f0506c9 Remove unused config variable from test drivers. 2016-03-29 08:04:23 -04:00
John Chilton a18cbd5930 De-duplicate test driver - move more Galaxy config into common method. 2016-03-29 08:04:22 -04:00