Some information about JUnit tested projects

71 views
Skip to first unread message

Mohammad Ghafari

unread,
Aug 4, 2014, 6:30:09 PM8/4/14
to boa-...@googlegroups.com

Dear all,

I am wondered to know if BOA can help me to know how many project are JUnit tested? and, how many test cases exist in each of these projects?
I'm interested to count both JUnit 3 and 4. For counting test cases in JUnit 3, it should be enough to consider all public methods whose name starts with "test" keyword, while in JUnit 4 all test methods are annotated with @Test.

Thank you for your help and I'm sure these information can help me better to proceed my research

Robert Dyer

unread,
Aug 4, 2014, 9:37:16 PM8/4/14
to
Hi Mohammad,

Boa can definitely help you with these queries!  I have actually performed one of them (looking for @Test in JUnit 4) myself for a previous presentation.  Here is that query, slightly modified to answer your more specific question of 'how many projects' use JUnit 4.


Junit4Projects: output sum of int;

found
:= false;

visit
(input, visitor {
    
# only look at the latest snapshot
    before n
: CodeRepository -> {
        snapshot
:= getsnapshot(n);
        
foreach (i: int; def(snapshot[i]) && !found)
            visit
(snapshot[i]);
        stop
;
    
}
    before _
-> if (found) stop;
    before n
: Modifier ->
       
if (n.kind == ModifierKind.ANNOTATION && n.annotation_name == "Test")
            found
= true;
});

if (found)
   
Junit4Projects << 1;

Hope that helps!

- Robert

Mohammad Ghafari

unread,
Aug 5, 2014, 7:29:59 PM8/5/14
to Robert Dyer, boa-...@googlegroups.com

Hi Robert,

Thank you for the query. Yes, I remember a slightly different version of this query which you ran in ICSE. I actually asked it again to complement that query by counting JUnit 3 as well :)

Thanks again
 


On Tue, Aug 5, 2014 at 3:37 AM, Robert Dyer <psy...@gmail.com> wrote:
Hi Mohammad,

Boa can definitely help you with these queries!  I have actually performed one of them (looking for @Test in JUnit 4) myself for a previous presentation.  Here is that query, slightly modified to answer your more specific question of 'how many projects' use JUnit 4.


Junit4Projects: output sum of int;


found
:= false;


visit
(input, visitor {
 
# only look at the latest snapshot
 before n
: CodeRepository -> {
 snapshot
:= getsnapshot(n);
 
foreach (i: int; def(snapshot[i]) && !found)
 visit
(snapshot[i]);
 stop
;
 
}
 before _
-> if (found) stop;
    before n
: Modifier ->
       
if (n.kind == ModifierKind.ANNOTATION && n.annotation_name == "Test")
            found
= true;
});


if (found)
   
Junit4Projects << 1;

Hope that helps!

- Robert

On Monday, August 4, 2014 6:30:09 PM UTC-4, Mohammad Ghafari wrote:

--
You received this message because you are subscribed to a topic in the Google Groups "Boa Language and Infrastructure User Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/boa-user/bxH8lDldL10/unsubscribe.
To unsubscribe from this group and all its topics, send an email to boa-user+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Mohammad Ghafari

DeepSE group @ DEIB - Politecnico di Milano
http://home.deib.polimi.it/ghafari

Reply all
Reply to author
Forward
0 new messages