Giter Club home page Giter Club logo

Comments (2)

Hywan avatar Hywan commented on May 27, 2024

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.

icanhazstring avatar icanhazstring commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.