Skip to content

Commit

Permalink
Merge pull request #192 from mickaelandrieu/added-smoke-tests
Browse files Browse the repository at this point in the history
Added a section for testing when they migrate a page
  • Loading branch information
Mickaël Andrieu committed Jan 29, 2019
2 parents eb17573 + 40b0e0c commit 83de4e5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
Expand Up @@ -27,6 +27,7 @@ This is the list of items that usually need to be done in order to complete the
- Checks permissions and demo mode constraints
- Re-introduce hooks (and document the missing one if you can't for a good reason)
- Complete `Link` class to map PrestaShop menu to the new page
- Create the smoke/survival tests for the migrated page
- Deletions
- Remove the old controller in `controllers/admin/Admin*.php`
- Remove related old templates (in `admin-dev/themes/default/template/controllers/*`)
Expand Down
Expand Up @@ -10,4 +10,3 @@ Once everything is migrated, refactored, extracted to specific classes and worki
* Delete the old controller.
* Delete the old templates (delete the `admin-dev/themes/default/template/controller/{name}` folder.
* Delete the related "legacy tests".

@@ -0,0 +1,43 @@
---
title: Testing
weight: 70
---

# Testing

You are encouraged to add both unit and functional tests for every new class
you have created.

You **must** add a smoke test (also called "survival") for every new page
you migrate.

## Smoke testing

A smoke test is a really simple and basic test that ensure the page will load with
the right HTTP code. This won't ensure the page will works as expected **but** if the test fails, this ensure the page is not functional.

To add a new test, you need to add a new entry in the Data Provider of SurvivalTest class:

```php
<?php

namespace LegacyTests\Integration\PrestaShopBundle\Controller\Admin;
// ...
/**
* @group demo
*
* To execute these tests: use "./vendor/bin/phpunit -c tests-legacy/phpunit-admin.xml --filter=SurvivalTest" command.
*/
class SurvivalTest extends WebTestCase
{
// [...]

public function getDataProvider()
{
return [
'symfony_route_of_page' => ['Page title', 'symfony_route_of_page'],
// ...
];
}
}
```

0 comments on commit 83de4e5

Please sign in to comment.