I’m trying to run a test using JUnit in Eclipse but the test case is not running and the holly console not showing anything. The only line appears in console is :
<terminated>AccountManagmentModuleTest[JUnit] D:\Program Files\Java\jdk1.6.0_26\bin\javaw.exe(Nov 23, 2012 12:08:49 PM)
All I want to do is run the test case. Some lines are executing, like starting to connect to db, but no connection object created using DriverManager, also don’t throw any exception.
enter code here
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
conn = DriverManager.getConnection("jdbc:oracle:oci8:@local ip:1521:orcl", "dipak1","dipak1"); //got to finally from here, not even catching anything!!!
cstmt = conn.prepareCall(query);
cstmt.execute();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null != conn) {
if (null != cstmt) {
cstmt.close();
}
conn.close();
}
}
It sounds like your test is executing but not producing the outputs you expect. Ensure you have the JUnit view open:
Window > Show View > Other… > Java > JUnit
This view will show you visually how many tests have run and how many have passed. If the tests are failing, you can right-click on the failed tests and debug them. You can also see the exceptions that have occurred.
The Console window won’t show you any output from your JUnit tests unless you’ve including output statements in your test (either through a logging framework or simple
printlnstatements). Only the JUnit view will show you whether your tests passed.