Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 59
Registered: ‎03-10-2009
My Device: Not Specified

Re: How to do unit testing my Blackberry Application

From where i can download entire BUnit?

 

From this url "http://sourceforge.net/projects/b-unittesting/" i downloaded zip file which contains only src folder. how to make use of that...

Developer
Posts: 212
Registered: ‎07-18-2008
My Device: Storm 9550

Re: How to do unit testing my Blackberry Application

the source contains everything you need.

there is no magic :smileywink:

 

jfisher\

contains an application with screen for showing results including:

 

DistanceConversion.java

is the class they test

 

DistanceConversionTest.java

contains the test code

 

unittestApp.java

show how the call the test

 

 

jmunit\

contains "unittesting framework" classes 

 

 

If your problem was solved, please mark answer as "Accepted solution"
If your want to thank, click the "kudo" symbol
___________
visit me: http://mobilejavadevelopment.blogspot.com/
visit the Berlin BlackBerry Developer Group: http://berlinblackberrydevelopers.blogspot.com/
New Developer
Posts: 59
Registered: ‎03-10-2009
My Device: Not Specified

Re: How to do unit testing my Blackberry Application

Hi Thank you very much for your kind support. i'm able to test my application using bunit.
Visitor
Posts: 1
Registered: ‎03-12-2010
My Device: BB-STORM2

Re: How to do unit testing my Blackberry Application

Hello,

 

 

 
Thanks and Regards
Rajiv Sharma
Regular Contributor
Posts: 71
Registered: ‎03-24-2010
My Device: 9550

Re: How to do unit testing my Blackberry Application

Just copy bunit source code to your project

(I prefer to create a new source folder named test for it.)

 

Have a look at jfisher.logic.test.unittestApp and run this class (it contains a main() function) You will know how to test your application immediately,

- DistanceConversion is a sample class

- DistanceConversionTest is the testing class.

 

 

 

Regular Contributor
Posts: 71
Registered: ‎03-24-2010
My Device: 9550

Re: How to do unit testing my Blackberry Application

There is one problem :

In project there are 2 main() method:

- main() of bunit

- main() of our application.

 

Is there any quick way to choose which main() method is executed ?

 

Thanks

Visitor
Posts: 1
Registered: ‎08-25-2010
My Device: Not Specified

Re: How to do unit testing my Blackberry Application

Yes there is.

You can define an Alternate Entry Point in the application descriptor xml and add an application argument (I used "bunit" for example).

Then, in the main() of my application I have the following code:

 

 

if (args.length == 1 && args[0].equals("bunit")) {
// Unit tests
       unittestApp instance = new unittestApp();
       instance.enterEventDispatcher();
}

 

 

Now, on the blackberry home screen I have an additional application icon for unit tests.

Contributor
Posts: 40
Registered: ‎07-14-2010
My Device: Not Specified

Re: How to do unit testing my Blackberry Application

Hi,

 

Is there any tool which gives code coverage information based on unit test covered in bbunit?

 

e.g. Clover, Eclemma etc tools refers junit test results and gives code coverage information.