test your tests with r metaprogramming n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Test your tests with R metaprogramming PowerPoint Presentation
Download Presentation
Test your tests with R metaprogramming

Loading in 2 Seconds...

play fullscreen
1 / 8

Test your tests with R metaprogramming - PowerPoint PPT Presentation


  • 121 Views
  • Uploaded on

Test your tests with R metaprogramming. Tom Taverner, Chris Campbell Mango Solutions. Two ideas for testing software. Black box testing ( RUnit and testthat ) shows broken code Clear box testing shows faulty/dead/unreachable code. R based test coverage.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

Test your tests with R metaprogramming


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
    Presentation Transcript
    1. Test your tests with R metaprogramming Tom Taverner, Chris Campbell Mango Solutions

    2. Two ideas for testing software • Black box testing (RUnit and testthat) shows broken code • Clear box testing shows faulty/dead/unreachable code

    3. R based test coverage • Code coverage is the degree to which code is tested by a particular test suite • Want to find which code is not executed • We developed a code coverage testing tool Overall report of coverage % R package HTML code coverage viewer Unit test suite

    4. Example • Function ‘trapezium’ is read in but not called by the unit test suite • In practise we found 90-100% coverage in production code • Error handling code is especially hard to test

    5. The instrumentation algorithm • Rewrites code to put trace calls everywhere • Uses R 3.0’s alternate parser y <- x + 10 `_1` <- `_2` + 10 `_1` <- {trace(); `_2` + 10} y <- {trace(2); x + 10} 1. Get parse table mapping symbols to unique ID 2. Replace symbols by UIDs 3. Insert trace calls 4. Instrument trace calls and replace UIDs by symbols

    6. Aims for the near future • Put on Github • Integrate with CI tools • Take inspiration from Java tools (clover) • Other types of coverage?