Project

General

Profile

Feature #10816

Add the ability to capture Coverage information

Added by tenderlovemaking (Aaron Patterson) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:67940]

Description

Hi,

I would like to periodically capture coverage information. The reason is because I would like to be able to pair test methods with the lines executed for that test method. The question I would like to answer is "If I modify file A on line B, which tests should I execute?"

I've attached a patch that returns a snapshot of the current coverage information. It means that I can grab coverage information before and after each test case, then calculate which lines of code a particular test executed.


Files

snapshot.diff (3.39 KB) snapshot.diff tenderlovemaking (Aaron Patterson), 02/01/2015 11:57 PM

Associated revisions

Revision a86eacf5
Added by tenderlove over 4 years ago

  • ext/coverage/coverage.c: Add Coverage.peek_result. Allows you to
    capture coverage information without stopping the coverage tool.
    [ruby-core:67940] [Feature #10816]

  • test/coverage/test_coverage.rb: test for change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 49589
Added by tenderlovemaking (Aaron Patterson) over 4 years ago

  • ext/coverage/coverage.c: Add Coverage.peek_result. Allows you to
    capture coverage information without stopping the coverage tool.
    [ruby-core:67940] [Feature #10816]

  • test/coverage/test_coverage.rb: test for change.

Revision 49589
Added by tenderlove over 4 years ago

  • ext/coverage/coverage.c: Add Coverage.peek_result. Allows you to
    capture coverage information without stopping the coverage tool.
    [ruby-core:67940] [Feature #10816]

  • test/coverage/test_coverage.rb: test for change.

Revision 49589
Added by tenderlove over 4 years ago

  • ext/coverage/coverage.c: Add Coverage.peek_result. Allows you to
    capture coverage information without stopping the coverage tool.
    [ruby-core:67940] [Feature #10816]

  • test/coverage/test_coverage.rb: test for change.

Revision 49589
Added by tenderlove over 4 years ago

  • ext/coverage/coverage.c: Add Coverage.peek_result. Allows you to
    capture coverage information without stopping the coverage tool.
    [ruby-core:67940] [Feature #10816]

  • test/coverage/test_coverage.rb: test for change.

Revision 49589
Added by tenderlove over 4 years ago

  • ext/coverage/coverage.c: Add Coverage.peek_result. Allows you to
    capture coverage information without stopping the coverage tool.
    [ruby-core:67940] [Feature #10816]

  • test/coverage/test_coverage.rb: test for change.

History

Updated by mame (Yusuke Endoh) over 4 years ago

Sounds good to me. I'm positive to import the feature.

I'd like to hear any opinion from the direct users of the feature, such as the authors of coverage measurement frontend tool (such as simplecov) or testing frameworks.

The question I would like to answer is "If I modify file A on line B, which tests should I execute?"

FYI: I think it is called "regression test selection."

--
Yusuke Endoh mame@ruby-lang.org

Updated by zenspider (Ryan Davis) over 4 years ago

I can absolutely see tying this into minitest-autotest to make it smarter about what tests to run on edit.

Updated by tenderlovemaking (Aaron Patterson) over 4 years ago

I made a proof of concept program (using the patch I've posted here):

https://gist.github.com/tenderlove/fba8eaf2b2e3d84d77c5

Here is a video of it being used:

https://www.youtube.com/watch?v=Qsn7nZEccBU

Updated by mame (Yusuke Endoh) over 4 years ago

Sorry for leaving this ticket and thank you for commenting and creating a proof-of-concept.
Fair enough. Aaron, could you commit your patch?

--
Yusuke Endoh mame@ruby-lang.org

Updated by tenderlovemaking (Aaron Patterson) over 4 years ago

Sorry for leaving this ticket and thank you for commenting and creating a proof-of-concept.

No problem. I'm really excited about this feature (sorry if I seem impatient).

Aaron, could you commit your patch?

Yes, I'll commit it.

#6

Updated by Anonymous over 4 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r49589.


  • ext/coverage/coverage.c: Add Coverage.peek_result. Allows you to
    capture coverage information without stopping the coverage tool.
    [ruby-core:67940] [Feature #10816]

  • test/coverage/test_coverage.rb: test for change.

Also available in: Atom PDF