Commit b61e0c2d authored by xie.qin's avatar xie.qin

To support services separately deploy.

parent 0d1d56d5
......@@ -2,9 +2,9 @@ plugins {
id 'org.springframework.boot' version '2.5.1'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'io.qameta.allure' version '2.8.1'
id "com.google.protobuf" version "0.8.17"
id 'idea'
id 'io.qameta.allure' version '2.8.1'
}
group = 'com.fuzamei'
......@@ -26,6 +26,11 @@ repositories {
jcenter()
}
def allureVersion = "2.15.0"
def cucumberVersion = "6.11.0"
dependencies {
//implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-web'
......@@ -61,13 +66,15 @@ dependencies {
testAnnotationProcessor 'org.projectlombok:lombok:1.18.20'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.cucumber:cucumber-core:6.10.4'
testImplementation 'io.cucumber:cucumber-java:6.10.4'
testImplementation 'io.cucumber:cucumber-junit:6.10.4'
testImplementation 'io.cucumber:cucumber-spring:6.10.4'
testImplementation group: 'io.cucumber', name: 'cucumber-core', version: cucumberVersion
testImplementation group: 'io.cucumber', name: 'cucumber-java', version: cucumberVersion
testImplementation group: 'io.cucumber', name: 'cucumber-junit', version: cucumberVersion
testImplementation group: 'io.cucumber', name: 'cucumber-spring', version: cucumberVersion
//testImplementation 'io.cucumber:cucumber-plugin:6.11.0'
//testImplementation 'io.cucumber:gherkin:21.0.0'
testImplementation 'io.rest-assured:spring-mock-mvc:4.4.0'
testCompile 'io.qameta.allure:allure-cucumber6-jvm:2.14.0'
testImplementation group: 'io.qameta.allure', name: 'allure-cucumber6-jvm', version: allureVersion
compile files(fileTree(dir: "libs", include: ['*.jar']))
testCompile files(fileTree(dir: "libs", include: ['*.jar']))
......@@ -80,18 +87,20 @@ test {
if (testRel != null && !testRel.isEmpty()) {
systemProperty("global.test.release", testRel)
}
String testTarget = System.properties.getProperty("backend")
if (testTarget != null && !testTarget.isEmpty()) {
systemProperty("service.backend.host", testTarget)
}
}
allure {
version = '2.8.1'
allureJavaVersion = '2.14.0'
autoconfigure = true
version = allureVersion
//allureJavaVersion = allureVersion
autoconfigure = false
aspectjweaver = true
boolean clean = true
resultsDir = file(getBuildDir().absolutePath + '/test-results/allure-results/')
reportDir = file(getBuildDir().absolutePath + '/reports/allure-report/')
String configuration = 'testCompile'
downloadLink = 'https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.8.1/allure-commandline-2.8.1.zip'
downloadLink = 'https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/' + allureVersion + '/allure-commandline-' + allureVersion + '.zip'
}
sourceSets {
......
@restfulApi @sanity
Feature: API tests for APP-Service
@app-service
Scenario: Verify the exposed APIs work as design for APP-Service
Given Found OpenAPI definition for app service
Then Analyze OpenAPI file of app service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for AUTH-Service
@auth-service
Scenario: Verify the exposed APIs work as design for AUTH-Service
Given Found OpenAPI definition for auth service
Then Analyze OpenAPI file of auth service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for CHAIN-Service
@chain-service
Scenario: Verify the exposed APIs work as design for CHAIN-Service
Given Found OpenAPI definition for chain service
Then Analyze OpenAPI file of chain service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for CLOUD-Service
@cloud-service
Scenario: Verify the exposed APIs work as design for CLOUD-Service
Given Found OpenAPI definition for cloud service
Then Analyze OpenAPI file of cloud service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for COMMODITY-Service
@commodity-service
Scenario: Verify the exposed APIs work as design for COMMODITY-Service
Given Found OpenAPI definition for commodity service
Then Analyze OpenAPI file of commodity service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for COMMON-Service
@common-service
Scenario: Verify the exposed APIs work as design for COMMON-Service
Given Found OpenAPI definition for common service
Then Analyze OpenAPI file of common service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for LICENSE-Service
@license-service
Scenario: Verify the exposed APIs work as design for LICENSE-Service
Given Found OpenAPI definition for license service
Then Analyze OpenAPI file of license service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for LOGGER-Service
@logger-service
Scenario: Verify the exposed APIs work as design for LOGGER-Service
Given Found OpenAPI definition for logger service
Then Analyze OpenAPI file of logger service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for MONITOR-Service
@monitor-service
Scenario: Verify the exposed APIs work as design for MONITOR-Service
Given Found OpenAPI definition for monitor service
Then Analyze OpenAPI file of monitor service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for ORDER-Service
@order-service
Scenario: Verify the exposed APIs work as design for ORDER-Service
Given Found OpenAPI definition for order service
Then Analyze OpenAPI file of order service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for PAY-Service
@pay-service
Scenario: Verify the exposed APIs work as design for PAY-Service
Given Found OpenAPI definition for pay service
Then Analyze OpenAPI file of pay service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for USER-Service
@user-service
Scenario: Verify the exposed APIs work as design for USER-Service
Given Found OpenAPI definition for user service
Then Analyze OpenAPI file of user service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for WEBSITE-Service
@website-service
Scenario: Verify the exposed APIs work as design for WEBSITE-Service
Given Found OpenAPI definition for website service
Then Analyze OpenAPI file of website service and generate REST-ful requests automatically
\ No newline at end of file
@restfulApi @sanity
Feature: API tests for service of backend
@backend
@restfulApi
Feature: API tests for ALL Services
@all-service
Scenario: Verify the exposed APIs work as design
Given Found OpenAPI definition for backend service
#When The testing PERSISTENCE data orgUser is ready for backend service
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11,7 +11,7 @@ import java.math.BigDecimal;
@Component
@ConfigurationProperties(prefix = "global.test")
@PropertySource(value = "classpath:application.properties", encoding = "UTF-8")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
......@@ -35,4 +35,7 @@ public class GlobalProperties {
@Value("${server.ssl.enabled}")
private Boolean serverSslEnable;
@Value("${service.combinedDeployment}")
private Boolean combinedDeployment;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.app")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class AppServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.app.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.auth")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class AuthServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.auth.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.chain")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class ChainServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.chain.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.cloud")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class CloudServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.cloud.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.commodity")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class CommodityServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.commodity.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.common")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class CommonServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.common.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.license")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class LicenseServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.license.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.logger")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class LoggerServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.logger.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.monitor")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class MonitorServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.monitor.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.order")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class OrderServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.order.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.pay")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class PayServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.pay.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.user")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class UserServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.user.http2.enabled}")
private Boolean http2;
}
package com.fuzamei.autotest.properties.services;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "service.website")
@PropertySource(value = "classpath:application.yml", encoding = "UTF-8")
@Setter
@Getter
public class WebsiteServiceProperties {
private String host;
private String port;
private String openapifilepath;
//private String httpschema;
private Boolean https;
@Value("${service.website.http2.enabled}")
private Boolean http2;
}
......@@ -8,15 +8,107 @@ grpc:
server:
port: 8802
service:
combinedDeployment: true
backend:
host: 172.22.17.91
host: 172.22.18.152
port: 2345
openapidefinitionpath: /
https: false
http2:
enabled: false
app:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
auth:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
chain:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
cloud:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
commodity:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
common:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
license:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
logger:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
monitor:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
order:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
pay:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
user:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
website:
host: ${service.backend.host}
port: ${service.backend.port}
openapidefinitionpath: /
https: ${service.backend.https}
http2:
enabled: ${service.backend.http2.enabled}
mysql:
host: 172.22.18.152
host: ${service.backend.host}
database: baas
chain33:
host: 172.22.19.7
......@@ -39,3 +131,17 @@ serviceMock:
responsePath: ${serviceMock.pathPrefix}/backend.json
chain33:
responsePath: ${serviceMock.pathPrefix}/chain33.json
global:
test:
release: v2.3.0
intmin: 0
int32max: 2147483647
int64max: 9223372036854775807
dftstring: 1J7mdg5rbQyUHENYdx39WVWK7fsLpEoXZy1J7mdg5rbQyUHENYdx39WVWK7fsLpE
dftboolean: false
dftnumber: 9999999999.99
dftuserid: 87654321
dftusername: automation
latestchain33version: chain33_v1.6.6
datacollectionpath: resources/testingdata/
......@@ -44,7 +44,7 @@
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${logging.path}/autotest-custom-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<fileNamePattern>${logging.path}/all-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
......@@ -69,7 +69,7 @@
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${logging.path}/autotest-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<fileNamePattern>${logging.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
......@@ -95,7 +95,7 @@
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logging.path}/autotest-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<fileNamePattern>${logging.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
......@@ -121,7 +121,7 @@
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logging.path}/web-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<fileNamePattern>${logging.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
......
......@@ -30,30 +30,36 @@ public class ApiVerification {
@Given("^Found OpenAPI definition for (.*?) service$")
public void foundOpenApiProfileForTestingVer(String serviceName) throws Throwable {
String release = globalProperties.getRelease();
switch (serviceName) {
case "backend":
String openApiFilePath = openApiParser.getOpenApiFilePathByVersion(serviceName, release);
//log.debug("OpenApi definition for {} locates in {}", serviceName, openApiFilePath);
backendServiceProperties.setOpenapifilepath(openApiFilePath);
break;
default:
break;
if (globalProperties.getCombinedDeployment()) {
String openApiFilePath = openApiParser.getOpenApiFilePathByVersion("backend", release);
//log.debug("OpenApi definition for {} locates in {}", serviceName, openApiFilePath);
backendServiceProperties.setOpenapifilepath(openApiFilePath);
}
else {
switch (serviceName) {
default:
break;
}
}
}
@Then("^Analyze OpenAPI file of (.*?) service and generate REST-ful requests automatically$")
public void parseOpenApiAndSendReqToTargetService(String serviceName) throws Throwable {
String targetServiceApiFilePath = "";
switch (serviceName) {
case "backend":
if (globalProperties.getCombinedDeployment()) {
targetServiceApiFilePath = backendServiceProperties.getOpenapifilepath();
if (targetServiceApiFilePath == null || targetServiceApiFilePath.isEmpty()) {
foundOpenApiProfileForTestingVer("backend");
targetServiceApiFilePath = backendServiceProperties.getOpenapifilepath();
if (targetServiceApiFilePath == null || targetServiceApiFilePath.isEmpty()) {
foundOpenApiProfileForTestingVer("backend");
targetServiceApiFilePath = backendServiceProperties.getOpenapifilepath();
};
break;
default:
break;
}
}
else {
switch (serviceName) {
case "app":
break;
default:
}
}
openApiParser.analyzeOpenApiAndGenerateRequests(serviceName, targetServiceApiFilePath);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment