1 2 >   Sort: Rank

How Many Test Runners Are Supported in JUnit 3.8?
How Many Test Runners Are Supported in JUnit 3.8? JUnit 3.8 supports 3 test runners: junit.textui.TestRunner - A command line based tool to run tests. TestRunner expects the name of a TestCase class as argument. If this class defines a static suite method it will be invoked and the returned test is ...
2008-03-04, 5623👍, 0💬

What Is JUnit TestSuite?
What Is JUnit TestSuite? JUnit TestSuite is a container class, junit.framework.TestSuite, used in JUnit 3.8 that allows you to group multiple test cases into a collection and run them together. TestSuite class is no longer supported in JUnit 4.4. Each test runs in its own fixture so there can be no ...
2008-03-04, 5600👍, 0💬

What Is JUnit TestCase?
What Is JUnit TestCase? JUnit TestCase is the base class, junit.framework.TestCase, used in JUnit 3.8 that allows you to create a test case. TestCase class is no longer supported in JUnit 4.4. A test case defines the fixture to run multiple tests. To define a test case Implement a subclass of TestCa...
2008-02-26, 5694👍, 0💬

Do You Need to Write a Test Class for Every Class That Need to Be Tested?
Do You Need to Write a Test Class for Every Class That Need to Be Tested? This is a simple question. But the answer shows your organization skills. The technical answer is no. There is no need to write one test class for each every class that need to be tested. One test class can contain many tests ...
2008-02-26, 5404👍, 0💬

Under What Conditions Should You Not Test Get() and Set() Methods?
Under What Conditions Should You Not Test Get() and Set() Methods? The JUnit FAQ provides a good answer to this question: Most of the time, get/set methods just can't break, and if they can't break, then why test them? While it is usually better to test more, there is a definite curve of diminishing...
2008-02-19, 5381👍, 0💬

Under What Conditions Should You Test set() and get() Methods?
Under What Conditions Should You Test set() and get() Methods? This is a good question for a job interview. It shows your experience with test design and data types. Tests should be designed to target areas that might break. set() and get() methods on simple data types are unlikely to break. So no n...
2008-02-12, 5392👍, 0💬

Why Not Just Use System.out.println() for Unit Testing?
Why Not Just Use System.out.println() for Unit Testing? Inserting debug statements into code is a low-tech method for debugging it. It usually requires that output be scanned manually every time the program is run to ensure that the code is doing what's expected. It generally takes less time in the ...
2008-02-12, 5646👍, 0💬

Why Not Just Write a main() Method for Unit Testing?
Why Not Just Write a main() Method for Unit Testing? It is possible to write a main() method in each class that need to be tested for unit testing. In the main() method, you could create test object of the class itself, and write some tests to test its methods. However, this is not a recommended app...
2008-02-06, 5406👍, 0💬

Why Not Just Use a Debugger for Unit Testing?
Why Not Just Use a Debugger for Unit Testing? This is a common question in a job interview. You should answer it with these points: A debugger is designed for manual debugging and manual unit testing, not for automated unit testing. JUnit is designed for automated unit testing. Automated unit testin...
2008-02-06, 5237👍, 0💬

What Is the "@SuiteClasses" Annotation?
What Is the "@SuiteClasses" Annotation? "@SuiteClasses" is a class annotation defined in JUnit 4.4 in org.junit.runners.Suite.SuiteC lasses.It allows you to define a suite class as described in the previous question. By the way, the API document of JUnit 4.4 has a major typo for the org.junit.runner...
2008-01-31, 6638👍, 0💬

How To Run a "@Suite.SuiteClasses" Class in JUnit 4.4?
How To Run a "@Suite.SuiteClasses" Class in JUnit 4.4? If you define create "@Suite.SuiteClasses" class as described in the previous question, you run it with the core runner: org.junit.runner.JUnitCore: java -cp .;junit-4.4.jar org.junit.runner.JUnitCore AllTests JUnit version 4.4 ....E.E Time: 0.0...
2008-01-31, 5777👍, 0💬

How To Group Multiple Test Classes into a Suite in JUnit 4.4?
How To Group Multiple Test Classes into a Suite in JUnit 4.4? JUnit 4.4 stops using the "public static Test suite()" method to build a test suite class. It is now provides the org.junit.runners.Suite class and two annotations to help you to build test suite. org.junit.runners.Suite - JUnit 4.4 runne...
2008-01-29, 5344👍, 0💬

Why Does Poeple Import org.junit.Assert Statically
Why Does Poeple Import org.junit.Assert Statically? Poeple use the static import statement on org.junit.Assert to save coding time on calling its assetion methods. With a normal import statement, assertion method names must qualified with the class name like this: import org.junit.Assert; ... Assert...
2008-01-29, 5121👍, 0💬

What Happens If a JUnit Test Method Is Declared to Return "String"
What Happens If a JUnit Test Method Is Declared to Return "String"? If a JUnit test method is declared to return "String", the compilation will pass ok. But the execution will fail. This is decause JUnit requires that all test methods must be declared to return "void". For example: type HelloTestNon...
2008-01-24, 5312👍, 0💬

What Happens If a JUnit Test Method Is Declared as "private"
What Happens If a JUnit Test Method Is Declared as "private"? If a JUnit test method is declared as "private", the compilation will pass ok. But the execution will fail. This is decause JUnit requires that all test methods must be declared as "public". For example: type HelloTestPrivate.java import ...
2008-01-24, 5313👍, 0💬

Can You Provide a List of Assertion Methods Supported by JUnit 4.4
Can You Provide a List of Assertion Methods Supported by JUnit 4.4? You should be able to answer this question by looking up the org.junit.Assert class API document. Here is a list of assertino methods supported by JUnit 4.4: assertEquals(expected, actual) assertEquals(message, expected, actual) ass...
2008-01-22, 5022👍, 0💬

How To Write a JUnit Test Method
How To Write a JUnit Test Method? This interview question is to check if you know the basic rules about writing a JUnit test method: You need to mark the method as a JUnit test method with the JUnit annotation: @org.junit.Test. A JUnit test method must be a "public" method. This allows the runner cl...
2008-01-22, 5743👍, 0💬

How Do You Uninstall JUnit?
How Do You Uninstall JUnit Uninstalling JUnit is easy. Just remember these: Delete the directory that contains the JUnit JAR file and other JUnit files. Remove the JUnit JAR file from the CLASSPATH environment variable. No need to stop any background processes, because JUnit does not use background ...
2008-01-17, 7195👍, 0💬

How Do I Run JUnit Tests from Command Window
How Do I Run JUnit Tests from Command Window? To run JUnit tests from a command window, you need to check the following list: 1. Make sure that JDK is installed and the "java" command program is accessible through the PATH setting. Type "java -version" at the command prompt, you should see the JVM r...
2008-01-17, 6772👍, 0💬

What CLASSPATH Settings Are Needed to Run JUnit
What CLASSPATH Settings Are Needed to Run JUnit? It doesn't matter if you run your JUnit tests from a command line, from an IDE, or from "ant", you must define your CLASSPATH settings correctly. Here is what recommended by the JUnit FAQ with some minor changes: To run your JUnit tests, you'll need t...
2008-01-15, 7012👍, 0💬

How To Run a JUnit Test Class
How To Run a JUnit Test Class? A JUnit test class usually contains a number of test methods. You can run all test methods in a JUnit test class with the JUnitCore runner class. For example, to run the test class HelloTest.java described previously, you should do this: java -cp .;junit-4.4.jar org.ju...
2008-01-15, 6685👍, 0💬

How To Compile a JUnit Test Class
How To Compile a JUnit Test Class? Compiling a JUnit test class is like compiling any other Java classes. The only thing you need watch out is that the JUnit JAR file must be included in the classpath. For example, to compile the test class HelloTest.java described previously, you should do this: ja...
2008-01-11, 7046👍, 0💬

How To Wirte a Simple JUnit Test Class
How To Wirte a Simple JUnit Test Class? This is a common test in a job interview. You should be able to write this simple test class with one test method: import org.junit.*; // by FYICenter.com public class HelloTest { @Test public void testHello() { String message = "Hello World!"; Assert.assertEq...
2008-01-11, 8692👍, 0💬

What Articles Have You Read about JUnit
What Articles Have You Read about JUnit? There are a number of JUnit articles that you should read: "JUnit Primer" by Clarkware Consulting, Inc.. This article demonstrates a quick and easy way to write and run JUnit test cases and test suites. "JUnit FAQ" by Mike Clark. A collection of requently ask...
2008-01-09, 9106👍, 0💬

1 2 >   Sort: Rank