opengeospatial / ets-ogcapi-features10

Public Repository for the OGC API - Features Compliance Test Suite
Other
16 stars 6 forks source link

SAXParseException while trying to run tests #230

Closed wojciechZubOS closed 8 months ago

wojciechZubOS commented 8 months ago

After last changes we have this exception while trying to execute tests:

Exception in thread "main" org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber: 57; columnNumber: 26; The content of element type "packages" must match "(package)*". at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:20) at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:9) at org.testng.xml.Parser.parse(Parser.java:172) at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:363) at org.testng.TestNG.run(TestNG.java:1036) at com.occamlab.te.spi.executors.testng.TestNGExecutor.execute(TestNGExecutor.java:123) at org.opengis.cite.ogcapifeatures10.TestNGController.doTestRun(TestNGController.java:153) at org.opengis.cite.ogcapifeatures10.TestNGController.main(TestNGController.java:79) Caused by: org.xml.sax.SAXParseException; lineNumber: 57; columnNumber: 26; The content of element type "packages" must match "(package)*". at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:135) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:395) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:326) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:283) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:1993) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:878) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1781) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2966) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:601) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:504) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:642) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:326) at javax.xml.parsers.SAXParser.parse(SAXParser.java:195) at org.testng.xml.XMLParser.parse(XMLParser.java:39) at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:16) ... 7 more

dstenger commented 8 months ago

Thank you for reporting. Can you please provide more details about the workflow you are using to execute the tests? Also, which version of the test suite, which Java version and which Tomcat version (in case you execute the tests with Tomcat) are you using?

wojciechZubOS commented 8 months ago

Thank you for replay. It is a part of our azure pipeline, this is a build step:

- job: Build_OGC_Tests
        pool:
          vmImage: ubuntu-latest
        steps:
          - task: Bash@3
            displayName: Clone OGC API
            inputs:
              targetType: inline
              script: |
                cd $(Pipeline.Workspace)
                mkdir testsuite
                git clone https://github.com/opengeospatial/ets-ogcapi-features10.git testsuite

        .
        .
        .
         here we have steps to exclude optional test methods
        .
        .
        .
          - task: Maven@3
            displayName: Build OGC API
            inputs:
              mavenPomFile: $(Pipeline.Workspace)/testsuite/pom.xml
              goals: clean package
              options: ""

          - task: PublishPipelineArtifact@1
            displayName: Publish OGC test properties
            inputs:
              targetPath: conformance-test-suite/properties
              artifactName: conformanceProperties

          - task: PublishPipelineArtifact@1
            displayName: Publish OGC test artifacts
            inputs:
              targetPath: $(Pipeline.Workspace)/testsuite/target
              artifactName: conformanceTests

and then we run it:

pool:
      vmImage: windows-latest
    jobs:
      - job: Run_OGC_Tests
        displayName: Run the OGC API
        steps:
          - checkout: none
           .
           .
           .
adding access rules
downloading test properties and artifacts 
           .
           .
           .
          - task: Bash@3
            displayName: Run Test Suite
            inputs:
              targetType: inline
              workingDirectory: $(Pipeline.Workspace)
              script: |
                mkdir results
                java -jar *-aio.jar -o results -h true ${{ parameters.testSuiteProperties }}
dstenger commented 8 months ago

Thanks for the information. So, you are using the *-aio.jar for execution. If I interpret it correctly, you are using the current master branch for your test executions. Here, I would recommend to use either a tag (each release version has its own tag) or to download the JAR from Maven Central Repository. E.g.: https://repo1.maven.org/maven2/org/opengis/cite/ets-ogcapi-features10/1.6/ets-ogcapi-features10-1.6-aio.jar

When I execute this command

stenger@elsbeere:~/git/ets-ogcapi-features10/target$ java -jar ets-ogcapi-features10-1.7-SNAPSHOT-aio.jar -o results -h true ../src/main/config/test-run-props.xml 

with test-run-props.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties version="1.0">
  <comment>Sample test run arguments (ets-ogcapi-features10)</comment>
  <entry key="iut">https://cite.deegree.org/deegree-ogcapi-1.3/datasets/kitaeinrichtung</entry>
  <entry key="noofcollections">3</entry>
</properties>

the execution is successful:

...
Test results: file:/home/stenger/git/ets-ogcapi-features10/target/results/testng/1c398921-4a80-42c7-89e3-880c7679c67d/testng-results.xml

So, I need more information to reproduce your error. Are you definitively using Java 8? Can you recall when it worked for the last time? Is this a new problem? What is the content of your test-run-props.xml?

wojciechZubOS commented 8 months ago

Thank you for your help, it turned out to be our fault. We are modifying "testng.xml" configuration file by appending to it test method exclusion. Our script started to fail after someone added one line to "testng.xml" in master branch. It was weird bash "sed" command thing, it started to append our configuration in wrong place.