SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Andreas T.'s [[talks|talk]] about Test Driven Refactoring

The slides are now available:

Quick Summary

We detected four Types of refactoring:

Depending on the modifications on the interfaces of the refactored tested classes.

Compatibility Example How to handle
Compatible split temporary variable no need to update tests
Backwards compatible pull up field add aditional tests
Can be made backwards compatible rename method mark the old interface as deprecated
add aditional tests
Incompatible refactorings hide method

Smells we detected in Unit Tests

Refactorings in the test code and in the base code that might resolve this smell.

Smell Refactoring of test code Refactoring of base code
Mystery Guest Inline Resource
Recource Optimism Setup external resources
Test Run War Make Resources Unique
General Fixture Extract Method
Eager Test Extract Method
Lazy Test Inline Method
Assertion Roulette Add Comments
Indirect Testing Extract Method / Move Methodnot enough data hiding!
For Testers Only Extract Method / Move Method !
Sensitive Equality Introduce Equality Method

Smells in production code we discussed

  • Duplicated Code
  • Long Method
  • Large Class
  • Long Parameter List
  • Divergent Change
  • Shotgun Surgery
  • Switch Statements
  • Lazy Class
  • Speculative Generality
  • Alternative Class with Different Interfaces
  • Data Class
  • Refused Bequest
  • Long comments

Resources

  • Arie van Deursen, Leon Moonen: "The Video Store Revisited - Thoughts on Refactoring and Testing", In: Proceedings of the 3nd International Conference on Extreme Programming and Flexible Processes in Software Engineering XP2002, 2002, M. Marchesi and G. Succi.
  • A. van Deursen, L. Moonen, A. van den Bergh, and G. Kok. Refactoring test code. In M. Marchesi and G. Succi, editors, Proceedings of the 2nd International Conference on Extreme Programming and Flexible Processes in Software Engineering (XP2001), pages 92-95, May 2001.

Additional Resouces (to find some explanations)

About Test Driven Development

Quality Checks for JUnit Tests

teaching/labs/xp/2004b/talktestdrivenrefactoring.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2020