komex / unteist
Unit test framework
Installs: 1 334
Dependents: 1
Suggesters: 2
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
- ext-reflection: *
- ext-spl: *
- monolog/monolog: ~1.7
- sebastian/diff: ~1.1
- symfony/config: ~2.4
- symfony/console: ~2.4
- symfony/dependency-injection: ~2.4
- symfony/event-dispatcher: ~2.4
- symfony/filesystem: ~2.4
- symfony/finder: ~2.4
- symfony/yaml: ~2.4
- twig/twig: ~1.15
Requires (Dev)
- komex/delusion: dev-develop
- phpunit/phpunit: ~3.7
Suggests
- ext-pcntl: Required for run in separate processes.
- ext-posix: The posix PHP extension
- ext-sockets: The sockets PHP extension
- ext-sysvmsg: Required for run in separate processes.
This package is not auto-updated.
Last update: 2024-11-04 14:45:57 UTC
README
#Unteist
Unteist is a unit test framework for developers and testers that makes the writing of tests easy and gets its result more quickly than ever. It does not load all tests collections to memory but does it step-by-step. One process - one test case in memory. You can use up to 10 processes for testing. Framework is more flexible in configuration of tests, test cases and suites than "the de-facto standard for unit testing in PHP projects".
Requirements
- Unteist requires PHP 5.4 (or later).
- (Optional) pcntl module if you want to run tests in multiple processes.
Installation
To add Unteist as a dependency to your project, simply add a dependency on komex/unteist
to your project's composer.json
file. Here is a minimal example of a composer.json
file:
{ "require": { "komex/unteist": "1.0.*" } }
Unteist may generate reports in HTML format. Right now, reports are very simple, but it may be more complex in future. So, framework needs Bootstrap, lessphp and jQuery for working.
Writing tests
You can place your tests in any directory as you wish, but storing it in tests
directory is a good practice.
There is no problems with understanding how to write tests if you have already worked with PHPUnit.
- The tests for a class
Class
go into a classClassTest
. ClassTest
inherits from\Unteist\TestCase
.- The tests are public methods that are named
test*
. Alternatively, you can use the@test
annotation in a method's docblock to mark it as a test method. - Inside the test methods, assertion methods such as
\Unteist\Assert\Assert::equals()
are used to assert that an actual value matches an expected value.
Example
<?php use \Unteist\Assert\Assert; class StackTest extends \Unteist\TestCase { public function testPushAndPop() { $stack = array(); Assert::equals(0, count($stack)); array_push($stack, 'foo'); Assert::equals('foo', $stack[count($stack)-1]); Assert::equals(1, count($stack)); Assert::equals('foo', array_pop($stack)); Assert::equals(0, count($stack)); } }
Features
- Run test cases in separated processes (up to 10 processes per suite);
- Lazy loading test cases to memory. Loads only tests with which we work and frees memory when test case is done;
- Flexible configuration: you are able to change global settings and settings for each suite;
- Multiple dependencies;
- Any methods may be used before and after case or test;
- Test case have two types of data storages:
- local (access only from tests in same case);
- global (shared storage for all cases in single process);
- Project are uses composer and based on PSR-0 standart, uses Symfony components and very simple to extend;
- Register your own listeners, use Unteist events and generate custom reports.
What next
- Store you configuration in different formats (yml, xml, json or all together);
- A lot of new kind of class and methods filters (like namespace filter, mask filter);
- Code Coverage Analysis.
License
Unteist by Andrey Kolchenko is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at https://github.com/komex/unteist.