@kfirba Here goes.
- Its the paths to where your feature files are kept. See docs: http://behat.readthedocs.org/en/v3.0/guides/5.suites.html
- Like this: http://d.pr/i/1jqzs/4iqA3Yk5 (new project being setup)
- See screenshot above.
- Domain can be both functional and acceptance. You can always tag a scenario as acceptance so to skip them or just run them. See Jeffery latest video on Mailtrap to see how
- UI tests are fully outside in and most likely all if them would be acceptance tests.
- As per my first reply by having one feature for multiple contexts (ui, domain) give's you the ability to test in two ways. Let me share simple code below.
ie, Let say we have a feature where a person can search for a product on your site.
Feature would be something like. (product_search.feature)
Feature: Search For a Product
In order to find a product
As a customer
I need to be able to perform a product search
Scenario: Perform a search to find the product I need
Given there is a product named "Basket Ball"
When I perform a search for the term "basket"
Then I should see a product called "Basket Ball"
So this works well as I can do this by domain first. Here is a very brief example
DomainContext.php
use .........
use PHPUnit_Framework_Assert as PHPUnit;
use Laracasts\TestDummy\Factory;
/**
* Defines application features from the specific context.
*/
class DomainContext implements Context, SnippetAcceptingContext
{
use DispatchesCommands, Migrator, DatabaseTransactions;
protected $product;
protected $result;
public function __construct(){}
/**
* @Given a product named :arg1
*/
public function aProductNamed($name)
{
$this->product = Factory::create('App\Product', ['name' => $name]);
}
/**
* @When I perform a search for the term "term"
*/
public function iPerformASearchForTheTerm($term)
{
$request = Request::create('/', 'POST', ['term' => $term]);
$this->result = $this->dispatchFrom(SearchProductCommand::class, $request); // Using Commands :-)
}
/**
* @Then I should see a product called :arg1
*/
public function iShouldSeeAProductCalled($called)
{
PHPUnit::assertEquals($called, $this->result->product->name);
}
}
UserInterfaceContext.php
use .........
use PHPUnit_Framework_Assert as PHPUnit;
use Laracasts\TestDummy\Factory;
/**
* Defines application features from the specific context.
*/
class DomainContext extends MinkContext implements Context, SnippetAcceptingContext
{
use DispatchesCommands, Migrator, DatabaseTransactions;
public function __construct(){}
/**
* @Given a product named :arg1
*/
public function aProductNamed($name)
{
Factory::create('App\Product', ['name' => $name]);
}
/**
* @When I perform a search for the term "term"
*/
public function iPerformASearchForTheTerm($term)
{
$this->visitPath('search');
$this->fillField('term', $term);
$this->pressButton('Search');
}
/**
* @Then I should see a product called :arg1
*/
public function iShouldSeeAProductCalled($name)
{
$this->assertResponseContains($name);
}
}
See how one feature can test multiple contexts. These are of course not full versions as you would be adding more assertions etc but hopefully give you an idea of how this works.
Hope this helps. You can mark as answered if you like :-)