class 2 « junit « Java Testing Q&A

Home
Java Testing Q&A
1.Development
2.FindBugs
3.HTMLUnit
4.hudson
5.junit
6.performance
7.plugin
8.profile
9.selenium
10.Tools
11.unit test
Java Testing Q&A » junit » class 2 

2. Help please with complex JUNIT test cases across classes    coderanch.com

Hello, I have been thrown rather into the deep end and asked to debug and create test cases for an application. I'm completely new to JUNIT, and I'll be honest my Java is not that great beyond the basics. I know the methods I want to test, and the results I want to prove. However, it's the coding that is the ...

3. Problem with JUnit testing class    coderanch.com

Hi again guys! I have unknown trouble with my code. I have a class Planta, and Im trying to make the JUnit test class for it. Planta code is: package muelles.escenario; import java.util.LinkedList; import java.util.Random; import muelles.elementos.Elemento; public class Planta { private Casilla[][] tablero; private int xLength; private int yLength; private Planta superior; private Planta inferior; public Planta(int x, int y){ ...

4. Running single method in test class with JUnit 4 from commandline without using Ant.    coderanch.com

One way would be to create a subclass of the BlockJUnit4ClassRunner and override the protected computeTestMethods() to return only the method(s) that you want to run, for instance the ones for which you specified a method name as a system property on the commandline (-D option). Though there must be another (simpler) way. I know the Eclipse test runner can run ...

5. [JUnit] Could not find the main class junit.awtui.TestRunner    coderanch.com

"Could not find the main class junit.awtui.TestRunner" On page 35 [Agile Java, Jeff Langr] Jeff specifies the command: java -cp .;C:\Programs\junit4.9\junit-4.9.jar junit.awtui.TestRunner StudentTest I am executing this from the directory where I just compiled my StudentTest class. [see p35], amending his instruction to accomodate my JUnit installation. I get an error back with 8 lines which includes the message: Could not ...

6. JUnit test for class dependent on being JAR'ed    coderanch.com

Hello, How do I unit test (JUnit) a class that is dependent upon the class being packaged in a JAR file? I have a class to read properties from the Maven POM property file, but that file doesn't have the /META-INF/ path until it is packaged. It seems JUnit runs on the .class files. Thanks, Mike

7. Help please! .class expected when compiling JUnit test?    java-forums.org

Hi, Im fairly new to java programming. I've been given an assignment to write a sorting algorithm and then test it using JUnit tests. The problem is when I try to compile the tester class I get a ".class expected" errors followed by three "; expected" errors for each test method I've written. Any help greatly appreciated! Here's my tester code: ...

8. JUnit - Test class not found in selected project    java-forums.org

package TestZPackage; import junit.framework.TestCase; import org.junit.After; import org.junit.Before; import org.junit.Test; import ZPackage.ZClass; public class ZClassTest extends TestCase { private ZClass zclass; @Before protected void setUp() throws Exception { super.setUp(); } @After protected void tearDown() throws Exception { super.tearDown(); } public ZClassTest(String arg0) { super(arg0); zclass = new ZClass(3.0,2.0,1.0); } @Test public final void testGetPower() { assertEquals(zclass.getPower(2.0), 11.0); } }

9. JUnit Testing/protected classes?    forums.oracle.com

Hi, I have tried the source folder option. I have created one and named it Junit. I then put my Junit Suite (single file) in there (it goes in the default package) and get no errors. I then place each of the test files in the default package of the junit source file and start getting visibility errors again :s

10. Class Not Found Error when using Junit    forums.oracle.com

11. JUnit Test Classes    forums.oracle.com

Thanks Alan Mehio, but my problem is, my class has method wich will generate one test file there is no other process takes place. And I want to write Test Class for such method ho can I do that? in this what will be my expected and actual output for the same??

12. Constructors in Junit classes?    forums.oracle.com

13. Use one JUnit test suite for two alternative class implementations    forums.oracle.com

George, that sounds like it might work. Just one place to change the target class, but still getting the right constructors called. MyClass1 and MyClass2 do not have a common superclass yet, but I can make one ... I presume I include only the public and protected members, and make them all abstract?

14. JUnit test for a method to list classes in a package    forums.oracle.com

If I understand it correctly, there are two strategies to get a list of class names (as strings) in a package; *When the project is not 'jarred', use File.dir to point to the right subdirectory and list out the .class files *When the project is 'jarred', use JarFile and openresource (or something similar) How do you write a unit test to ...

15. How to create test classes with JUnit?    forums.oracle.com

You should read the API docs for JUnit, in particular the class org.junit.Assert. Notice, for instance, that there's a bunch of overloaded assertEquals methods that would be preferable to using the equals methods of various classes under test. Other than that, you seem to already know how to create test classes, so what's the problem? Read [this book|http://www.amazon.co.uk/Test-Driven-Development-Practical-Guide/dp/0131016490/ref=sr_1_1?ie=UTF8&s=books&qid=1208506543&sr=8-1] for a good ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.