Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support messages directly under test in output.xml #3762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
karkusviktor opened this issue Nov 16, 2020 · 5 comments
Closed

Support messages directly under test in output.xml #3762

karkusviktor opened this issue Nov 16, 2020 · 5 comments

Comments

@karkusviktor
Copy link

Running rebot aginst the following xml results in "failed: Incompatible XML element 'msg'." error message

<?xml version="1.0" encoding="UTF-8"?>
<robot>
  <suite source="suiteSource" name="suiteName">
        <test id="A" name="test A">
          <msg timestamp="20201116 08:29:45.100" level="WARN">Hi from test - doesn't work</msg>
          <kw name="log">
            <msg timestamp="20201116 08:29:45.100" level="WARN">Hi from keyword - does work</msg>
          </kw>
          <status status="PASS" starttime="20201116 08:29:45.130" endtime="20201116 08:29:45.140"></status>
        </test>
  </suite>
</robot>

It only works of the msg under test tag is removed even though it is valid according to the schema:

<xs:complexType name="test">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="kw" type="kw"/>
<xs:element name="msg" type="msg"/>
<xs:element name="doc" type="xs:string"/>
<xs:element name="tags" type="tags"/>
<xs:element name="timeout" type="timeout"/>
<xs:element name="status" type="status"/>
</xs:choice>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="id" type="xs:string"/>
<xs:anyAttribute processContents="lax"/>
</xs:complexType>

<xs:complexType name="test">
<xs:all>
<xs:element name="kw" type="kw" maxOccurs="unbounded" minOccurs="0"/>
<xs:element name="msg" type="msg" minOccurs="0"/>
<xs:element name="doc" type="xs:string" minOccurs="0"/>
<xs:element name="tags" type="tags" minOccurs="0"/>
<xs:element name="timeout" type="timeout" minOccurs="0"/>
<xs:element name="status" type="status"/>
</xs:all>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="id" type="xs:string"/>
<xs:anyAttribute processContents="lax"/>
</xs:complexType>

@pekkaklarck
Copy link
Member

The reason for this behavior is that Robot itself cannot create output.xml where <test> would directly have <msg>. Changing output.xml parsing to support that would be trivial and based on a quick test also log.html would look fine. What kind of use case do you have for this functionality? This could still be change before RF 4.0 rc 1.

The schema clearly doesn't match the reality at the moment. If we don't change the implementation, then the schema needs to be updated. It needs to be updated in the very near future anyway (#3726).

@bitcoder
Copy link
Contributor

Hi @pekkaklarck , I checked on my end and it seems that <msg> at the <test> element is not used and can be safely removed.
When I read the schema I thought "well, this is probably for an overall placehold for output information related to this test, such as stdout/stderr"... however, that info may be on the <msg> element inside the <kw> elements.
If you or anyone doesn't see a use case for it, I would say to remove the support for the element at the <test> level.

@pekkaklarck
Copy link
Member

Certainly nobody currently uses <msg> directly under <test> because Robot fails to parse output.xml like that. Changing that would be trivial and based on my experiment it seems log.html would also look fine. I'm actually pretty certain that earlier creating log.html would have failed but the order of messages and keywords being preserved (#2086) has changed that.

@karkusviktor
Copy link
Author

The use case is marginal. We create an output.xml manually and use rebot to create a nice report out of it.
This issue is more of a heads-up that the xsd doesn't match the code parsing the xml in rebot.

@pekkaklarck
Copy link
Member

Thanks for the update @karkusviktor! I agree the schema being wrong is the bigger problem here. That said, I think supporting messages directly under test is a good idea for these two reasons:

@pekkaklarck pekkaklarck added this to the v4.0 milestone Mar 2, 2021
@pekkaklarck pekkaklarck changed the title Rebot complains Incompatible XML element 'msg'. even though the xml validates Support messages directly under test in output.xml Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants