mac Gradle idea中启动单元测试

一、gradle 单元测试代码

    @Test
    public void posterTest() throws Exception {

        long startTime = System.currentTimeMillis();

        ProductService service = new FakeProductService();
        Product product = service.get(0L);

        Map<String, String> params = new HashMap<>();
        params.put("width", "11024");
        params.put("height", "7874");
        params.put("pictureIds", "1524461,1524462");
        }

使用了junit5.4

二、mac 中idea 中启动单元测试步骤

在这里插入图片描述

选择Edit Configurations

在这里插入图片描述

add New Configuration

在这里插入图片描述

在这里插入图片描述

run 中配置你的单元测试类信息

:main:test --tests "com.fancv.first.Tester"

注意

直接使用右键 run 会报模块找不到的错误

总结

gradle 适合Android 开发配置,对于一般的服务端项目,不建议使用。