All posts for the month January, 2012

So a lot of people have been asking me about how to create JUnit Reports with their automated test cases. I’m going to show you how to create these reports in the easiest way possible. You will not have to download anything, add any code, etc. You will only have to use generate the HTML report using Ant with Eclipse.

The first think you have to do is generate the Ant build. You can do this by:

1. Right click on the project and
select Export –> Ant Buildfiles (this will be under General) –> Next–> Select the project that contains your JUnit tests –> Finish.

The default JUnit output directory is appropriately named “junit”.

2. The next thing you have to do is resolve your dependencies by making sure that the junit.jar is added to
Ant’s “Global Entries.”. You can do this by.

Window->Preferences->Ant->Runtime->Global Entries and Add External JARs… Navigate to your “eclipse” directory (where eclipse is installed). It is under “plugins” directory and presently the junit.jar is in a directory named “org.junit_3.8.1”. If this is missing then you will see error messages since
junit is an optional Ant task.

* If you are using a Mac, Preferences are under the the Eclipse menu.

3) Finally, right-click on the Ant build file build.xml (this file is the one you created in Step 1) and Run As->Ant Build. This will display a list of targets. All of the launch configurations you have previously configured will have a corresponding target in your Ant build file. Select the desired target(s), and also select the “junitreport” target (very important). Check the “Target execution order” text area to make sure the junitreport is run last.

As you can see I’ve specified the order in which I want my cases to run (below)

Whenever you run a test case it will generate results and will be placed in the junit output directory. These results are formatted into an HTML report by the junitreport target and stored in the junit output directory.

As you can see below my automated Test Suite has completely run and you can see which tests failed and which passed (below). I see my cases for login, registration, and account-sign up are failing. Upon further investigation, these are failing because the web service is down on our staging server.

This is a fast and easy explanation of how to create JUnit HTML reports, but hopefully it helps get you off your feet. Next time around, we’ll have some more fun when I show you how to extend this output to get more information displayed in the report. For example to add an additional column which contains link to a screenshot taken by the test.

Today I tried to create an AOL test acccount. I”m still a little upset about the last time I called them and tried to cancel my account from my last position, which took months of calls, and finding out who [credentials] created the account from the last guy in this position. Needless to say, it never got cancelled. I told them I didn’t know the guy’s credentials or where he was and this was a company test account as they had the company number on file. They didn’t budge, and well, I still have my AOL test account from my last job.

So today, I try to sign-up for a new account for an independent project I am working on, for testing purposes of course. After signing-up and being on the step where I have to enter in the double-word CAPTCHA code; this form totally failed on me. I wasn’t even trying to break it, I just can’t read CAPTCHA for the life of me and kept refreshing the code (about 10 times). After ten times, I tried again, and this time the CAPTCHA refused to change and all I could do next, would be to take my chances and try to submit. I got lucky and the status bar was moving meaning which meant, I was about to get served my aol test account on a golden platter. After entering in the code I thought was correct (In Firefox version 8.0), and hitting submit, I got the following page.

Did I get an account? Did the server take a break on me? If i did get an account, this must be the most subtle confirmation page I’ve ever seen. Maybe my account is on the way while I get a bite to eat?

The message I got totally undermined my efforts to register on the site since I think I actually gave 200% trying to register, but I’m glad they know I am trying hard. Me being the curious tester type, I decided to try this in Chrome (v16.0.912.77 m), and I couldn’t even hit the submit button after filling out the landing page form below; meaning I got even less further in Chrome trying to set up this account.

Still being the curious tester type I looked up the Error Code: 420 and found out:

In HTTP, the return code 420 is not used by the standards. However, and individual can make the server return whatever HTTP return code he wants… and should provide information about the Error.

Then I finally noticed something. The picture that the sign-up form is on actually has a bear riding a bike with a top hat; which is nothing short or a monkey on a unicycle juggling bowling pins. I then realized the joke was actually on me.

I have to admit that I am a movie fanatic. I watch a lot of movies regularly and even give my feedback on amazon which confirms that very fact. I was watching a movie today; a movie some would consider old school (China Moon), but I couldn’t help to think that this actor is never in the tabloids or on any of the sleazy tabloid sites and he’s been such an awesome actor; which is usually a prerequisite for being in those sleeay rags. Anyway, I have to admit, I’ve never seen him play a bad role to this day.

He’s been in A Beautiful Mind, GlenGarry Glen Ross, The Truman Show, and China Moon. He’s even been in Creepshow.

He is none other than Ed Harris:

He is the guy that shows up during your schizophrenic episode with orders from the F.B.I., while all these other schizophrenics are seeing talking purple bunnies. I’d rather get orders from Ed.