-
December 9th, 2018, 06:39 PM
#1
JUnit
Hi,
How would i go about writing JUnit test cases for a simple java application? I found this java apllication here @ https://www.includehelp.com/java-pro...ing-class.aspx
I have been searching all day for examples to cover the basics but I am still at a loss.
Last edited by 2kaud; December 10th, 2018 at 04:53 AM.
-
December 12th, 2018, 03:22 AM
#2
Re: JUnit
Create the unit test class in the same package.
For example,
If com.example.MyPrivateClass located in src/main/java/com/example/MyPrivateClass.java
Then the test class will be in same package
com.example.MyPrivateClassTestCase and will be located in src/test/java/com/example/MyPrivateClassTestCase.java
-
December 13th, 2018, 05:30 AM
#3
Re: JUnit
Thanks kadammanali987
Can you give a specific example.
How would i test the addDistance in the example in the link?
Any help would be appreciated.
-
December 15th, 2018, 12:26 AM
#4
Re: JUnit
Originally Posted by newbie12
Thanks kadammanali987
Can you give a specific example.
How would i test the addDistance in the example in the link?
Any help would be appreciated.
I don't mean to be harsh, but learn to use google. For example, try searching for "junit tutorial". Any of the 1000's of hits is going to show you a basic test for a method.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|