You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
i asking sorry in case I didnt see the options that enable this feature.
I case its not my mistake can behat show codecoverage, in clover format?
Is there a way to integrate behat with phpunit?
Behat does not know about the way the logic is implemented to achieve the behavior so it would be rather hard. When using Mink for instance, it does an HTTP request to a website and tests the output. It has no way to know what has been executed. It could even run on a separate machine (see the demo testing wikipedia for instance)
*.feature files are not tests. It's your project features descriptions. And Behat just gives you a way to describe (with step definitions) how to automatically check whether or not those features are implemented/finished/works.
Code coverage is nonesense for StoryBDD and Behat especially, cuz we're not talking bout code at all. And feature coverage is impossible till someone invents human-mind-(reading|parsing) software for machines :-)
@Daniel15 the issue is that you could get the code coverage of your step definition, not of your application. Mink does HTTP requests to your applications, so it does not have access at all to the logic in it to get code coverage (it does not even know that the application itself is written in PHP)
@stof In some situations, that would be okay. Using Mink is just one way to do testing with Behat. In my case, I'm directly interacting with PHP objects in the step definitions, so getting the code coverage of the step definitions would work fine. Specflow's (similar to Behat or Cucumber but for .NET) approach is to wrap a unit test around each scenario, so tests are just run with a regular unit test runner instead of a specific runner (like Behat), and standard code coverage tools can be used.
Seriously, you're trying to achieve wrong thing here. Behat tests your *.feature files (that your features requirements are achieved), not your code. That's where its name coming from, btw (BEHAvior Tester).
Code coverage is controversial idea and code coverage for StoryBDD framework is just nonsense. If you're doing code testing with StoryBDD - you're doing it wrong.
Scenario: Basic additionGiven a new calculator
When I add 1 and 1
Then the result should be 2
They're both doing the exact same test, except one is written as a scenario instead of a "traditional" unit test. The top one is probably what you'd do when using TDD, whereas the bottom one could be what you do when following BDD> In the end, they're testing the exact same thing.
I don't care about code coverage as a number, I just think getting a coverage report is useful to determine whether my scenarios are comprehensive, and which scenarios I'm missing. From what I know, BDD essentially extends TDD by adding test cases written in a natural language. And guess what TDD involves? Unit testing. And guess what people often do with unit tests? Generate code coverage reports. I really don't think it's nonsense.
Are you saying that Specflow is "doing it wrong" as well? They create unit tests based on the feature files (which could be used for unit tests, or functional tests, or whatever you want). And I'm sure that Cucumber promotes the same thing - They show writing of code that directly interacts with Ruby objects.
In best case, you should use both techniques with or without specific tools for them. But using StoryBDD tool for SpecBDD or vise versa is worst idea you could ever make for your development flow.
Behat isn't a SpecBDD tool, it wasn't been created and highly inefficient as such. Behat is a StoryBDD tool. Although you could use same testing code or assertions behind both, approaches are completely different. And if in one case code coverage might have any sense (SpecBDD) for another (StoryBDD) it's completely nonsense.
Reacted by Daniel Gustaw, Adam Östör, Thomas Citharel, Mohammad Mehdi Habibi and Benjamin ROTHAN
In best case, you should use both techniques with or without specific tools for them. But using StoryBDD tool for SpecBDD or vise versa is worst idea you could ever make for your development flow.
Why? What disadvantages does using Behat, Specflow or Cucumber for SpecBDD have? I've seen lots of people do it before.
In best case, you should use both techniques with or without specific tools for them. But using StoryBDD tool for SpecBDD or vise versa is worst idea you could ever make for your development flow.
Why? What disadvantages does using Behat, Specflow or Cucumber for SpecBDD have? I've seen lots of people do it before.
StoryBDD is specifying how your feature works, SpecBDD is specifying how you classes will achieve that. SpecBDD frameworks are designed to achieve just that so, in principle, they should do that part better. A SpecBDD framework is much more like a unit test framework, mirroring you project class files, so it communicates better which part of the code you are testing. With a StoryBDD you want to know which features you are testing, and they are great for that.
So apart from improving the "test as documentation" part, using the right tool at each level also gives you a better design perspective. A StoryBDD framework implements the focus on the user part of BDD. That focus is carried down to your classes using A SpecBDD framework. The language is their to help you focus on what matters most. Unit Tests frameworks language put the focus on verification rather than specification, which leads to bad tests in the end, as in tests focused on structure, not behaviour. In Cucumber you can still use BDD expectations to keep the focus on behaviour, and I use them in Behat myself, even when I am writing feature focused step definitions - I have a SpecContext I use for that, so I can say e.g. $output->should->be('Chuck Norris') as opposed to $this->assertEquals($output, 'Chuck Norris'). But that's just really because I am a bit too crazy about BDD.
BDD was created to teach developers putting their focus on what matters most while writing tests. In 1999 a ATDD framework was created (which is like a StoryBDD framework) by Ward Cunningham. Ward is a big part of the XP community, do you can see how important it is to have that. That didn't stop him using sUnit for his Smalltalk code. We are running the StoryBDD tool as well and that is telling us what is the next class to Spec.
@Daniel15 main disadvantage about using StoryBDD for writing code specs exists because SpecBDD and StoryBDD operate on absolutely different levels of abstractions.
In StoryBDD, you're forming (creating) domain dictionary by exploring business requirements and added values of the features. This dictionary (you could think - step definitions) is undefined at the beginning of the project and different from area to area. It means, that for every project (and event for most roles inside this project), you should create your own set of language (step definitions), that you will use to describe project domain. And StoryBDD gives you ability to do exactly that - create new dictionaries, explore domain area and expose business values of the features.
In SpecBDD there's only one possible domain language - language of objects and their relations. Language on which you're already writing your code. "This object should be created and this object should be provided as argument". That's why all SpecBDD frameworks are using syntax of language on which they were written - because that's the way your objects (domain) talk in the system.
Now, let's see how using wrong tool for the job could ruin your flow:
Using SpecBDD tool for StoryBDD. You'll pretend, that you're talking with business people, but doing it using language which is irrational and not readable to any person outside technical world. Most likely, you'll finish with scenarios or specifications, that will be both unreadable by business people and unmaintainable by developers:
<?php// this code is fictional, but could easily become reality// if you're using wrong tools for the job$msg = $this->getConfiguration()->get('test_email');
$story->Given()->I->sendEmail('tester', $msg);
$story->Then()->getUser('tester')->should()->recieve($msg);
Using StoryBDD tool for SpecBDD. You'll try to describe purely implementational (code) details in the tool, that aims on easing exploration of new domains. But in your case (code specs), domain is already known - it's programming language you're using. So, most likely, you'll finish with bloated feature suite and step definition dictionary, that will tend to solve only one thing - recreating your programming language syntax and logic with regular expressions:
# this step is fictional, but could easily become reality# if you're using wrong tools for the jobGiven I instantiate "Daniel15\Entity\TopicMessage" with:
| author | hi |
Both those types of tests share same big problem - after month of active development, they'll become umaintainable, unusable and, finally, abandoned. Just because they will not be able to solve problems they tended to solve - easing development and communications.
@srcspider yes, I noticed that. Let's just leave it then. BDD was created as a training tool, anyway. Should the guys start coming up with the code coverage discussion again, we can always instruct them with a better perspective.
for the case on phpspec i also thought this held, however someone respectable came up with an extension to do code coverage in phpspec, at first I thought it was a bad idea, but then i realized some use cases or in some flows it made sense. Not sure it is the case of behat, but who knows. Sometimes tools find different use cases, even if it is not the former one. So with care, let's say that is not the best idea for behat right now.
@MarcelloDuarte it's hard to force a perspective on someone that is working under different circumstances to you. The loudest of us almost always point out the most idealistic circumstances, but that doesn't necessarily apply to all users. Some people have higher time constraints, work in smaller teams etc. Just like with choosing hardware there are different metrics and views. Personally even when I use code coverage I almost never look at it as more then a rough statistic (essentially no better then what you all are describing a behat coverage would be) that I use (among other things) to base a rough judgement on how stable/usable/etc my piece of code is. (I know that's now how everyone else does it; unless I'm mistaken a lot of people use it as a "I'm done" indicator.) Since for me it's just a statistic it's not like I have any "forgone conclusions about it," if it ends up being useless at times that's perfectly fine, because it's really cheap to do (or at least would be with a no-extra-knobs implementation).
@srcspider Yes! It is really cheap to implement this. There is nothing preventing a feature like that to be coded as an extension, like @everzet suggested. Plus Sebastian has nicely separated the code coverage component from PHPUnit, so it can be reused in situations like this. It's a really easy task to get an extension up and running for this. If someone has a use case for this, we can support with pointers on how to implement – probably better on IRC. In core we keep the tool a bit more focused, because it is also a goal of the BDD tools to educate users in the right way to do TDD.
@MarcelloDuarte as I said above, implementing code coverage in Behat is not cheap. PhpSpec runs the code, so it is easy to write an extension for it collecting code coverage (and it has been done). Behat generally runs your app, not just your code. As the code ends up being run in a different PHP process, the code triggering the code coverage collection cannot be added in Behat. It needs to be added in the app (and then some code added in Behat to fetch the collected data and build a report for it).
@stof it would not be PhpSpec or PHPUnit collecting the code coverage data. xdebug does that. To use xdebug_start_code_coverage and xdebug_get_code_coverage in the same process that runs the application, the extension could interfere with the bootstrap of the application and make sure these methods decorate the run
@MarcelloDuarte well, it is the PhpSpec extension which calls xdebug to trigger the coverage.
Decorating the bootstrap of the application to collect code coverage for Behat is not easy when testing a web app with Mink: unless you are faking the HTTP calls with the symfony2 driver (which works only for Symfony2 projects when you don't need JS), Mink will not call your app itself. It will call your HTTP server through Goutte or Selenium. So adding the xdebug coverage requires modifying the source code of the app itself to interfere with it (which is dangerous as it requires modifying versionned files, and requires to be implemented in an app-specific way). It becomes even worse when you consider that the HTTP server could run on a different machine (see the example of the doc running a behat feature against the wikipedia website).
This is why I'm saying it is not a cheap implementation (and probably also why nobody has implemented it yet as an extension)
@stof HTTP fake calls via framework drivers or a maybe just a separated cc collector component (not necessarily a Behat extension) configured to whitelist/blacklist directories that would be listening to the calls for the application – much like in the way of xdebug profiling with cache grind. Developers wouldn't have to touch the versioned files. This could be achieved this via configuration.
I am not saying this is natural, just not that complex.
+1 I like that... especially this could be a good sanity check for the feature scenarios. If they only cover a small code, they are maybe not precise enough...
@stof HTTP fake calls via framework drivers or a maybe just a separated cc collector component (not necessarily a Behat extension) configured to whitelist/blacklist directories that would be listening to the calls for the application – much like in the way of xdebug profiling with cache grind. Developers wouldn't have to touch the versioned files. This could be achieved this via configuration.
I am not saying this is natural, just not that complex.
—
Reply to this email directly or view it on GitHub.
I will try to refrain from the test-purist vs. test-pragmatist approach discussion, but I definitely see some value in being able to get code coverage out of behat tests:
using only 1 testing framework instead of 2 or 3 has a lot of value, esp. when you have to teach all team members how to write tests, or when the set of configs to run your tests against is complex enough that you have to write your test-executor-framework on top of the chosen test-framework
even if believing strongly in code coverage is bad, looking at the reports as ballpark-figures can be enlightening: finding scenarios you forgot to write, changes between spec time and implementation time leading to huge chunks of dead code etc...
sometimes you might end up in a project where only behaviour tests have been written and not unit tests, for any reason outside of your control (lack of resources, anyone?)
when developing and testing a REST API, the diving line between unit test and functional test gets much thinner and you do not have selenium acting as a middleman. Sending to the API tested the magical cookie which starts xdebug code coverage and retrieving it for treatment is not so hard
I short, I do not advocate adding it by default in behat, but I vote plus one for documenting how it is possible, or having a behat extension making it easier.
Reacted by Bit Wombat, Federico Godán and Julian-Tovar
Activity
stof commentedon Jan 30, 2012
Behat does not know about the way the logic is implemented to achieve the behavior so it would be rather hard. When using Mink for instance, it does an HTTP request to a website and tests the output. It has no way to know what has been executed. It could even run on a separate machine (see the demo testing wikipedia for instance)
everzet commentedon Jan 30, 2012
*.featurefiles are not tests. It's your project features descriptions. And Behat just gives you a way to describe (with step definitions) how to automatically check whether or not those features are implemented/finished/works.Code coverage is nonesense for StoryBDD and Behat especially, cuz we're not talking bout code at all. And feature coverage is impossible till someone invents human-mind-(reading|parsing) software for machines :-)
fabiofabbrucci commentedon Jan 30, 2012
Thank you. Your anserws were very precious to me, to understand better the meaning of BDD versus a TDD.
Thank you very much. Bye bye :)
Daniel15 commentedon May 6, 2012
If the feature context is running code, can't you get the coverage of the code it's executing?
stof commentedon May 6, 2012
@Daniel15 the issue is that you could get the code coverage of your step definition, not of your application. Mink does HTTP requests to your applications, so it does not have access at all to the logic in it to get code coverage (it does not even know that the application itself is written in PHP)
Daniel15 commentedon May 6, 2012
@stof In some situations, that would be okay. Using Mink is just one way to do testing with Behat. In my case, I'm directly interacting with PHP objects in the step definitions, so getting the code coverage of the step definitions would work fine. Specflow's (similar to Behat or Cucumber but for .NET) approach is to wrap a unit test around each scenario, so tests are just run with a regular unit test runner instead of a specific runner (like Behat), and standard code coverage tools can be used.
everzet commentedon May 7, 2012
Seriously, you're trying to achieve wrong thing here. Behat tests your
*.featurefiles (that your features requirements are achieved), not your code. That's where its name coming from, btw (BEHAvior Tester).Code coverage is controversial idea and code coverage for StoryBDD framework is just nonsense. If you're doing code testing with StoryBDD - you're doing it wrong.
Daniel15 commentedon May 7, 2012
I don't quite follow what you're saying. What's the difference between a test like this:
And a specification like this:
They're both doing the exact same test, except one is written as a scenario instead of a "traditional" unit test. The top one is probably what you'd do when using TDD, whereas the bottom one could be what you do when following BDD> In the end, they're testing the exact same thing.
I don't care about code coverage as a number, I just think getting a coverage report is useful to determine whether my scenarios are comprehensive, and which scenarios I'm missing. From what I know, BDD essentially extends TDD by adding test cases written in a natural language. And guess what TDD involves? Unit testing. And guess what people often do with unit tests? Generate code coverage reports. I really don't think it's nonsense.
Are you saying that Specflow is "doing it wrong" as well? They create unit tests based on the feature files (which could be used for unit tests, or functional tests, or whatever you want). And I'm sure that Cucumber promotes the same thing - They show writing of code that directly interacts with Ruby objects.
everzet commentedon May 8, 2012
You're completely loosing point here. There's two complementary but fairly different ways of doing BDD - SpecBDD and StoryBDD.
SpecBDD is all about developing specifications for your low-level implementation units and communication between those. It's evolution of usual unit tests. It's something you're trying to achieve with your example above, but doing it with wrong tool. Good examples of SpecBDD frameworks are http://rspec.info, http://phpspec.net or in case of your .Net - http://nspec.org.
StoryBDD is about developing human-readable business-targeted behavior descriptions about your application functionality. It's evolution of DDD and functional testing into something mixed. With StoryBDD you're writing scenarios for stakeholders, but those scenarios aren't tests and have no aim to target all application functionality, except the one interesting for business (stakeholder). Although scenarios aren't tests, their acceptance phase could be automated with StoryBDD framework like http://cukes.info, http://www.specflow.org or http://behat.org. With StoryBDD you could start with low-level descriptions like you provided above, but the final idea then is still needs to be "to describe domain area of business", not "to test the code".
In best case, you should use both techniques with or without specific tools for them. But using StoryBDD tool for SpecBDD or vise versa is worst idea you could ever make for your development flow.
Behat isn't a SpecBDD tool, it wasn't been created and highly inefficient as such. Behat is a StoryBDD tool. Although you could use same testing code or assertions behind both, approaches are completely different. And if in one case code coverage might have any sense (SpecBDD) for another (StoryBDD) it's completely nonsense.
Daniel15 commentedon May 10, 2012
Why? What disadvantages does using Behat, Specflow or Cucumber for SpecBDD have? I've seen lots of people do it before.
Daniel15 commentedon May 10, 2012
Why? What disadvantages does using Behat, Specflow or Cucumber for SpecBDD have? I've seen lots of people do it before.
MarcelloDuarte commentedon May 10, 2012
StoryBDD is specifying how your feature works, SpecBDD is specifying how you classes will achieve that. SpecBDD frameworks are designed to achieve just that so, in principle, they should do that part better. A SpecBDD framework is much more like a unit test framework, mirroring you project class files, so it communicates better which part of the code you are testing. With a StoryBDD you want to know which features you are testing, and they are great for that.
So apart from improving the "test as documentation" part, using the right tool at each level also gives you a better design perspective. A StoryBDD framework implements the focus on the user part of BDD. That focus is carried down to your classes using A SpecBDD framework. The language is their to help you focus on what matters most. Unit Tests frameworks language put the focus on verification rather than specification, which leads to bad tests in the end, as in tests focused on structure, not behaviour. In Cucumber you can still use BDD expectations to keep the focus on behaviour, and I use them in Behat myself, even when I am writing feature focused step definitions - I have a SpecContext I use for that, so I can say e.g. $output->should->be('Chuck Norris') as opposed to $this->assertEquals($output, 'Chuck Norris'). But that's just really because I am a bit too crazy about BDD.
BDD was created to teach developers putting their focus on what matters most while writing tests. In 1999 a ATDD framework was created (which is like a StoryBDD framework) by Ward Cunningham. Ward is a big part of the XP community, do you can see how important it is to have that. That didn't stop him using sUnit for his Smalltalk code. We are running the StoryBDD tool as well and that is telling us what is the next class to Spec.
everzet commentedon May 10, 2012
@Daniel15 main disadvantage about using StoryBDD for writing code specs exists because SpecBDD and StoryBDD operate on absolutely different levels of abstractions.
In StoryBDD, you're forming (creating) domain dictionary by exploring business requirements and added values of the features. This dictionary (you could think - step definitions) is undefined at the beginning of the project and different from area to area. It means, that for every project (and event for most roles inside this project), you should create your own set of language (step definitions), that you will use to describe project domain. And StoryBDD gives you ability to do exactly that - create new dictionaries, explore domain area and expose business values of the features.
In SpecBDD there's only one possible domain language - language of objects and their relations. Language on which you're already writing your code. "This object should be created and this object should be provided as argument". That's why all SpecBDD frameworks are using syntax of language on which they were written - because that's the way your objects (domain) talk in the system.
Now, let's see how using wrong tool for the job could ruin your flow:
Using SpecBDD tool for StoryBDD. You'll pretend, that you're talking with business people, but doing it using language which is irrational and not readable to any person outside technical world. Most likely, you'll finish with scenarios or specifications, that will be both unreadable by business people and unmaintainable by developers:
Using StoryBDD tool for SpecBDD. You'll try to describe purely implementational (code) details in the tool, that aims on easing exploration of new domains. But in your case (code specs), domain is already known - it's programming language you're using. So, most likely, you'll finish with bloated feature suite and step definition dictionary, that will tend to solve only one thing - recreating your programming language syntax and logic with regular expressions:
Both those types of tests share same big problem - after month of active development, they'll become umaintainable, unusable and, finally, abandoned. Just because they will not be able to solve problems they tended to solve - easing development and communications.
33 remaining items
MarcelloDuarte commentedon Oct 24, 2013
@srcspider yes, I noticed that. Let's just leave it then. BDD was created as a training tool, anyway. Should the guys start coming up with the code coverage discussion again, we can always instruct them with a better perspective.
cordoval commentedon Oct 24, 2013
for the case on phpspec i also thought this held, however someone respectable came up with an extension to do code coverage in phpspec, at first I thought it was a bad idea, but then i realized some use cases or in some flows it made sense. Not sure it is the case of behat, but who knows. Sometimes tools find different use cases, even if it is not the former one. So with care, let's say that is not the best idea for behat right now.
srcspider commentedon Oct 24, 2013
@MarcelloDuarte it's hard to force a perspective on someone that is working under different circumstances to you. The loudest of us almost always point out the most idealistic circumstances, but that doesn't necessarily apply to all users. Some people have higher time constraints, work in smaller teams etc. Just like with choosing hardware there are different metrics and views. Personally even when I use code coverage I almost never look at it as more then a rough statistic (essentially no better then what you all are describing a behat coverage would be) that I use (among other things) to base a rough judgement on how stable/usable/etc my piece of code is. (I know that's now how everyone else does it; unless I'm mistaken a lot of people use it as a "I'm done" indicator.) Since for me it's just a statistic it's not like I have any "forgone conclusions about it," if it ends up being useless at times that's perfectly fine, because it's really cheap to do (or at least would be with a no-extra-knobs implementation).
MarcelloDuarte commentedon Oct 24, 2013
@srcspider Yes! It is really cheap to implement this. There is nothing preventing a feature like that to be coded as an extension, like @everzet suggested. Plus Sebastian has nicely separated the code coverage component from PHPUnit, so it can be reused in situations like this. It's a really easy task to get an extension up and running for this. If someone has a use case for this, we can support with pointers on how to implement – probably better on IRC. In core we keep the tool a bit more focused, because it is also a goal of the BDD tools to educate users in the right way to do TDD.
stof commentedon Oct 24, 2013
@MarcelloDuarte as I said above, implementing code coverage in Behat is not cheap. PhpSpec runs the code, so it is easy to write an extension for it collecting code coverage (and it has been done). Behat generally runs your app, not just your code. As the code ends up being run in a different PHP process, the code triggering the code coverage collection cannot be added in Behat. It needs to be added in the app (and then some code added in Behat to fetch the collected data and build a report for it).
MarcelloDuarte commentedon Oct 24, 2013
@stof it would not be PhpSpec or PHPUnit collecting the code coverage data. xdebug does that. To use
xdebug_start_code_coverageandxdebug_get_code_coveragein the same process that runs the application, the extension could interfere with the bootstrap of the application and make sure these methods decorate the runstof commentedon Oct 24, 2013
@MarcelloDuarte well, it is the PhpSpec extension which calls xdebug to trigger the coverage.
Decorating the bootstrap of the application to collect code coverage for Behat is not easy when testing a web app with Mink: unless you are faking the HTTP calls with the symfony2 driver (which works only for Symfony2 projects when you don't need JS), Mink will not call your app itself. It will call your HTTP server through Goutte or Selenium. So adding the xdebug coverage requires modifying the source code of the app itself to interfere with it (which is dangerous as it requires modifying versionned files, and requires to be implemented in an app-specific way). It becomes even worse when you consider that the HTTP server could run on a different machine (see the example of the doc running a behat feature against the wikipedia website).
This is why I'm saying it is not a cheap implementation (and probably also why nobody has implemented it yet as an extension)
MarcelloDuarte commentedon Oct 24, 2013
@stof HTTP fake calls via framework drivers or a maybe just a separated cc collector component (not necessarily a Behat extension) configured to whitelist/blacklist directories that would be listening to the calls for the application – much like in the way of xdebug profiling with cache grind. Developers wouldn't have to touch the versioned files. This could be achieved this via configuration.
I am not saying this is natural, just not that complex.
alwinmark commentedon Oct 24, 2013
+1 I like that... especially this could be a good sanity check for the feature scenarios. If they only cover a small code, they are maybe not precise enough...
Von Samsung Mobile gesendet
-------- Ursprüngliche Nachricht --------
Von: Marcello Duarte [email protected]
Datum: 24.10.2013 17:51 (GMT+01:00)
An: Behat/Behat [email protected]
Cc: CansaSCityShuffle [email protected]
Betreff: Re: [Behat] Does Behat generate Code Coverage? (#92)
@stof HTTP fake calls via framework drivers or a maybe just a separated cc collector component (not necessarily a Behat extension) configured to whitelist/blacklist directories that would be listening to the calls for the application – much like in the way of xdebug profiling with cache grind. Developers wouldn't have to touch the versioned files. This could be achieved this via configuration.
I am not saying this is natural, just not that complex.
—
Reply to this email directly or view it on GitHub.
robocoder commentedon Nov 11, 2013
https://github.com/vipsoft/code-coverage-extension is a prototype. (I'll add filtering and xcache coverager support later this week.)
Feedback and PRs appreciated.
gggeek commentedon Mar 25, 2015
I will try to refrain from the test-purist vs. test-pragmatist approach discussion, but I definitely see some value in being able to get code coverage out of behat tests:
I short, I do not advocate adding it by default in behat, but I vote plus one for documenting how it is possible, or having a behat extension making it easier.
SvenBrunk commentedon Mar 26, 2015
Exactly. For that I would even like to have it down to line coverage (or more path coverage, so I know what logical paths were taken and which not)
stof commentedon Apr 14, 2015
@gggeek there is already an extension doing this: https://packagist.org/packages/vipsoft/code-coverage-extension
gggeek commentedon Apr 14, 2015
@stof thanks. It is not very clear from the docs if that only works for Sf, though, or if its more generic