Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Using Grammar Patterns to Interpret Test Method Name Evolution

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

  • Be the first to comment

  • Be the first to like this

Using Grammar Patterns to Interpret Test Method Name Evolution

  1. 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. 2. SUMMARY We examine how developers craft method names in test suites. We use grammar patterns, to understand test naming practices. 01
  3. 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. 4. OUR GOAL Understand the evolution of structure and meaning of test method names and their relation to statically-verifiable code behavior. 03
  5. 5. IMPACT Findings from our study facilitate research and development of tools to aid in test name recommendation and appraisal. 04
  6. 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
  7. 7. OUR CONTRIBUTIONS Annotated Grammar Patterns Dataset New Grammar Patterns & Trends Discussion on the Evolution of Test Method Names 06
  8. 8. STUDY DESIGN 07
  9. 9. EXPERIMENT RESULTS 08
  10. 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. 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. 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. 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
  14. 14. THANK YOU! For more of what we do, visit: https://www.scanl.org/

×