Translated using Weblate (Slovenian)
[phpmyadmin.git] / test / README.rst
blob99c838567b2cb1c266d6c74f0b5c6e64954a355e
1 PhpMyAdmin test suite
2 =====================
4 This directory is protected from web visitors by a .htaccess file.
6 For more information on allowing http access to this directory see:
7 https://httpd.apache.org/docs/current/mod/mod_authz_host.html#allow
9 Please visit the wiki for more information on unit testing:
10 https://wiki.phpmyadmin.net/pma/Unit_Testing
12 Selenium tests
13 --------------
15 To be able to run Selenium tests, you need to have webserver, database
16 and Selenium running. Following environment variables configure where
17 testsuite connects:
19 TESTSUITE_USER
20     Username to connect on the interface located at TESTSUITE_URL
21 TESTSUITE_PASSWORD
22     Password to connect on the interface located at TESTSUITE_URL
23 TESTSUITE_DATABASE_PREFIX
24     Database prefix to use for testing (Avoid database grouping characters like _).
25 TESTSUITE_URL
26     URL where tested phpMyAdmin is available.
28 Additionally you need to configure link to Selenium and browsers. You
29 can either setup Selenium locally or use BrowserStack automated testing.
31 For local setup, define following:
33 TESTSUITE_SELENIUM_HOST
34     Host where Selenium is running.
35 TESTSUITE_SELENIUM_PORT
36     Port where to connect.
37 TESTSUITE_SELENIUM_BROWSER
38     Browser to use for testing inside Selenium.
40 With BrowserStack, set following:
42 TESTSUITE_BROWSERSTACK_USER
43     BrowserStack username.
44 TESTSUITE_BROWSERSTACK_KEY
45     BrowserStack access key.
47 For example you can use following setup in ``phpunit.xml``::
49     <php>
50         <env name="TESTSUITE_SERVER" value="localhost"/>
51         <env name="TESTSUITE_USER" value="root"/>
52         <env name="TESTSUITE_PASSWORD" value="root"/>
53         <env name="TESTSUITE_DATABASE" value="test"/>
54         <env name="TESTSUITE_URL" value="http://localhost/phpmyadmin/" />
55         <env name="TESTSUITE_SELENIUM_HOST" value="127.0.0.1" />
56         <env name="TESTSUITE_SELENIUM_PORT" value="4444" />
57     </php>
59 Using BrowserStack
60 ------------------
62 We're using BrowserStack to run our tests on the Travis CI. If you are a team
63 member, you can be granted access to the team account, but you can register own
64 account there as well.
66 To run tests locally, you need to install BrowserStack tool to enable local
67 testing, see their website for instructions:
69 https://www.browserstack.com/local-testing#command-line
71 Following instructions use PHP's built in server for the testing::
73     # Export BrowserStack credentials in the environment:
74     export TESTSUITE_BROWSERSTACK_USER=your_username
75     export TESTSUITE_BROWSERSTACK_KEY=your_key
77     # Port where tests will be running
78     export TESTSUITE_PORT=9000
79     export TESTSUITE_URL=http://127.0.0.1:$TESTSUITE_PORT/
81     # Start PHP built in server
82     php --server 127.0.0.1:$TESTSUITE_PORT > php.log &
84     # Start BrowserStack Local client to forward the traffic
85     ~/browserstack/BrowserStackLocal -localIdentifier Manual "$TESTSUITE_BROWSERSTACK_KEY" 127.0.0.1,$TESTSUITE_PORT,0 &
87     # Stop BrowserStack Local
88     ~/browserstack/BrowserStackLocal --daemon stop