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

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

测试代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 @   全栈测试笔记  阅读(51)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
浏览器标题切换
浏览器标题切换end
点击右上角即可分享
微信分享提示