Test Center as backend service

This section shows examples of how to start Test Center as a Windows service, how to integrate Test Center in an existing Web service, and how to set up and/or enable HTTPS access to Test Center.

Configure the Test Center TCP listen port in the application.ini file located in config directory. The option is ListenPort. Its value may also be a unix domain socket. For example, ListenPort=unix:/tmp/testcenter.

Test Center as Windows service

To start Test Center as a Windows service, install the service by entering the following command on the command line:

bin\testcenter service-install

Note: This might require elevated privileges to work without errors.

Now you can start the service in the Services panel from Windows. If the service fails to start, Test Center will output information in the Event log of Windows.

You can stop the Test Center service in the Services panel.

To uninstall the service, enter the following command:

bin\testcenter service-uninstall

Apache Reverse Proxy example

Here is an example of Reverse Proxy using an Apache Web server. The modules mod_proxy and mod_proxy_http must be enabled:

cd mods-enabled/
ln -s ../mods-available/proxy.load .
ln -s ../mods-available/proxy_http.load .
ln -s ../mods-available/proxy_wstunnel.load .
ln -s ../mods-available/rewrite.load .

The following VirtualHost configuration forwards requests to Test Center's default port on the same host, 8800:

<VirtualHost _default_:443>
        ProxyPass        / http://localhost:8800/ connectiontimeout=600 timeout=600
        ProxyPassReverse / http://localhost:8800/
        ProxyPreserveHost On
        ProxyRequests Off
        RewriteEngine on
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteCond %{HTTP:Connection} upgrade [NC]
        RewriteRule ^/?(.*) "ws://localhost:8800/$1" [P,L]
        SSLEngine on
        SSLCertificateFile    your-crt-file.crt
        SSLCertificateKeyFile your-key-file.key
</VirtualHost>

To serve Test Center with a relative path, say under /jellyfish/, the URLs from the Web application need to be adjusted. In application.ini, set the option UrlRootPath in group TestCenter to /jellyfish/. The following VirtualHost configuration forwards requests to Test Center's default port on the same host, 8800, by rewriting the path:

<VirtualHost *>
        ProxyPass /jellyfish/ http://localhost:8800/
        <Location /jellyfish/>
        ProxyPassReverse /
        </Location>
        ProxyRequests Off
        RewriteEngine on
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteCond %{HTTP:Connection} upgrade [NC]
        RewriteRule ^/jellyfish/(.*) "ws://localhost:8800/$1" [P,L]
</VirtualHost>

Hitch TLS Proxy

Below is a configuration of the Hitch proxy server, which can be used as an SSL frontend for Test Center.

frontend = {
    host = "*"
    port = "443"
}
backend = "[127.0.0.1]:8800"
pem-file = "your-pem-file.pem"

Authentication proxy setup

Test Center can be set up to relinquish authentication to an authentication proxy. The Test Center authentication support was developed for the OAuth2 Proxy. Even when using an authentication proxy, users will be required to create accounts on Test Center, but they will not need to enter their Test Center credentials.

Warning: When you use an authentication proxy, you need to make sure that the /login endpoint of your Test Center instance can only be accessed via the authentication proxy.

To activate the authentication proxy support, edit the application.ini file located in /testcenter/config. Set Enable.Proxy to true. Use the Header.Name setting to specify which HTTP Header sent by the authentication proxy will contain the email address of the authenticated user. In the example below, it is X-Forwarded-User.

Note: The authentication proxy must forward user email addresses and not account names or aliases, since Test Center only knows about email addresses.

[ProxyAuth]
# When enabled login is limited to requests coming from the authentication proxy
Enable.Proxy=true

# HTTP header name set by the proxy that will contain the E-Mail of the
# authenticated user
Header.Name=X-Forwarded-User

# Use this to specify the logout URL of your authentication proxy. If the
# authentication proxy support is enabled and Logout.Url is not set, then
# the logout link in the user menu is hidden, as the default logout procedure
# is incompatible with authentication proxies
# Logout.Url=http://auth.company.com/oauth2/sign_out

When using an authentication proxy, the default logout mechanism of Test Center does not work. Therefore, the logout option will be hidden from the user menu, unless you specify the Logout.Url setting, which should point to the logout endpoint of the authentication proxy you are using.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results