Skip to content

Detect ReqM2 preamble #197

@redcatbear

Description

@redcatbear

Is your feature request related to a problem? Please describe.
OFT auto-detects files by extension. Unfortunately ReqM2's extension is to generic (.xml) this leads to other XML files unnecessarily being scanned, which has two consequences:

  1. The import is slower than necessary because it could skip files which are do not contain ReqM2 content.
  2. Lots of error messages about unknown XML content are dumped to STDERR

Describe the solution you'd like
When an XML file is about to be imported, OFT should check whether it really contains ReqM2 content. This comes in two variants at the moment:

  1. Plain ReqM2 file
  2. DocBook file with embedded ReqM2 content (supported but not really recommended)

Describe alternatives you've considered

  • Enforcing a strict extension (e.g. .reqm2): While being perfect for OFT this has the downside that it breaks compatibility and also that XML Editors don't know this extensions by default.
  • Enforcing a compound extension (.reqm2.xml): Works for OFT and XML editors. Downsides are that it is clunky and still breaks compatibility.

Additional context
This is an excerpt of example error output:

Nov 17, 2018 1:11:57 PM org.itsallcode.openfasttrace.importer.specobject.handler.SpecDocumentHandlerBuilder lambda$0
INFO: Found unknown root element TreeElement [element=StartElementEvent [qName=testsuite, attributeMap={tests=Attribute [qName=tests, value=5], failures=Attribute [qName=failures, value=0], xsi:noNamespaceSchemaLocation=Attribute [qName=xsi:noNamespaceSchemaLocation, value=https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd], name=Attribute [qName=name, value=org.itsallcode.openfasttrace.importer.input.TestStreamInput], xmlns:xsi=Attribute [qName=xmlns:xsi, value=http://www.w3.org/2001/XMLSchema-instance], time=Attribute [qName=time, value=0.001], errors=Attribute [qName=errors, value=0], skipped=Attribute [qName=skipped, value=0]}, location=/home/johndoe/git/openfasttrace/target/surefire-reports/TEST-org.itsallcode.openfasttrace.importer.input.TestStreamInput.xml:2:309], characterData=, endElementListeners=[]]: skip file

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    ✅ Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions