sisyphus inspiration - magento...tests should be independent from each other full test suite should...
TRANSCRIPT
![Page 1: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/1.jpg)
![Page 2: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/2.jpg)
Sisyphus Inspiration
![Page 3: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/3.jpg)
Tests should be independent from each other
Full test suite should run as quickly as I want
Maintaining tests should be easy and cheap
Tests should be stable, robust and [here your next lovely buzzword]
… and it would be really better if we wouldn’t require them at all!
![Page 4: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/4.jpg)
“A dream you dream alone is only a dream.
A dream you dream together is reality.”
John Lennon
![Page 5: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/5.jpg)
Reality
Extremely Extensible
Core
Continuously Changing Business
Modular Platform
Multi - Language
- Theme
- Website
- Tenant
![Page 6: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/6.jpg)
Dreams
$superF = new SuperFramework();
$superF->Ineed(‘result’);
$superF->toGo(‘start’);
$superF->andClick(‘whatever’);
$superF->andDo(‘something’);
$superF->andClick(‘done’);
$superF->andGet(‘success’);
![Page 7: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/7.jpg)
Top Layer
• BDD
• Code Generators
Mid Layer
• Framework
Low Layer
• PHPUnit
• Selenium
More DECLARATIVE
More IMPERATIVE
?
![Page 8: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/8.jpg)
MTF Components
System Under Test Direct Access
Handlers
Fixtures (and Repositories)
Selenium Driver
Page Objects (Pages, Blocks, Elements)
Test Cases (Pre-conditions, Scenario, Constraints)
Tools and Utils
![Page 9: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/9.jpg)
Low Layer
![Page 10: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/10.jpg)
Test Cases
/**
* Run create product test
*
*/
public function testCreate(CatalogProductSimple $product, CatalogCategory $category)
{
$this->productGridPage->open();
$this->productGridPage->getProductBlock()->addProduct($product->getTypeId());
$productBlockForm = $this->newProductPage->getForm();
$productBlockForm->fillProduct($product, $category);
$this->newProductPage->getFormAction()->save();
}
![Page 11: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/11.jpg)
Page Objects namespace Magento\Mtf\Test\Page\Area;
use Mtf\Page\Page;
class TestPage extends Page
{
const MCA = 'testPage';
protected $_blocks = [
‘rootBlock' => [
'name' => ‘rootBlock',
'class' => 'Magento\Mtf\Test\Block\RootBlock',
'locator' => 'body',
'strategy' => 'tag name'
]
];
public function getRootBlock()
{
return $this->getBlockInstance(‘rootBlock');
}
}
<page mca="testPage">
<block>
<name>testBlock</name>
<class>Magento\Mtf\Test\Block\TestBlock</class>
<locator>body</locator>
<strategy>tag-selector</strategy>
</block>
</page>
![Page 12: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/12.jpg)
Constraints namespace Magento\Mtf\Test\Constraint;
use Mtf\Constraint\AbstractConstraint;
use Magento\Mtf\Test\Page\Area\TestPage;
use Magento\Mtf\Test\Fixture\Test;
class PageOpenSuccess extends AbstractConstraint
{
protected $severeness = 'low';
public function processAssert(TestPage $page, Test $fixture)
{
//
}
public function toString()
{
//
}
}
<constraint>
<pageOpenSuccess module="Magento_Mtf">
<severeness>low</severeness>
</pageOpenSuccess>
</constraint>
![Page 13: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/13.jpg)
Fixtures namespace Magento\Mtf\Test\Fixture;
use Mtf\Fixture\InjectableFixture;
class Test extends InjectableFixture
{
protected $fieldName = [
'attribute_code' => 'code',
'frontend_input' => 'input_type',
'frontend_label' => 'Label'
];
public function getFieldName()
{
return $this->getData('fieldName');
}
}
<fixture>
<fixtureName module="Magento_Mtf">
<fields>
<fieldName>
<attribute_code>code</attribute_code>
<frontend_input>input_type</frontend_input>
<frontend_label>Laber</frontend_label>
</fieldName>
</fields>
</fixtureName>
</fixture>
![Page 14: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/14.jpg)
Repositories namespace Magento\Mtf\Test\Repository;
use Mtf\Repository\AbstractRepository;
class TestRepository extends AbstractRepository
{
public function __construct()
{
$this->_data[‘identifier_value_1'] = [...];
$this->_data['didentifier_value_2'] = [...];
}
}
<fixture>
<fixtureName module="Magento_Mtf">
<type>blank|flat|eav</type>
<entity_type>entity_type_code</entity_type>
<collection>Resource Collection</collection>
<identifier>Unique Field/Attribute Name</identifier>
<fields>
<…>
</fields>
</fixtureName>
</fixture>
![Page 15: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/15.jpg)
Low Layer
Mid Layer
![Page 16: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/16.jpg)
Application Sates Iterator
Feature #17
Test Cases Iterator
Configuration Profile #1
Configuration Profile #2
Configuration Profile #3
Configuration Profile #4
Configuration Profile #n
Dataset #1
Dataset #2
Dataset #3
Dataset #4
Dataset #n
Test Case Scenario
Constraints
![Page 17: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/17.jpg)
Low Layer
Mid Layer
Top Layer
![Page 18: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/18.jpg)
![Page 19: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/19.jpg)
Low Layer
Mid Layer
Top Layer
![Page 20: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/20.jpg)
good things
Parallel Execution
Test Isolation Levels
Test Runners and Iterators
Event Manager
Logging and Reporting
Sample Database Management Tool
![Page 21: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/21.jpg)
“I dream my painting and I paint my dream.”
Vincent van Gogh
![Page 22: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/22.jpg)
VS
![Page 23: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/23.jpg)
Magento Testing Framework The testing framework that does speak Magentish
![Page 24: Sisyphus Inspiration - Magento...Tests should be independent from each other Full test suite should run as quickly as I want Maintaining tests should be easy and cheap Tests should](https://reader033.vdocuments.site/reader033/viewer/2022051903/5ff4ab9ad2530b73911251a1/html5/thumbnails/24.jpg)
Q&A Q&A Q&A
Magento Testing Framework Guidelines
Developer's Guide / Testing
magento/mtf magento/magento2