[jboss-user] [JBoss Seam] - Re: Question about SeamTest

dmitriy.lapko do-not-reply at jboss.com
Thu Nov 8 15:02:36 EST 2007


I'm trying to use SeamTest and with some success. 

But I have some unclear questions: 

1) If Seam is not bounded to JSF, why SeamTest should be bounded to JSF Phases? I just not really like for testing purposes use all these FacesRequest multiple implemnetations just to call a method of the component... And this doesn't add flexibility to my tests - e.g. if I want to pass any value from one call of FacesRequest to other I have to create a global field in class. 

2) If I use facinating Seam-features like EL in QL, I cannot unit test my application - I need all framework to be started to enable all these Interceptors for my code. What a pity... 

3) If you would like to prepare some test data before executing FacesRequest or to check what was really done in database - you cannot use current configuration of database and have to add your own to make queries. Annoying...

Because of complexity of configuration of tests and of using them (to write integrational test you have to know Seam like half as Gavin knows it...) they are just unusable for normal team member. I'm sure that SeamTest using should be simplified, now it is too complex.

For now I have next problems which I cannot solve:

1) I have two consecutive FacesRequest calls to methods, first of which should start long running conversation and second should end it. First marked by @Begin and second - by @End annotations. The problem is that they don't work in the same conversation - in second call I have:

new FacesRequest() {
  | 	@Override
  | 	protected void invokeApplication() {
  | 		invokeMethod("#{basket.createBasket}");
  | 	}
  | 	@Override
  | 	protected void renderResponse() throws Exception {
  | 		assert Manager.instance().isLongRunningConversation();
  | 	}
  | }.run();
  | 
  | new FacesRequest() {
  | 	@Override
  | 	protected void updateModelValues() throws Exception {
  | 		assert Manager.instance().isLongRunningConversation();
  | 	}			
  | 	@Override
  | 	protected void invokeApplication() {
  | 		invokeMethod("#{basket.saveBasket}");
  | 	}
  | }.run();
  | 

So first assertion inside first request passed successfully. Second - fails. Why?

2) I run my unit tests inside the deployed and started application. I want to do it also with SeamTests. But disabling of starting embedd ejb container didn't help - anyway a new SeamPhaseListener is started and all other stuff which breaks the application inside which everything was started.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103078#4103078

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103078



More information about the jboss-user mailing list