Friday, June 21, 2013

Most useful plugins for Eclipse (Eclipse)

1) JUnit
http://www.vogella.com/articles/JUnit/article.html

1.1. Project preparation
Create a new source folder test. For this right-click on your project, select Properties and choose the Java Build Path . Select the Source tab.
Press the Add Folder button, afterwards press the Create New Folder button. Create the test folder.
The result is depicted in the following sceenshot.
(Alternatively you can add a new source folder by right-clicking on a project and selecting New → Source Folder.)
1.2. Creating JUnit tests
You can write the JUnit tests manually but Eclipse supports the creation of JUnit tests via wizards.
For example to create a JUnit test or a test class for an existing class, right-click on your new class, select this class in the Package Explorer view, right-click on it and select New → JUnit Test Case.
Alternatively you can also use the JUnit wizards available under File → New → Other... → Java → JUnit.
(Wizard for creating test suites
To create a test suite in Eclipse you select the test classes which should be included into this in the Package Explorerview, right-click on them and select New → Other... → JUnit → JUnit Test Suite.)
1.3. Running JUnit tests
To run a test, select the class which contains the tests, right-click on it and select Run-as → JUnit Test. This starts JUnit and executes all test methods in this class.
Eclipse provides the Alt+Shift+X, ,T shortcut to run the test in the selected class. If you position the cursor on one method name, this shortcut runs only the selected test method.
To see the result of an JUnit test, Eclipse uses the JUnit view which shows the results of the tests. You can also select individual unit test in this view, right-click them and select Run to execute them again.
1.4. JUnit Content Assists
(JUnit uses static methods and Eclipse cannot always create the corresponding static import statements automatically.)
You can make the JUnit test methods available via the Content AssistsContent Assists is a functionality in Eclipse which allows the developer to get context sensitive code completion in an editor upon user request.
Open the Preferences via Window → Preferences and select Java → Editor → Content Assist → Favorites.
Use the new New Type button to add the org.junit.Assert type. This makes for example the assertTrue,assertFalse and assertEquals methods directly available in the Content Assists.

2) EGit
在Eclipse里使用github的插件

3) Checkstyle 4) Window Builder5) VisualVM

6)Umbrello
For UML diagrams

7)Ant

1 comment: