-
1. Re: Running SeamTest-based tests inside an applicatoin serve
pmuir Nov 4, 2007 4:46 PM (in response to dmitriy.lapko)Override the startJBossEmbededdedIfNecessary method with an empty body.
-
2. Re: Running SeamTest-based tests inside an applicatoin serve
dmitriy.lapko Nov 7, 2007 10:04 AM (in response to dmitriy.lapko)Thank you for answer, I tried to override it and the test started, but it breaks the application.
I getWARNING: No active application scope java.lang.IllegalStateException: No active application scope at org.jboss.seam.core.Init.instance(Init.java:75)
after its work.
And before test there is warning:
"There should only be one Seam phase listener per application"
So the problem is in method BaseSeamTest.init:public void init() throws Exception { startJbossEmbeddedIfNecessary(); // We should skip it application = new SeamApplication( new MockApplication() ); // reuse here existsing application phases = new SeamPhaseListener(); // reuse existing phase listener servletContext = new MockServletContext(); // reuse context initServletContext( servletContext.getInitParameters() ); // don't initialize it // And more and more... ServletLifecycle.beginApplication(servletContext); new Initialization(servletContext).create().init(); ( (Init) servletContext.getAttribute( Seam.getComponentName(Init.class) ) ).setDebug(false); conversationViewRootAttributes = new HashMap<String, Map>(); seamFilter = createSeamFilter(); for (ELResolver elResolver : getELResolvers()) { application.addELResolver(elResolver); } }
I mean, it looks like there should be done a lot of things to use tests in working application for testing deployment and web server compatibility.
Am I right or there is more simple way? -
3. Re: Running SeamTest-based tests inside an applicatoin serve
pmuir Nov 12, 2007 7:45 AM (in response to dmitriy.lapko)So you'll need to override init() :) Let us know how you get on. This could be of interest to others. You might also want to look at something like Selenium for testing inside an app server.
-
4. Re: Running SeamTest-based tests inside an applicatoin serve
dmitriy.lapko Nov 12, 2007 8:37 AM (in response to dmitriy.lapko)Yes, I managed to run SeamTests inside application server. I create TestNG instance, set the list of tests and call method run with overwritten empty startJBossEmbededdedIfNecessary(because I'm using Tomcat). And to omit previous posted error I just start TestNG in a new Thread, so all Seam's ThreadLocal variables are new and are not overwritten by newly started Seam Framework instance. Works pretty good :)
Results of tests I show dynamically on a page by a:poll tag. Clients are impressed :)