简体   繁体   中英

How does one pass codeception commands that start with “--” via ant to Jenkins?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM