alguem poderia me sugerir algumas, tenho que fazer um trabalho na faculdade utilizando uma, mais queria pegar uma facil de utilizar e que seja boa… alguma sugestao???
JUNIT e um bom framework pra testar seu codigo
segue abaixo o link de como usa-lo
Investigue o Selenium
Err… Uma boa sugestão de livro é o JUnit in Action, da Manning. Ele não apenas trata do JUnit, mas dá uma boa visão geral de toda a idéia do Test Driven Development, e procura explorar todo o ecossistema dos testes em Java.
A partir daí, o que temos é apenas variações sobre o mesmo tema.
Para aplicações Swing temos o Abbot / Costelo
testng
Conheço o JUnit e o JTest
Pessoal tenho q implementar um teste de unidade para a classe DaoEmail( q esta aí em baixo) mas o JUnit deve rodar independente do estado do banco de dados. Alguem pode dar alguma dica de como fazer?
public class DaoEmail {
private Connection conexao;
public ResultSet res = null;
public DaoEmail() throws SQLException {
this.conexao = ConexaoHSQLDB.getConnection();
}
public boolean inserir(Email mail) {
boolean testa = false;
try {
Statement stmt = this.conexao.createStatement();
String query = "INSERT INTO EMAIL(id,email,id_contato)VALUES("
+ null + ",'" + mail.getEmail() + "','"
+ mail.getId_contato() + "')";
res = stmt.executeQuery(query);
stmt.close();
testa = true;
} catch (SQLException e) {
System.out.println("Erro duranta a inserção:" + e.getMessage());
}
return testa;
}
public boolean excluir(int id) {
boolean testa = false;
try {
Statement stmt = this.conexao.createStatement();
String query = "DELETE FROM EMAIL WHERE id_contato=" + id;
res = stmt.executeQuery(query);
stmt.close();
testa = true;
} catch (SQLException e) {
System.out.println("Erro duranta a exclusão:" + e.getMessage());
}
return testa;
}
public boolean listar() {
boolean testa = false;
try {
Statement stmt = this.conexao.createStatement();
String query = "SELECT EMAIL FROM EMAIL;";
res = stmt.executeQuery(query);
while (res.next()) {
String e = res.getString("email");
System.out.println(e);
System.out.println();
}
stmt.close();
if (res.next()) {
testa = true;
} else {
testa = false;
}
} catch (SQLException e) {
System.out.println("Erro duranta a pesquisa:" + e.getMessage());
}
return testa;
}
public boolean listar_por_id(int id) {
boolean testa = false;
try {
Statement stmt = this.conexao.createStatement();
String query = "SELECT EMAIL FROM EMAIL WHERE id_contato=" + id;
res = stmt.executeQuery(query);
while (res.next()) {
String e = res.getString("email");
System.out.println(e);
System.out.println();
}
stmt.close();
if (res.next()) {
testa = true;
} else {
testa = false;
}
} catch (SQLException e) {
System.out.println("Erro duranta a pesquisa:" + e.getMessage());
}
return testa;
}
}