Presented at: The 29th IEEE/ACM International Conference on Program Comprehension (ICPC '21)
Date of Conference: Tue 18 - Thu 20 May 2021
Conference Location: Virtual Conference
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Using Grammar Patterns to Interpret Test Method Name Evolution
1. 29th IEEE/ACM International Conference on Program Comprehension
Using Grammar Patterns to Interpret Test
Method Name Evolution
Anthony Peruma, Emily Hu, Jiajun Chen, Eman Abdullah AlOmar, Mohamed Wiem Mkaouer and Christian D. Newman
2. SUMMARY
We examine how developers craft
method names in test suites. We
use grammar patterns, to
understand test naming practices.
01
3. BACKGROUND
Identifier names help developers understand the purpose of
the identifier
Test methods names describe the entity that is being tested
and actions taken by the test
Names can be used to generate code for the test methods
automatically
Prior studies on method naming do not differentiate between
production and test method naming structures
02
4. OUR
GOAL
Understand the evolution of
structure and meaning of test
method names and their relation to
statically-verifiable code behavior.
03
5. IMPACT
Findings from our study facilitate research
and development of tools to aid in test
name recommendation and appraisal.
04
6. RESEARCH
QUESTIONS
02
03
Based on the grammar patterns:
• Typical structure of method names
• Structure evolution
• Comparison with existing patterns
Relation between changes in grammar
patterns and semantic meanings
Based on terms in a name:
• Most common term changes
• Relationship between the added
term and removed term
01
05
10. RESULTS: RQ 1 – COMMON GRAMMAR PATTERNS
● We look at complete grammar
patterns and prefix patterns
● We corroborate grammar patterns
cataloged in prior studies and identify
new patterns
● Test names are crafted differently
from production names
○ Test method names are highly
specific to their intended
behavior
○ Patterns include determiners,
prepositions, and adverbs
● Renames do not typically change the
part-of-speech tag of a word
Newpatterns
● V V N P+
○ testReadFileFromClasspath
● N V+
○ projectClosed
● + VM +
○ deleteindexNotExists
● + DT +
○ testExecuteAll
09
11. RESULTS: RQ 2 – SEMANTIC CHANGES
Term Changes
● Frequent changes to the meaning of a
test method’s name
○ testLog →
testEigenSingularValues
○ Contrasts with prior research:
names tend to narrow in
meaning
● Preserve meanings are mostly due to
digits, underscore, or title case
Prefix Patterns
● Prefix pattern mostly associated with a
change in meaning: V V → V V
● Prefix pattern mostly associated with a
narrowing and broadening in meaning:
V V → V NM
● As the number of prefixes increases,
the volume of instances decreases
10
12. RESULTS: RQ 3 – COMMON TERM CHANGES
● Frequent changes include swapping of
sequence numbers appended to the
name
○ test15_6_5 → test16_9_5
● Frequent changes to names, without
numerical digits:
○ has → contains
○ test → can / should / is
○ all of → at least
○ with → when
Determiningrelationshipsis
challenging!
● Ambiguous terms
○ LBDevice → Zeus
● Multiple term replacements
○ not started → closed
● Replaced terms are unrelated
○ latency → metrics
11
13. KEY TAKEAWAYS
03
Test method name refactorings
tend to change the meaning of
terms in the name
04
There are common words and
phrases which are synonymous
in test method renames
01
Difference in structure between
test and production method
names; Useful in providing test-
specific recommendations
02
Some of the prefixes detected in
our dataset indicate the
existence of additional test
name patterns
12
Our Identifier Naming Structure Catalogue is available at: https://scanl.org