方向不对,努力白费,经验类测试技术才是职场重要保险! | (点击→)【公告】精力有限,博客暂停更新,最新分享干货请联系作者vx了解

SpringBoot中测试报错:org.junit.vintage.engine.descriptor.RunnerTestDescriptor warnAboutUnfilterableRunner

测试代码:

package com.qzcsbj.demo;

import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @description : <描述>
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class MyTest {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    // 使用StringRedisTemplate对象
    @Test
    public void test1(){
        stringRedisTemplate.opsForValue().set("job","dev");
        System.out.println("set字符串完成。");
        String job = stringRedisTemplate.opsForValue().get("job");
        System.out.println("获取到的job: " + job);
    }
}

 

结果

 

方案:

把@Test导包:import org.junit.jupiter.api.Test;

改为:import org.junit.Test;

 

 

posted @ 2023-02-10 07:37  全栈测试笔记  阅读(66)  评论(0)    收藏  举报
浏览器标题切换
浏览器标题切换end