Translated using Weblate (Persian)
[phpmyadmin.git] / test / README.rst
blob0913c347bd849014bcd822b903438a57e3c089c3
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/UnitTesting
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_SERVER
20     Database server to use.
21 TESTSUITE_USER
22     Username for connecting to database.
23 TESTSUITE_PASSWORD
24     Password for connecting to database.
25 TESTSUITE_DATABASE
26     Database to use for testing.
27 TESTSUITE_URL
28     URL where tested phpMyAdmin is available.
30 Additionally you need to configure link to Selenium and browsers. You
31 can either setup Selenium locally or use BrowserStack automated testing.
33 For local setup, define following:
35 TESTSUITE_SELENIUM_HOST
36     Host where Selenium is running.
37 TESTSUITE_SELENIUM_PORT
38     Port where to connect.
39 TESTSUITE_SELENIUM_BROWSER
40     Browser to use for testing inside Selenium.
42 With BrowserStack, set following:
44 TESTSUITE_BROWSERSTACK_USER
45     BrowserStack username.
46 TESTSUITE_BROWSERSTACK_KEY
47     BrowserStack access key.
49 For example you can use following setup in ``phpunit.xml``::
51     <php>
52         <env name="TESTSUITE_SERVER" value="localhost"/>
53         <env name="TESTSUITE_USER" value="root"/>
54         <env name="TESTSUITE_PASSWORD" value="root"/>
55         <env name="TESTSUITE_DATABASE" value="test"/>
56         <env name="TESTSUITE_URL" value="http://localhost/phpmyadmin/" />
57         <env name="TESTSUITE_SELENIUM_HOST" value="127.0.0.1" />
58         <env name="TESTSUITE_SELENIUM_PORT" value="4444" />
59     </php>
61 Using BrowserStack
62 ------------------
64 We're using BrowserStack to run our tests on the Travis CI. If you are a team
65 member, you can be granted access to the team account, but you can register own
66 account there as well.
68 To run tests locally, you need to install BrowserStack tool to enable local
69 testing, see their website for instructions:
71 https://www.browserstack.com/local-testing#command-line
73 Following instructions use PHP's built in server for the testing::
75     # Export BrowserStack credentials in the environment:
76     export TESTSUITE_BROWSERSTACK_USER=your_username
77     export TESTSUITE_BROWSERSTACK_KEY=your_key
79     # Port where tests will be running
80     export TESTSUITE_PORT=9000
81     export TESTSUITE_URL=http://127.0.0.1:$TESTSUITE_PORT/
83     # Start PHP built in server
84     php --server 127.0.0.1:$TESTSUITE_PORT > php.log &
86     # Start BrowserStack Local client to forward the traffic
87     ~/browserstack/BrowserStackLocal -localIdentifier Manual "$TESTSUITE_BROWSERSTACK_KEY" 127.0.0.1,$TESTSUITE_PORT,0 &