Comments (2)
you put some CDD assertions with phpdeal (or other tool) and you have some automatic unit tests generated automatically
It's called Contract-based Testing. Learn more by reading some research papers like https://hoa-project.net/En/Literature.html#Research.
I got this idea from the Hoa\Praspel project which is a specification language usable for CDD. It is similar to phpdeal, albeit a bit more potent maybe
Don't want to brag or anything, but Praspel is a specification language based on contract-based testing, which provides 2 main features: It can validate data, and it can generate data. That's the whole point of “realistic domains”, the underlying layer of Praspel. This latter feature is a lot more powerful than phpdeal (sorry, I just want to be factual). It is possible to generate strings based on regex, or grammar (it's called Grammar-based Testing). See https://github.com/hoaproject/Regex or https://mnt.io/2014/09/30/generate-strings-based-on-regular-expressions/ for a more in-depth explanation. Or even binary. Or to generate complex object layout. Or to generate complex arrays with a constraint-based solver. Or to combine all of them!
Unfortunately this idea was not pushed more and the main author of Hoa stopped to work on it.
We tried to promote it in several events, conferences, on Internet, Reddit, Twitter etc etc. Apart from a small groups of brave developers, the PHP community wasn't interested by it. We somehow give up after many years while the technology (Praspel) is awesome, and it has received excellent feedbacks in the research community (3 articles, 1 PhD thesis, 1 journal (!)).
Simply port hoaproject/Contributions-atoum-praspelExtension to phpunit since atoum ... well was not successful
That's a good idea. Side note: atoum is far superior to PHPUnit in many regards, but the PHP community is really polarized, and it's hard to move it forward. Implementing Praspel in PHPUnit is an excellent idea though!
Praspel comes with @invariant
, @requires
(precondition), @ensures
(postconditions), @throws
(postconditions on exceptions), \old(i)
to refer in the post-state to values in the pre-state etc. I think it offers everything you need?
I hope my message doesn't sound too negative. I'm excited to see a new interest in Praspel! And I'm willing to help if you need it :-).
from framework.
Hi. Thanks for the input and the great ideas.
But I think phpdeal is not "source" to put this kind of integration into.
I think of phpdeal as a tool to achieve this kind of implementation.
That said. Building an extension for PHPUnit to support Hoa\Praspel sounds nice. This extension then could use phpdeal to add contract based testing.
from framework.
Related Issues (20)
- [Optimization] Switch from eval to create_function HOT 1
- Request for Documentation/Help to use this library HOT 4
- Defining Expression Handlers HOT 2
- using with PHPUnit HOT 6
- Contract propagation HOT 8
- [Feature] PhpStorm integration HOT 1
- Invariant for magic getters HOT 4
- ZF2 Module HOT 7
- Contract propagation for interfaces HOT 4
- Contributing guide HOT 3
- Library name in Scrutinizer and Packagist HOT 3
- Project status? HOT 4
- Issue with exception display on command line HOT 4
- Issue running PHPUnit with composer HOT 1
- PathResolver' not found HOT 2
- Contract propagation bug? HOT 13
- Violating contracts should throw ContractViolation HOT 1
- Bootstrap from class and run on self HOT 2
- Setup with symfony and better doc HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.