将自定义属性添加到 junit.xml 输出文件

问题描述 投票:0回答:1

我正在使用 Junit4 注释运行 Android Espresso 测试。完成后,它会生成一个 junit.xml 输出文件,如下所示:

<?xml version="1.0"?>
<testsuites tests="1" failures="0" name="UITests" time="12">
    <testsuite tests="1" failures="0" name="Test" time="232.9559440612793">
        <testcase classname="Test" name="test()" time="42.36027908325195">
        </testcase>
    </testsuite>
</testsuites>

但是我希望能够将我的测试用例导入到我们的测试用例管理工具中。为此,我需要向 junit.xml 文件添加一个属性。所以最终的结果应该是这样的:

<?xml version="1.0"?>
<testsuites tests="1" failures="0" name="UITests" time="12">
    <testsuite tests="1" failures="0" name="Test" time="232.9559440612793">
        <testcase classname="Test" name="test()" time="42.36027908325195">
            <properties>
                <!-- using a custom "test_id" property -->
                <property name="test_id" value="1234567" />
            </properties>
        </testcase>
    </testsuite>
</testsuites>

有没有一种简单的方法可以实现这一点,例如使用(自定义)注释?

android junit4 android-espresso
1个回答
0
投票

以上问题你得到答案了吗?请告诉我

© www.soinside.com 2019 - 2024. All rights reserved.