Here's a video tutorial to create a JUnit test to validate that a service is working as expected.  It also shows some simple debugging to set a break point and to step through the code.

 

GroG

8 years 2 months ago

WOOHOO !  Nice Tuto Kwatters...

I find it facinating to watch others work with the same tools I use every day...  You can always learn something..

  • I'm betting you did not auto-stub the junit class for clarity of your tuto..
  • I also assume you manually navigated, the package explorer for clarity, I like the little yellow (left arrow right arrow for quick source -> to -> tree navigation
  • I typically use Runtime.start .. as it has to create in order to start..
  • ctrl + shift + O  & ctrl + shift + F  are a couple of my favorite keys

Great Vid !  - when do you get to see conflict merging on the git command line (or in Eclipse) :D

Thanks for an excellent explanation of junit tests. Automated tests are really good to avoid destroying something that was working before.

I will try to create junit test in the areas where I make changes.

/Mats

Awesome Mats!  Unit test are definitely welcome.  Especially if they validate behavior :)  We do have quite a few tests that are no-op at the moment.

In a perfect world, we'd have a unit test for every class and another set of unit tests that validate more system level behaviors.

As a side note, we use JaCoCo to generate code coverage reports.  If you run "ant report"  it should generate the html report for how much of the code was actually exercised by the unit tests during the build.  I think those reports are a pretty good place to see what we're not currently testing.

 

juerg

8 years 1 month ago

really great that you gave us an example of how to run stuff in eclipse.

have to commit that some of your steps went rather quick and I struggled a bit to get the same view and setup as shown in your screen.

First ruined my eclipse project when trying to get the same look as in the video and got a red exclamation mark on myrobotlab. When trying to run the test it showed an error "class not found".

Cleared then everything out and started from scratch using this tuto 

http://myrobotlab.org/quick_start

and now all looks OK - thanks a ton for your help