遇一山,过一山,处处有风景;只要勇敢向前,一路尽是繁花盛开。 | (点击查看→)【测试干货】python/java自动化、持续集成、性能、测开、简历、笔试面试等

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  全栈测试笔记  阅读(61)  评论(0)    收藏  举报
浏览器标题切换
浏览器标题切换end