Icon/node statistiscs

2012-08-02
2013-04-12
  • Sofia Hedlund

    Sofia Hedlund - 2012-08-02

    Hi, I'm using Freemind as a test coverage tool. It would help me immensely if there was a way to count the different icons used in the nodes to be able to quickly get statistics.
    For example, if I have a map with 10 end nodes, where 5 have the green OK icon and 4 the red not ok icon and one node dont have an icon. I'd like to be able to easily get that information without manually counting, together with a node total.
    Anyone have a good idea how to do this?

     
  • Francis Balfe

    Francis Balfe - 2012-08-07

    I'm working on that very solution using a Groovy script. First release should be out in a few weeks.

     
  • TheD

    TheD - 2012-10-11

    Francisbalfe - Have you made any progress with your script? I am looking for a similar solution. Please share. Thanks.

     
  • Francis Balfe

    Francis Balfe - 2012-10-12

    Hi,

    I did some very, very basic scripting and have created a basic version.

    Please try the following steps and let me know if you can follow.

    http://fbalfe.wordpress.com/2012/08/16/freemind-for-testers/

    Also, let me know if you have any suggestions for improvements

    Regards,

    Francis

     
  • TheD

    TheD - 2012-10-12

    Thanks Francis. I did find that link and used your script. I did some changes to add/modify "test statuses" as per my need. One change I would suggest is the ability to print the results when I export my test plan (mind map) as XHTML. This will help in documentation.

     
  • TheD

    TheD - 2012-10-12

    Thanks a lot for the script. It is very handy to have a summary of results.

     
  • Francis Balfe

    Francis Balfe - 2012-10-12

    Hi dharmeshb,  Can you share back the add/modify "test statuses" improvements?

     
  • TheD

    TheD - 2012-10-12

    Here are the modifications I made
    - added heading info in case I take a screenshot of the summary results
    - added new test statuses
    - added percentage (%) next to the numbers for reporting

    // Version: 0.1 
    // Author: Francis Balfe 
    // Date: 07-Aug-2012 
    // Kudos to freemind.sourceforge.net/wiki/index.php/Example_scripts 
    // Kudos to freeplane.sourceforge.net/wiki/index.php/Scripting 
    import freemind.modes.*; 
    import javax.swing.*; 
    //method for displaying the results in a pop-up dialog 
    def showResults(String text) { 
    def dialog = new JDialog() 
    dialog.setSize(200, 200) 
    dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE) 
    dialog.add(new JScrollPane(new JTextArea(text))) 
    dialog.visible = true 
    }; 
    //define variables. 
    //Because this is a script, not a class, we dont use the def keyword when defining the variable. 
    numberOfPasses = 0; 
    numberOfFails = 0; 
    numberOfUntested = 0;
    numberOfBlocked = 0;
    numberOfDeferred = 0; 
    numberOfTasks = 0;
    testPlanName = 'Your System Test / UAT Plan';
    projectName = 'Your Project Name';
    releaseNumber = 'Your Release Number';
    iterationNumber = 'Your Iteration Number';
    //This is the first call of the function testExecutionReport. 
    testExecutionReport(node) 
    //method to count the number of passes, fails and no runs 
    def testExecutionReport(MindMapNode targetNode){ 
            //Get the children of the target node 
            def allChildrenOfCurrentNode = targetNode.childrenUnfolded(); 
            //Loop through the children 
            while (allChildrenOfCurrentNode.hasNext()) { 
                //the current node is the next child 
                currentNode = allChildrenOfCurrentNode.next(); 
                //Get the Icons assigned to the current Node 
                def iconsOfCurrentNode = currentNode.getIcons(); 
                if (iconsOfCurrentNode.name.contains('button_ok')){ 
                        numberOfPasses += 1; 
                }; 
                if (iconsOfCurrentNode.name.contains('button_cancel')){ 
                        numberOfFails += 1; 
                }; 
                if (iconsOfCurrentNode.name.contains('stop-sign')){ 
                        numberOfBlocked += 1; 
                };
                if (iconsOfCurrentNode.name.contains('flag-yellow')){ 
                        numberOfUntested += 1; 
                }; 
                if (iconsOfCurrentNode.name.contains('hourglass')){ 
                        numberOfDeferred += 1; 
                }; 
                //recursive call to the testExecutionReport function with the current node as a parameter 
                testExecutionReport(currentNode); 
            }; 
    };
    numberOfTasks = (numberOfPasses + numberOfFails + numberOfBlocked + numberOfUntested + numberOfDeferred);
    showResults (
    projectName + '\n' +
    releaseNumber + ' - ' + iterationNumber + '\n' +
    testPlanName + '\n\n' +
    'Untested: ' + numberOfUntested + '(' + ((numberOfUntested/numberOfTasks)*100) + '%)' + '\n' + 
    'Pass: ' + numberOfPasses + '(' + ((numberOfPasses/numberOfTasks)*100) + '%)' + '\n' + 
    'Fail: ' + numberOfFails + '(' + ((numberOfFails/numberOfTasks)*100) + '%)' + '\n' + 
    'Blocked: ' + numberOfBlocked + '(' + ((numberOfBlocked/numberOfTasks)*100) + '%)' + '\n' + 
    'Deferred: ' + numberOfDeferred + '(' + ((numberOfDeferred/numberOfTasks)*100) + '%)' + '\n' + 
    'Total: ' + numberOfTasks + '(' + ((numberOfTasks/numberOfTasks)*100) + '%)');
    
     
  • TheD

    TheD - 2012-10-12

    I am not a coder so please pardon any mistakes :)

     
  • Francis Balfe

    Francis Balfe - 2012-10-12

    Excellent, thanks dharmeshb

     
  • TheD

    TheD - 2012-10-15

    Francis - It looked like on your wordpress site you instructed to add the script in the Freemind folder.. but I tried the way I found  on Freemind wiki documentation. I assigned a "script" attribute to a node and added the script there. I found this more comfortable than doing changes to default files.

    The only downside is when I export my mind map as XHTML - Clickable Image Map.. the whole script is printed :(

     
  • TheD

    TheD - 2012-10-15

    Forgot to ask earlier - What is the code if I want to print the percentage without decimals?

    Also, will you please help with putting the results on the exported XHTML?

     

Log in to post a comment.