0

Building my first ant build.xml file to have Jenkins run Codeception tests and I'm receiving an error "--" is not permitted within comments

I know from reading elsewhere on stackoverflow that xml doesn't allow this. Cure for 'The string "--" is not permitted within comments.' exception?

The conundrum is that several Codeception commands start with --: --xml, --html, --env, etc.

 <target name="View" description="test for single aaView page">
        <exec executable="${codecept}" failonerror="true">
            <arg value="run" />
            <arg value="tests/acceptance/aaViewCept.php" />
            <arg value="--xml" />
            <arg value="${basedir}/browser/${browser}/tests/_output/report.xml "/>
            <arg value="--env" />
            <arg value="${browser}" />
        </exec>
    </target>

The kicker is that if I remove failonerror="true" Jenkins runs the test just fine. I'm experimenting with putting it in as Jenkins shows a passing build with failing test if I don't.

Community
  • 1
  • 1
CosetteN
  • 347
  • 1
  • 7
  • 18

1 Answers1

0

The parts =--" are not valid XML.

Use <arg value="--xml"/> and <arg value="--env" />

The value attribute of the arg element defines arguments passed to the executable and the -- is part of those arguments.

But if you put a XML comment around the <target> element the XML parser will indeed complain because now the -- are not allowed within the comment.

wero
  • 32,544
  • 3
  • 59
  • 84
  • argh. Sorry. That cut and paste was after a weird and uneducated attempt to remove the -- from the quotes to see if it would help. Will update original now. – CosetteN Apr 15 '16 at 17:28
  • @CosetteN do you have an XML comment starting with `` around the `target ` element? – wero Apr 15 '16 at 17:30
  • I do not have surrounding this code, but I do have it around other code. Removing it is allowing the test to run. Thank you. – CosetteN Apr 15 '16 at 17:31
  • I was expecting comments to work more like they do in PHP. I appreciate the link, thank you! – CosetteN Apr 15 '16 at 17:36