1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-06-05 22:09:38 +02:00

Aggiunta dei test Codeception

This commit is contained in:
Thomas Zilio
2018-08-03 17:19:45 +02:00
parent 263783c25f
commit 32ad29da4b
18 changed files with 206 additions and 0 deletions

5
.gitignore vendored
View File

@@ -84,3 +84,8 @@ files/my_impianti/*
config.inc.php
REVISION
.php_cs.cache
/tests/_log/*
/tests/_temp/*
codeception.yml
!.gitkeep

View File

@@ -134,6 +134,17 @@ Per poter contribuire, si consiglia di seguire le indicazioni descritte all'inte
Le impostazione di base per il codice sono disponibili attraverso [editor config](https://github.com/devcode-it/openstamanager/blob/master/.editorconfig) per l'utilizzo semplificato negli editor più comuni.
Maggiori informazioni sulla configurazione e sul plugin sono disponibili nel sito <http://editorconfig.org>.
Per eseguire i test del progetto è necessario seguire le seguenti istruzioni (https://codeception.com/docs/modules/WebDriver):
- Scaricare (Selenium Server)[https://docs.seleniumhq.org/download/]
- Scaricare (ChromeDriver)[https://sites.google.com/a/chromium.org/chromedriver/getting-started]
- Su Windows, aggiungere l'eseguibile al PATH
- Configurare localmente Codeception nel file `codeception.yml`
- Eseguire da riga di comando:
```bash
npm run tests-server
npm run tests-OSM
```
## Sviluppatori
- **Fabio Lovato**, il fondatore ([loviuz](https://github.com/loviuz))

17
codeception.dist.yml Normal file
View File

@@ -0,0 +1,17 @@
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
actor_suffix: Tester
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
WebDriver:
url: http://localhost/openstamanager
window_size: false # disabled in ChromeDriver
port: 9515
browser: chrome

View File

@@ -49,6 +49,7 @@
"symfony/var-dumper": "^3.3"
},
"require-dev": {
"codeception/codeception": "^2.4",
"friendsofphp/php-cs-fixer": "^2.10"
},
"autoload": {

View File

@@ -38,6 +38,7 @@
"devDependencies": {
"archiver": "^2.0.0",
"cwd": "^0.10.0",
"concurrently": "^3.6.1",
"del": "^2.2.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
@@ -66,6 +67,8 @@
"build-OSM": "gulp",
"dump-OSM": "php composer.phar dump-autoload",
"doc-OSM": "php couscous.phar deploy",
"tests-server" : "concurrently \"java -jar selenium-server-standalone.jar\" \"chromedriver --url-base=/wd/hub\"",
"tests-OSM" : "php codecept.phar run",
"windows-fix": "yarn global add windows-build-tools"
},
"overrides": {

0
tests/_data/.gitkeep Normal file
View File

2
tests/_output/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -0,0 +1,26 @@
<?php
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class AcceptanceTester extends \Codeception\Actor
{
use _generated\AcceptanceTesterActions;
/**
* Define custom actions here
*/
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class FunctionalTester extends \Codeception\Actor
{
use _generated\FunctionalTesterActions;
/**
* Define custom actions here
*/
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Helper;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class Acceptance extends \Codeception\Module
{
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Helper;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class Functional extends \Codeception\Module
{
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Helper;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class Unit extends \Codeception\Module
{
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class UnitTester extends \Codeception\Actor
{
use _generated\UnitTesterActions;
/**
* Define custom actions here
*/
}

2
tests/_support/_generated/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -0,0 +1,11 @@
# Codeception Test Suite Configuration
#
# Suite for acceptance tests.
# Perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.
actor: AcceptanceTester
modules:
enabled:
- WebDriver
- \Helper\Acceptance

View File

@@ -0,0 +1,25 @@
<?php
class LoginCest
{
public function _before(AcceptanceTester $I)
{
}
public function _after(AcceptanceTester $I)
{
}
public function frontpageWorks(AcceptanceTester $I)
{
$I->amOnPage('/');
$I->fillField('username', 'admin');
$I->fillField('password', 'admin');
$I->click('Accedi');
$I->see('OpenSTAManager');
}
}

View File

@@ -0,0 +1,12 @@
# Codeception Test Suite Configuration
#
# Suite for functional tests
# Emulate web requests and make application process them
# Include one of framework modules (Symfony2, Yii2, Laravel5) to use it
# Remove this suite if you don't use frameworks
actor: FunctionalTester
modules:
enabled:
# add a framework module here
- \Helper\Functional

9
tests/unit.suite.yml Normal file
View File

@@ -0,0 +1,9 @@
# Codeception Test Suite Configuration
#
# Suite for unit or integration tests.
actor: UnitTester
modules:
enabled:
- Asserts
- \Helper\Unit