Data AccessCore JavaApp FrameworksViewTestingBuildingDeploymentDev ToolsSecurityOpinions
Showing posts with label Testing. Show all posts
Showing posts with label Testing. Show all posts

Wednesday, July 15, 2009

Branching in CVS with Eclipse

Sometimes you find such a well written article on a specific topic that you feel that it just needs to be shared.

I have gone to this article on branching and merging in CVS with Eclipse numerous times for more confidence, particularly before a merge.

http://www.eclipse.org/articles/article.php?file=Article-BranchingWithEclipseAndCVS/article1.html

Tuesday, June 23, 2009

junit.framework.AssertionFailedError: No tests found in

If you ever get the above error and you think your test class is set up and implemented correctly, you may have one more thing to check.

Your test method names need to start with 'test'.

For example:

public class name extent TestCase{
public void method1() {}
public void method1() {}
}


Will result in an error. Change the method names to...

public class name extent TestCase{
public void testMethod1() {}
public void testMethod1() {}
}


You should be good to go!

Monday, June 22, 2009

Setting up JUnit in your Eclipse Project

The following is the first steps to adding JUnit test cases to your Eclipse project. It's the first step in working your processes towards Test Driven Development, which is the bread and butter of Agile and XP Programming methodologies and techniques.

Step 1: Download JUnit


The first step is to download the most recent version of JUnit (look for the 'Releases' link off the homepage). At the time of this article, the latest version was 4.6.

Step 2: Add JUnit to your Eclipse project's build path.


Right click on your project and select 'Properties'.
Click 'Java Build Path'.
Click the 'Libraries' tab.
Click 'Add JARs' (if you've added the JAR into your workspace)
or
Click 'Add External JARs' (if you are linking the JAR from outside your workspace)
In the GUI, select the JUnit jar (junit-4.6.jar).

Step 3: Organize your source folders


One recommended practice is to organize your source folders into the following structure:

[project]
-- src    
-- main   (module code)
-- test   (test code only)


Create the above directory structure under your project in Eclipse.
Right click on your project and select 'Properties'.
Click 'Java Build Path'.
Click the 'Source' tab.
Add the 'main' and 'test' folders as source folders in your project and deselect 'src' as a source folder.

Ready to go


You now have effectively integrated JUnit into your project, provided a clean way to separate your code base with your testing code.

Any questions, feel free to comment and I'll get back to you as soon as I can.