Code Coverage - exporting and filtering

afarrafarr Member Posts: 287
edited 2010-05-24 in NAV Tips & Tricks
When using Code Coverage, I would like to:

a) filter out the lines have not been executed (i.e. the red lines)

b) export the lines (actually, just the black lines) to a single text file.

Does anyone konw how to do this?

Thanks,
Alastair
Alastair Farrugia

Comments

  • ara3nara3n Member Posts: 9,256
    filter on "No. of hits" <> 0 then copy and paste them to excel.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • afarrafarr Member Posts: 287
    Hi Rashed,

    Thanks for the quick reply.

    I realise now that I can even remove the filter on the Object Type and Object No. and this will show me all the executed code in all the objects. Unfortunately, I can't display the Object Type and Object No. - the only column that shows in "View Columns" is Code. If there is a way of showing those fields that would be great.


    Regards,
    Alastair
    Alastair Farrugia
  • ara3nara3n Member Posts: 9,256
    design the form and add the fields to the form.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • TomasTomas Member Posts: 420
    ara3n wrote:
    design the form and add the fields to the form.

    This is useful! :)
  • afarrafarr Member Posts: 287
    OK, thanks for that. Here's all the steps (I just sent this out to the other developers I work with because I think it will be quite useful):

    1. Design the Code Coverage form (Form 566) and add the fields Object Type and Object ID.
    Add some documentation, save and close the form.

    2. Go to Tools – Debugger – Code Coverage – Code.

    3. Press Ctrl+F7 to view the filters.

    4. Remove the filters for Object Type and Object ID (so that you can see code for all the objects together – you can identify which code is for which object thanks to the fields added in step 1 above).

    5. Add a filter for No. of Hits, <>0 (this will show only the black lines).

    6. If you want you can even copy the lines to Excel.
    Alastair Farrugia
  • krikikriki Member, Moderator Posts: 9,112
    [Topic moved from Navision forum to Navision Tips & Tricks forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ajhvdbajhvdb Member Posts: 672
    What you're missing in code coverage is the sequential order in which code is executed.
  • ara3nara3n Member Posts: 9,256
    That is what you use client Monitor for.

    Also if you use SQL perform tools. It combines Code coverage with client Monitor so you can debug those really bad code and loops.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • AlagarAlagar Member Posts: 100
    This Really Good Tips =D> =D> =D>
  • BeliasBelias Member Posts: 2,998
    i've never find the "no. of hits" very reliable, because the "if" statements (and all the code that does not start and end in the same line), are shown as never hit. (edit: this does not depend from the semicolon, as i wrote before) this makes the code coverage less useful, because you won't see the whole line of code, but only the second(or third or fourth) one
    edit: [removed a wrong example and replaced with this one]
    Code
      WITH VATAmountLine DO  //hits=0
        IF FINDSET THEN//hits=1
          REPEAT//hits=0
            IF (PrevVatAmountLine."VAT Identifier" <> "VAT Identifier") OR//hits=0
               (PrevVatAmountLine."VAT Calculation Type" <> "VAT Calculation Type") OR//hits=0
               (PrevVatAmountLine."Tax Group Code" <> "Tax Group Code") OR//hits=0
               (PrevVatAmountLine."Use Tax" <> "Use Tax")//hits=0
            THEN//hits=1
              PrevVatAmountLine.INIT;//hits=0
    
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.