诱惑框架isn’;使用JunitCore时不会生成详细的报告

诱惑框架isn’;使用JunitCore时不会生成详细的报告,junit,report,allure,test-reporting,Junit,Report,Allure,Test Reporting,我正在使用JUnitCore运行Junit测试。 我正在尝试使用诱惑框架进行报道。 文档建议使用JUnitCore.addListener()添加AllureRunListener。 但是,不管我怎么做,诱惑报告都是空的。 它们显示运行的测试,也显示断言失败,但没有@step、@attachment 我试图搜索使用JunitCore而不是maven插件的allure report的例子,但找不到任何东西(使用maven运行测试工作正常,allure report一切正常) 如何做到这一点 Jun

我正在使用JUnitCore运行Junit测试。 我正在尝试使用诱惑框架进行报道。 文档建议使用
JUnitCore.addListener()
添加AllureRunListener。 但是,不管我怎么做,诱惑报告都是空的。 它们显示运行的测试,也显示断言失败,但没有
@step、@attachment

我试图搜索使用JunitCore而不是maven插件的allure report的例子,但找不到任何东西(使用maven运行测试工作正常,allure report一切正常)

如何做到这一点

JunitCore运行-

 public static void main(String[] args) {
        AllureRunListener allureListener =new AllureRunListener();

        JUnitCore core = new JUnitCore();
        core.addListener(allureListener);
        Result result = core.run(BuildNetworkTest.class);
        //Result result = core.runClasses(TestSuite.class);

        for (Failure failure : result.getFailures()) {
            System.out.println(failure.toString());
        }
        System.out.println(result.wasSuccessful());
    }
测试-

 @Test
    public void BuildNetwork(){
        try {
            Build buildFactory = new Build();
            System.out.println("running the BuildNetwork test in TestRunnerPac.BuildNetwork");
            StepTemp();
            attachmentTemp();
        }catch (Exception e)
        {
            System.out.println(e.getMessage());
            e.printStackTrace();
        }
    }

  @Step
    public void StepTemp(){
        assertThat("stepTemp").isEqualTo("stepTemp");
        System.out.println("In stepTemp..");
    }
    @Attachment
    public String attachmentTemp(){
        return "this is an attachmentTemp , hope it will work..";
    }

请确保使用指向aspectjweaver.jar的-javaagent参数启动测试,例如:

java -javaagent:"/path/to/aspectjweaver.jar" <the rest of the arguments>
java-javaagent:“/path/to/aspectjweaver.jar”

如果您使用的是Maven Surefire插件,那么请看下面关于如何执行此操作的内容。

这将修复此问题。谢谢