5 Replies Latest reply on Dec 6, 2007 4:18 AM by olivier.mallassi

    AbstractViewTestCase and exception when parsing JSP?

    olivier.mallassi

      hi all,

      i am trying to realise an AbstractViewTestCase test case and i got the following stackt trace

      junit.framework.AssertionFailedError: Exception in constructor: testActions (java.lang.RuntimeException: Could not parse file 'C:\dev\
      \mycompany-appliblanche\trunk\mycompany-applicationblanche-jsf\src\main\webapp\views\search-autocomplete.jsp'
       at org.jboss.jsfunit.analysis.AbstractViewTestCase.parseResources(AbstractViewTestCase.java:117)
       at org.jboss.jsfunit.analysis.AbstractViewTestCase.<init>(AbstractViewTestCase.java:98)
       at org.jboss.jsfunit.analysis.AbstractViewTestCase.<init>(AbstractViewTestCase.java:51)
       at org.jboss.jsfunit.analysis.AbstractViewTestCase.<init>(AbstractViewTestCase.java:55)
       at fr.mycompany.ViewTestCase.<init>(ViewTestCase.java:18)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
       at java.lang.reflect.Constructor.newInstance(Unknown Source)
       at junit.framework.TestSuite.createTest(TestSuite.java:131)
       at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
       at junit.framework.TestSuite.<init>(TestSuite.java:75)
       at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102)
       at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
       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)
      Caused by: org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
       at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
       at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
       at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
       at org.jboss.jsfunit.analysis.AbstractViewTestCase.parseResources(AbstractViewTestCase.java:115)
       ... 17 more
      )
       at junit.framework.Assert.fail(Assert.java:47)
      .....
      


      The JSP i wanna test starts like this
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      
      <%@ taglib uri="http://www.mycompany.fr/jsf/component" prefix="mycompany"%>
      
      <f:view
      

      so this page is not an XML document....

      does JSFUnit only work with JSPX pages? it seems so because if i replace <%@taglib with <f:view xmlns:h="..., the test works.
      can you give me clues about the interest of using JSPX instead of JSP? for me this is quite the same...

      many thx