vazexqi / CodingSpectator

Watches and analyzes code edits in the Eclipse IDE non-invasively
http://codingspectator.cs.illinois.edu
Other
20 stars 14 forks source link

Reorganize the GUI tests #141

Closed reprogrammer closed 13 years ago

reprogrammer commented 13 years ago

We need to separate tests for cancelled refactorings from those for performed ones. And, we need to organize the tests for different refactorings into packages.

Note: Right now we are in the process of migrating things over and we want to keep things simple. Some of the tests might exhibit code duplication. We are going to refactor that later when we have a better sense of the common parts between all tests.

rajkuma1 commented 13 years ago

I was thinking something like this: success failure

Under each of the success and failure packages: keyboard [need to figure out more info] menudriven [already there]

What do you think?

reprogrammer commented 13 years ago

Are success and failure top level packages? Sometimes, the tests for performed refactorings and cancelled refactoring extend a common class. Where do you propose to put the superclass?

Also, I think performed is more appropriate than success because it's consistent with our terminology. In addition, a performed refactoring doesn't necessarily succeed.

rajkuma1 commented 13 years ago

performed looks consistent with the current convention. When I say success, I'm referring to refactorings that run to completion without errors. A cancelled refactoring would also fall under success if the refactoring was invoked but was cancelled by user action. A failed refactoring would refer to one that could not be performed because of:

The super class would remain in the current location right under src folder of ui tests. But, the subclasses would be under seperate packages.

If the package structure is not great, we could have separate projects for those tests that pass and those that fail. We'd have to modify 2 projects. But, chances are we'll be using those that succeed more frequently that those that fail.

reprogrammer commented 13 years ago

I suggest a package structure like the following.

The package edu.illinois.codingspectator.ui.tests contains classes that are shared by different refactorings. If there are a lot of tests for a particular refactoring, e.g. rename, we can further refine the package structure as rename.javaproject, rename.localvariable and rename.enumconst.

Currently, every concrete test class first tries to cancel the refactoring and then performs it. We need to split the concrete classes into two because sometimes a refactoring can only be cancelled, or we have already tested the cancellation of the refactoring in another test class. To reach this end, we need to extract two subclasses from CodingSpectatorTest:

  1. CancelledRefactoringTest
  2. PerformedRefactoringTest

Because Java doesn't allow multiple inheritance, we cannot easily reuse some of the code. For example, currently, the tests for pull up inherit from PullUpTest, and PullUpTest implements methods such as refactoringMenuItemName and getRefactoringDialogName. There are ways to avoid duplicating the code for the name of the menu item and dialog name in the new hierarchy. But, I think we shouldn't worry about it at the moment, first because the amount of code duplication is small, second there are ways to fix it using composition.

reprogrammer commented 13 years ago

Reorganized extract method, extract constant and some of extract superclass tests in the branch reorganize-ui-tests.

vazexqi commented 13 years ago

Ported Inline Tests in 27132ce70a5c93f3f675263cd8172fc81d800787

vazexqi commented 13 years ago

Ported Pull Up Tests in 132e5f8f6ca3bb706c6ed761fcb11f7f7b0aa6d5

reprogrammer commented 13 years ago

Finished porting extract superclass tests in c886ce5f7be814cf3b9c355a22fbbb4a0654c1b8.

reprogrammer commented 13 years ago

Ported move refactorings in 6dfd12de889f841d076d3e8c736db85d475e6504.

reprogrammer commented 13 years ago

b869b2a57432c75c531a8929bcac803eac349c9c completes the reorganization of UI tests.

reprogrammer commented 13 years ago

82f1c2a166913a6b08a05cb993fd4813c6da39f0 and bfe42f22091f6ec462a3e2ee6bfa8c619a0540fa renamed some of the tests to comply with our naming conventions.