samedi 3 janvier 2015

Print message in testcase in junit

I want to print message in my test class and when I write that instruction but not worked and this my code in eclipse:



package com.stpt.project;

import java.sql.ResultSet;

import junit.framework.TestCase;

public class Year_in_deptTest extends TestCase {
public void testyear_in_dept(String dept_name) {

System.out.println("dd"); //any result display in console
ResultSet rs = new course().course_in_dept("Accounting"); // this code for returning database result for testing
int[] a = new int[] { 1992, 1993 };
try {
int i = 0;
while (rs.next()) {
int id = Integer.parseInt(rs.getString("year"));
System.out.println("\n" + id);
assertEquals(id, a[i]);
i++;
}
} catch (Exception e) {

}
}
}


How I can print it?


Aucun commentaire:

Enregistrer un commentaire