1 of 10

TRec: A Regression Test Recommender for Java Projects

Software Testing And Maintenance Lab.

Sai Kiran Bhrugumalla

Ajay Jha

40th IEEE International Conference on Software Maintenance and Evolution (ICSME)

2 of 10

Gson: JsonWriter name(String name)

Do tests need to be modified or added?

3 of 10

Gson: JsonWriter name(String name)

Do tests need to be modified or added?

Identify all tests

  1. testNameAsTopLevelValue
  2. testInvalidTopLevelTypes
  3. testTwoNames
  4. testNameWithoutValue
  5. testNullName
  6. testRepeatedName
  7. closeAllObjectsAndTryToAddElements
  8. testClosedWriterThrowsOnName

Identify tests for the code change

  • testNameAsTopLevelValue
  • testInvalidTopLevelTypes
  • testTwoNames
  • testNameWithoutValue
  • testNullName
  • testRepeatedName
  • closeAllObjectsAndTryToAddElements
  • testClosedWriterThrowsOnName

Modify or add tests

  • testInvalidTopLevelTypes
  • closeAllObjectsAndTryToAddElements
  • testNameInArray

4 of 10

Identify all tests

  • testNameAsTopLevelValue
  • testInvalidTopLevelTypes
  • testTwoNames
  • testNameWithoutValue
  • testNullName
  • testRepeatedName
  • closeAllObjectsAndTryToAddElements
  • testClosedWriterThrowsOnName

Identify tests for the code change

  • testNameAsTopLevelValue
  • testInvalidTopLevelTypes
  • testTwoNames
  • testNameWithoutValue
  • testNullName
  • testRepeatedName
  • closeAllObjectsAndTryToAddElements
  • testClosedWriterThrowsOnName

Tedious & challenging (Rompaey and Demeyer ICSMR 09, Hurdugaci and Zaidman ICSMR 12)

  • Reduce developers’ productivity (Makady and Walker SPE 13)
  • Developers may not modify tests (Beller et al. FSE 15, Pinto et al. CHASE 17)

Manually

5 of 10

Test

Code

Test-to-code traceability (TCT) techniques (White et al. ICSE 20, Sohn and Papadakis ISSRE 22)

Do not recommend tests for a code change

Do not incrementally update TCT links

6 of 10

App (Gson)

Existing Commit Analysis

Method-test pairs + Frequency

name(String)

7 testInvalidTopLevelTypes

7 closeAllObjectsAndTryToAddElements

5 testNameWithoutValue

4 testTwoNames

4 testClosedWriterThrowsOnName

1 testNameAsTopLevelValue

TRec

7 of 10

App (Gson)

Existing Commit Analysis

Method-test pairs + Frequency

name(String)

7 testInvalidTopLevelTypes

7 closeAllObjectsAndTryToAddElements

5 testNameWithoutValue

4 testTwoNames

4 testClosedWriterThrowsOnName

1 testNameAsTopLevelValue

New Commit Analysis

parseReader(JsonReader)

1 testStrict

name(String)

No tests modified

name(String) - Top 5 tests

7 testInvalidTopLevelTypes

7 closeAllObjectsAndTryToAddElements

5 testNameWithoutValue

4 testTwoNames

4 testClosedWriterThrowsOnName

TRec

8 of 10

Effectiveness of TRec:

Does TREC recommend the same tests that developers modify for code changes?

  • 1,699 developers’ modified methods
  • 437 commits
  • 3 Java projects (gson, commons-lang, and commons-io)

9 of 10

Effectiveness of TRec:

84% of the developers’ modified tests are the same as TRec’s recommended tests

  • 78% are ranked first or second

10 of 10

TRec: An open-source command line tool

ajay.jha.1@ndsu.edu