Integration tests for CGI.markdown.rex.
These tests exercise the CGI pipeline end-to-end via Apache + curl: they
start an HTTP request, pass it through Apache to the CGI handler, and
verify the generated HTML output.
Unlike the unit tests in suites/, these tests are
not run by RunTests.rex — they require a
running Apache instance with the CGI pipeline configured.
cgid and actions
modulesOn Debian/Ubuntu:
apt-get install -y apache2 pandoc
a2enmod cgid actions
Create /etc/apache2/sites-available/rexx-cgi.conf
(adjust DocumentRoot and paths to match your project
location):
<VirtualHost *:80>
DocumentRoot /path/to/project
<Directory /path/to/project>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ScriptAlias /cgi-bin/ /path/to/project/cgi/
<Directory /path/to/project/cgi>
Options +ExecCGI
AllowOverride None
Require all granted
SetHandler cgi-script
</Directory>
Action Markdown /cgi-bin/cgi-wrapper.sh
<FilesMatch "\.(md|rex|cls)$">
SetHandler Markdown
</FilesMatch>
</VirtualHost>The wrapper script cgi/cgi-wrapper.sh sets
REXX_PATH and invokes the CGI handler:
#!/bin/bash
export REXX_PATH="/path/to/project/cgi:/path/to/project/bin"
exec rexx /path/to/project/cgi/CGI.markdown.rex "$@"Enable the site and start Apache:
a2dissite 000-default
a2ensite rexx-cgi
chmod +x /path/to/project/cgi/cgi-wrapper.sh
chmod +x /path/to/project/cgi/CGI.markdown.rex
apachectl start
Note: .rex and .cls are included in
FilesMatch so that view=highlight works for
Rexx source files.
With Apache running:
cd tests
PATH="framework:cgi:../bin:$PATH" rexx cgi/CGI.testGroup
The tests use http://127.0.0.1 as the base URL (not
localhost, to avoid DNS/proxy issues). The base URL is set
via the class-level baseURL attribute, initialized in
activate.
All fixtures are in fixtures/:
| File | Purpose |
|---|---|
basic.md |
Simple Markdown, no YAML front matter |
with-yaml.md |
YAML: language, highlight-style, section-numbers |
docclass-article.md |
docclass: article in YAML |
rexx-code.md |
Fenced code block with Rexx source |
hello.rex |
Rexx source file for view=highlight tests |
CGITestCase.cls extends
ooTestCase with:
httpGet(url) — performs an HTTP GET
via curl, returns a Directory with status (HTTP status
code) and body (response text).assertContains(text, substring, label)
— asserts that text contains substring
(caseless).assertNotContains(text, substring, label)
— asserts that text does not contain substring
(caseless).