Getting FacesTesterException when trying to perform a test

  3 posts   Feedicon  
Replies: 2 - Last Post: April 06, 2009 19:37
by: pbodsk
« Older Topic » Newer Topic
showing 1 - 3 of 3
 
Posted: April 03, 2009 19:23 by pbodsk
Hi

First of all, this looks very interesting Smile

I've tried to get things running by looking at the example on Rod's blog (http://blog.rodcoffin.com/?p=137).

So far my test looks like this:


public class WhenClickingTheLoginButton {
@Test
public void shouldDisplayGreetingToUserNamedInUsernameField(){
FacesTester tester = new FacesTester();
FacesPage page = tester.requestPage("/pages/index.xhtml");
}
}



Nothing too complicated, but I'd like to start out easily, just to see if I can get things working.

However, when I try to run this test I get this stack trace:

com.steeplesoft.jsf.facestester.FacesTesterException: The facestester.webAppPath system property has not been set and could not calculated.
at com.steeplesoft.jsf.facestester.servlet.ServletContextFactory.lookupWebAppPath(ServletContextFactory.java:64)
at com.steeplesoft.jsf.facestester.servlet.ServletContextFactory.createServletContext(ServletContextFactory.java:23)
at com.steeplesoft.jsf.facestester.FacesTester.<init>(FacesTester.java:29)
at dk.piskeris.unittests.WhenClickingTheLoginButton.shouldDisplayGreetingToUserNamed
InUsernameField(WhenClickingTheLoginButton.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


My setup is Eclipse 3.4.0 with a GlassFish server. I've got the following jar files in my WEB-INF/lib folder:


facestester-0.1.jar
jsf-facelets.jar
junit-4.5.jar
spring.jar


(spring version is 2.5.6)

Obviously I'm missing something and it is probably something very basic, but if someone could point me in the general direction of the solution, this would be very much appreciated.

Oh, and keep up the good work Smile
 
Posted: April 06, 2009 17:52 by Barrett
p:

The stack trace itself told you what is wrong.

"The facestester.webAppPath system property has not been set and could not calculated."

So pass in -Dfacestester.webAppPath=CHmmmyourDrive/path/to/folder/whereWeb-InfIs/
to JUnit in your Run Configuration and it should work fine. Smile
 
Posted: April 06, 2009 19:37 by pbodsk
Hi Barrett

Thank you for your answer. You were absolutely right (but I guess you already knew that..didn't you Wink)

Adding -Dfaces.webAppPath=<path/to/my/app> as a VM argument did the trick and sent me straight to the next stack trace..which I managed to solve, so now I've actually got a test running. Fantastic!

One again, thank you for your answer.
Replies: 2 - Last Post: April 06, 2009 19:37
by: pbodsk
« Older Topic » Newer Topic
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close