thekid/rfc — Issue #169: RFC 0169: New package unittest.web
Author: thekid
Created: 2011-10-09 15:33:21+00:00
State: closed
Labels: implemented, rfc

Scope of Change
====
A new package "unittest.web" will be created. It will contain the base
class "WebTestCase" with which web tests can be written.

Rationale
====
Integration testing.

Functionality
====
As with regular unittests, web tests are created by extending a base class,
in this case `unittest.web.WebTestCase`.

Example
----

```php
beginAt('/xml/home');
$this->assertStatus(HTTP_OK);
$this->assertTitleEquals('XP Technology');
$this->assertTextPresent('Credits');
}
}
?>
```

Assertion Methods
----
In addition to the assertion methods from the `unittest.TestCase`
class (which the WebTestCase class extends), the following assertion
methods are available:

```php

```

Navigation
----
To follow links inside a page, a web test can utilize the click methods:

```php

```

Forms
----
To work with forms, the `getForm()` method can be used:

```php
beginAt('/xml/home');
$form= $this->getForm();
$form->getField('query')->setValue('Unittest');
$form->submit();
$this->assertStatus(HTTP_OK);
$this->assertTitleEquals('Search for "Unittest" - XP Framework');
}
}
?>
```

Security considerations
====
n/a

Speed impact
====
No existing infrastructure is changed, thus none.

Dependencies
====
xp-framework/rfc #162 (implemented)

Related documents
====
* http://experiments.xp-forge.net/xml/browse?arena,webtest - Experiment

Comments
====