Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
394cceca
Verified
Commit
394cceca
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Document test suite
parent
97e90636
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#337
passed
5 years ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/dev/03_run_tests.rst
+72
-0
72 additions, 0 deletions
docs/dev/03_run_tests.rst
with
72 additions
and
0 deletions
docs/dev/03_run_tests.rst
0 → 100644
+
72
−
0
View file @
394cceca
Running tests and reports
=========================
Running default test suite
--------------------------
The test suite can be run using the `tox` tool::
poetry run tox
Enabling Selenium browser tests
-------------------------------
The test suite contains tests that use Selenium to do browser based tests.
They need to be enabled when running the test suite, which can be done by
setting certain environment variables:
+------------------------+------------------------------------------------------+------------------------------+
| Variable | Meaning | Example |
+========================+======================================================+==============================+
| TEST_SELENIUM_BROWSERS | List of webdrivers to test against, comma-separated. | chrome,firefox |
| TEST_SELENIUM_HUB | Address of Selenium hub if using remote grid | http://127.0.0.1:4444/wd/hub |
| TEST_HOST | Hostname reachable from Selenium for live server | 172.17.0.1 |
| TEST_SCREENSHOT_PATH | Path to directory to create screenshots in | ./screenshots |
+------------------------+------------------------------------------------------+------------------------------+
Selenium tests are enabled if `TEST_SELENIUM_BROWSERS` is non-empty.
To set variables, use env to wrap the tox ommand::
poetry run env TEST_SELENIUM_BROWSERS=chrome,firefox tox
Using a Selenium hub on local Docker host
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
One way to setup Selenium is to use the official images on the local
machine.
First, get Selenium Hub and one or more browser nodes up and running::
docker run -d -p 4444:4444 --name selenium-hub selenium/hub
docker run -d --link selenium-hub:hub selenium/node-chrome
docker run -d --link selenium-hub:hub selenium/node-firefox
After that, you can run the test suite, setting the needed variables to use
Docker Hub::
poetry run env \
TEST_SELENIUM_BROWSERS=chrome,firefox \
TEST_SELENIUM_HUB=http://127.0.0.1:4444 \
TEST_HOST=172.17.0.1 \
tox
The `TEST_HOST` variable is set to the Docker host's IP address, where the
Selenium nodes can access DJango's live server. Django automatically
configures the live server to be reachable if a Selenium hub is used.
Taking screenshots
~~~~~~~~~~~~~~~~~~
The browser test suites automatically take screenshots at certain steps if
enabled in the test run. This can be used to visually verify that views
look like they should or for documentation purposes.
To enable screenshots, add the `TEST_SCREENSHOT_PATH` environment variable
when running the tests.
If runnin multiple browsers, screenshots are placed in separate directories
per browser.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment