First time here? Check out the FAQ!
Hi,
I want to test my GUI with ZATS.
So for my first testcase I wanted to login with "no credentials", to test if "Wrong Login" message appears.
Since i never worked with ZATS, i tried the tutorial/getting started
(The example testcase is 1:1 my testcase, except that Hibernate is looking up the credentials)
@Test
public void emptylogin() {
DesktopAgent desktop = Zats.newClient().connect("/view/login/Login.zul");
ComponentAgent lblMsg = desktop.query("label");
ComponentAgent btnLogin = desktop.query("button");
btnLogin.click();
assertEquals("Name or Password is invalid", lblMsg.as(Label.class).getValue());
}
org.hibernate.Session hbnsession = HibernateUtil.getSessionFactory().getCurrentSession();
Query query = hbnsession.createQuery("from User where login_name = :name");
query.setString("name", name);
User tempUser = (User) query.uniqueResult();
And there is my problem. When the button is clicked, he throws
org.hibernate.HibernateException: createQuery is not valid without active transaction
My ZK project is working fine, verifies the login, so the code is working, but ZATS/JUnit can't get a valid session.
How do I solve this?
P.S.: ZK 7.0.1 / ZATS 1.2.0
Asked: 2014-03-28 07:58:34 +0800
Seen: 11 times
Last updated: Mar 28 '14
How to configure quartz to use Hibernate in Zk app? [closed]
zk hibernate session per conversation
where to put @Transactional (Hibernate Spring)
Is ZK compatible with hibernate 4.0
use Hibernate standard methods to manage Sessions ??
ZK + Hibernate validation using JSR
Where can I find a good template?