You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Julien Martin <ba...@gmail.com> on 2011/07/12 19:11:29 UTC

Unit testing Tapestry within intellij?

Hello,
I am trying to follow the unit testing tutorial provided here:
http://tapestry.apache.org/unit-testing-pages-or-components.html and I am
not able to run the tests from Intellij. Here is what I get:

*com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4
tests.CreateJobPosting
log4j:WARN No appenders could be found for logger
(org.apache.tapestry5.ioc.RegistryBuilder).
log4j:WARN Please initialize the log4j system properly.

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2444)
    at java.lang.Class.privateGetPublicMethods(Class.java:2564)
    at java.lang.Class.getMethods(Class.java:1427)
    at
org.apache.tapestry5.ioc.internal.DefaultModuleDefImpl.<init>(DefaultModuleDefImpl.java:148)
    at
org.apache.tapestry5.ioc.RegistryBuilder.add(RegistryBuilder.java:124)
    at
org.apache.tapestry5.internal.TapestryAppInitializer.addModules(TapestryAppInitializer.java:186)
    at
org.apache.tapestry5.internal.TapestryAppInitializer.<init>(TapestryAppInitializer.java:136)
    at org.apache.tapestry5.test.PageTester.<init>(PageTester.java:106)
    at tests.CreateJobPosting.test1(CreateJobPosting.java:21)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    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.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
    at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:71)
    at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:199)
    at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.ClassNotFoundException:
javax.servlet.http.HttpServletRequest
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    ... 36 more


Process finished with exit code 255
*
Can anyone please help me: I am new to Tapestry and Intellij...

Thanks in advance,

Julien.

PS. Here is the content of my java class:

*public class CreateJobPosting{

    @Test
    public void test1() {
        String appPackage = "com.cheetah.web";
        String appName = "app";
        PageTester tester = new PageTester(appPackage, appName,
"src/main/webapp");
        Document doc = tester.renderPage("CreateJobPosting");
    }
}
*

Re: Unit testing Tapestry within intellij?

Posted by Julien Martin <ba...@gmail.com>.
yes. I actually sorted the problem. I had forgotten to include servet api as
a provided dependency in my pom.xml.
Thanks Mark.
Julien.

2011/7/14 Mark <ma...@xeric.net>

> Do you actually have a page in com.cheetah.web.pages that is called
> CreateJobPosting that you can view in a web browser when the app is
> running?
>
> Mark
>
>
> On Tue, Jul 12, 2011 at 12:11 PM, Julien Martin <ba...@gmail.com> wrote:
>
> > *public class CreateJobPosting{
> >
> >    @Test
> >    public void test1() {
> >        String appPackage = "com.cheetah.web";
> >        String appName = "app";
> >        PageTester tester = new PageTester(appPackage, appName,
> > "src/main/webapp");
> >        Document doc = tester.renderPage("CreateJobPosting");
> >    }
> > }
> > *
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Unit testing Tapestry within intellij?

Posted by Mark <ma...@xeric.net>.
Do you actually have a page in com.cheetah.web.pages that is called
CreateJobPosting that you can view in a web browser when the app is
running?

Mark


On Tue, Jul 12, 2011 at 12:11 PM, Julien Martin <ba...@gmail.com> wrote:

> *public class CreateJobPosting{
>
>    @Test
>    public void test1() {
>        String appPackage = "com.cheetah.web";
>        String appName = "app";
>        PageTester tester = new PageTester(appPackage, appName,
> "src/main/webapp");
>        Document doc = tester.renderPage("CreateJobPosting");
>    }
> }
> *
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org