You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Heavily inspired by capybara [capybara](https://github.com/jnicklas/capybara). Using the [spiderling](https://github.com/OpenBuildings/spiderling) package to the fullest. It gives you the ability to quickly write integration test with powerful DSL and choose between different drivers with different combinations of features and performance - e.g. selenium, phanomjs or raw php with curl.
8
+
Heavily inspired by capybara [capybara](https://github.com/jnicklas/capybara). Using the [spiderling](https://github.com/OpenBuildings/spiderling) package to the fullest. It gives you the ability to quickly write integration test with powerful DSL and choose between different drivers with different combinations of features and performance - e.g. phanomjs or raw php with curl.
9
9
10
10
Example Test:
11
11
@@ -112,7 +112,7 @@ use Openbuildings\PHPUnitSpiderling\TestCase;
112
112
class SpiderlingTest extends TestCase {
113
113
114
114
/**
115
-
* @driver selenium
115
+
* @driver simple
116
116
*/
117
117
public function test_sample()
118
118
{
@@ -130,46 +130,12 @@ class SpiderlingTest extends TestCase {
130
130
}
131
131
```
132
132
133
-
You can have different drivers for each test, the available ones are: ``simple``, ``kohana``, ``selenium`` and ``phantomjs`` - where the default driver is ``simple``. Each driver is loaded with the default configuration, but you can change it by modifying the appropriate method that loads the driver
133
+
You can have different drivers for each test, the available ones are: ``simple``, ``kohana`` and ``phantomjs`` - where the default driver is ``simple``. Each driver is loaded with the default configuration, but you can change it by modifying the appropriate method that loads the driver
134
134
135
135
- driver_simple() - will return Driver_Simple object
136
136
- driver_kohana() - will return Driver_Kohana object
137
-
- driver_selenium() - will return Driver_Selenium object
138
137
- driver_phantomjs() - will return Driver_Phantomjs object
139
138
140
-
It is recommended that you create a base TestCase class in your tests if you want to extend these methods and have your relevant class extend that class for example if we had selenium running on a different server than localhost we might do something like this:
141
-
142
-
```php
143
-
use Openbuildings\PHPUnitSpiderling\TestCase;
144
-
use Openbuildings\Spiderling\Driver_Selenium;
145
-
use Openbuildings\Spiderling\Driver_Selenium_Connection;
146
-
147
-
abstract class TestCase_Selenium extends TestCase {
148
-
149
-
public function driver_selenium()
150
-
{
151
-
$connection = new Driver_Selenium_Connection('http://selenium-server.example.com/web/hub/');
152
-
return new Driver_Selenium($connection);
153
-
}
154
-
}
155
-
```
156
-
157
-
And then you would:
158
-
159
-
```php
160
-
161
-
class IntegrationTest extends TestCase_Selenium {
162
-
163
-
/**
164
-
* @driver selenium
165
-
*/
166
-
public function test_sample()
167
-
{
168
-
// ...
169
-
}
170
-
}
171
-
```
172
-
173
139
## Save on failure
174
140
175
141
There is a special testcase listener class included that saves the state of the test when there is a failure, and saves it as an html page for ease referance later. This is the ``Saveonfailure`` class. In order to use it, you'll need to modify your phpunit.xml like this:
0 commit comments