Open source testing platform MeterSphere’s deployment records on Windows

1.Background

Recently, the company wanted to build an interface automated testing platform. It would be too much work to start from scratch, so it was ready to find an open source platform for secondary development. After several days of searching, it found MeterSphere, a one-stop open source testing platform, using java+vue. It covers many functions such as test management, interface testing, UI testing and performance testing. It is more satisfactory to experience it at the official trial address first, so I plan to build it locally first.

Project Github address: GitHub - metersphere/metersphere: MeterSphere is a one-stop open source continuous testing platform that protects software quality. For testing, choose MeterSphere!

Official documentation: MeterSphere documentation

Free trial address: MeterSphere - Professional Testing Cloud

2. Local environment

  • jdk: 17 (metersphere requires a minimum of 11)
  • node:v18.15.0
  • mysql:8.0.33
  • maven:3.5.4
  • docker-desktop
  • redis, zookeeper, kafka: use docker-desktop to install the image
  • idea

3.windows deployment

3.1. Pull code

metersphere: Main application startup, including front-end and back-end code. Since I am not familiar with microservices, I use the v2.2 version without splitting microservices. Github address

https://github.com/metersphere/metersphere

ms-jmeter-core: jmeter core dependency, choose the same version as metersphere, Github address:   https://github.com/metersphere/ms-jmeter-core

After pulling down the codes of the above two projects, use idea to open and configure maven and jdk.

3.2. Package ms-jmeter-core

After configuring the maven and jdk of the ms-jmeter-core project, there may be plug-in errors in pom.xml, so don't worry about it.

Execute mvn clean install directly in Terminal to package successfully.

3.3.mysql configuration

 According to the official documentation, the source code is built (separation of front and back ends) - MeterSphere Documentation MeterSphere has requirements for some configuration items of the database, and the local data configuration needs to be modified.

I only modified the following locally

max_connections=2000
innodb_buffer_pool_size=1G
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Then restart the mysql service in the service and create the database

CREATE DATABASE `metersphere_dev` /*!40100 DEFAULT CHARACTER SET utf8mb4 */

Note: If the mysql service cannot be started after modifying the configuration, you can remove NO_AUTO_CREATE_USER in the sql_mode parameter and start it again.

3.4.metersphere configuration

Built according to the source code of the official documentation (separation of front and back ends) - MeterSphere documentation

First create the \opt\metersphere\conf\metersphere.properties file in the root directory of the metersphere project

# 数据库配置
spring.datasource.url=jdbc:mysql://localhost:3306/metersphere_dev?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
spring.datasource.username=root
spring.datasource.password=123456

# kafka 配置,node-controller 以及 data-streaming 服务需要使用 kafka 进行测试结果的收集和处理
kafka.partitions=1
kafka.replicas=1
kafka.topic=JMETER_METRICS
kafka.test.topic=JMETER_TESTS
kafka.bootstrap-servers=localhost:9092
kafka.log.topic=JMETER_LOGS
kafka.report.topic=JMETER_REPORTS

# node-controller 所使用的 jmeter 镜像版本 
jmeter.image=registry.fit2cloud.com/metersphere/jmeter-master:0.0.6

# TCP Mock 端口范围
tcp.mock.port=10000-10010

# Redis 配置
spring.redis.host=localhost
spring.redis.port=6379
spring.redis.password=123456

# 启动模式,lcoal 表示以本地开发模式启动
run.mode=local

Copy the configuration file in the backend/src/main/resources/jmeter/bin directory in the project directory to \opt\meter\bin in the project root directory

Then modify the metersphere.properties paths in Application.java, logback.xml, and generatorConfig.xml

Modify jmeter.home in the base.properties file

Modify Spring Boot startup items

Check Shorten command line in the Modify options drop-down option.

Select JAR manifest - java -cp classpath.jar cleassName [args]

3.5. Start the backend service

Before starting the back-end service, you need to start the redis, zookeeper, and kafka services. How to start them will not be described in detail.

Execute Application.java to start the backend service

Error 1:

程序包io.metersphere.xpack.ui.dto不存在

xpack is an enterprise version package that requires a fee to use. Just comment out all dependencies and references related to xpack.

Error 2:

Public Key Retrieval is not allowed

Add the allowPublicKeyRetrieval=true parameter to spring.datasource.url in \opt\metersphere\conf\metersphere.properties, that is

spring.datasource.url=jdbc:mysql://localhost:3306/metersphere_dev?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true

Error 3:

Schema `metersphere_dev` contains a failed migration to version 68

This error is caused by the sql file execution error when creating the database table. You can find the project path\backend\src\main\resources\db\migration\V68__modify_api_test_case.sql file, copy the sql in it to Navicat for execution, and fix the error. Just restart the service

3.6. Start the front-end service

Under the progress front-end project, execute npm install to install dependencies.

Modify the configuration items in frontend\package.json. Since we are using a Windows machine, we need to modify the export to SET and add the --openssl-legacy-provider parameter to solve the problem of nodejs v17 and above OpenSSL3.0 allowing algorithms and keys. size limit

After modification, execute npm run build-win to compile

After successful compilation, execute npm run serve-win to start the backend service.

When you see the above information, it means that it has been started successfully. Next, access it in the browser.

Use the default account admin/metersphere to log in and use it.

Guess you like

Origin blog.csdn.net/y954227239/article/details/132694147
Recommended