参数化单元测试

简介: 参数化单元测试

今天进行streampark参数化单元测试,用来测试多个数据库下的兼容情况

package org.apache.streampark;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.streampark.console.core.entity.Application;
import org.apache.streampark.console.core.mapper.ApplicationMapper;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * MapperTest
 */
class MapperTest {

    @ParameterizedTest
    @ValueSource(strings = {"pgsql", "mysql", "h2"})
    void test(String profile) {
        System.setProperty("spring.profiles.active", profile);
        try (ConfigurableApplicationContext context = new SpringApplicationBuilder(StreamParkConsoleBootstrap.class).profiles(profile).run()) {
            ApplicationMapper applicationMapper = context.getBean(ApplicationMapper.class);
            Application app = new Application();
            app.setProjectName("test");
            Assertions.assertDoesNotThrow(() -> applicationMapper.page(new Page<>(), app));
        }
    }
}

代码放到了这里:

streampark-mapper-test: streampark mapper测试,用于兼容多数据库

相关文章
|
6月前
|
Java 测试技术 程序员
|
7月前
|
Java 程序员 网络安全
JUnit5学习之六:参数化测试(Parameterized Tests)基础
了解JUnit5的参数化测试的基本知识
117 2
JUnit5学习之六:参数化测试(Parameterized Tests)基础
|
2月前
|
存储 测试技术 数据库
数据驱动测试中的参数化
数据驱动测试中的参数化
|
3月前
|
测试技术 开发者
软件测试/测试开发/全日制|Pytest参数化神器,pytest.mark.parametrize()使用
软件测试/测试开发/全日制|Pytest参数化神器,pytest.mark.parametrize()使用
28 0
|
8月前
|
测试技术 Python
pytest--运行指定的测试和参数化
pytest--运行指定的测试和参数化
|
8月前
|
XML SQL JSON
软件测试|JMeter 参数化的方式有哪些
软件测试|JMeter 参数化的方式有哪些
79 0
|
测试技术 数据安全/隐私保护
性能测试|JMeter参数化(一)
性能测试|JMeter参数化(一)
109 0
性能测试|JMeter参数化(一)
|
JSON Java 测试技术
性能测试|电商业务性能测试(二): Jmeter 参数化功能实现注册登录的数据驱动
性能测试|电商业务性能测试(二): Jmeter 参数化功能实现注册登录的数据驱动
123 0
性能测试|电商业务性能测试(二): Jmeter 参数化功能实现注册登录的数据驱动
|
测试技术
unittest使用parameterized参数化后如何调用添加到测试套件中
unittest使用parameterized参数化后如何调用添加到测试套件中
114 0
unittest使用parameterized参数化后如何调用添加到测试套件中
|
测试技术
软件测试|Jmeter 参数化功能实现注册登录数据驱动
软件测试|Jmeter 参数化功能实现注册登录数据驱动
58 0
软件测试|Jmeter 参数化功能实现注册登录数据驱动