20 KiB
20 KiB
REV004 accountProcess 集成测试方案 bootstrap(2026-04-13)
本轮已落地 bootstrap
- 新增
AbstractRev004AccountProcessIntegrationTest:定义真实数据库 + 外部依赖默认替身化的测试基类 - 新增
Rev004AccountProcessLiveDbReadinessTest:在提供REV004_IT_DB_*环境变量时,检查真实数据库所需表是否可见 - 新增
Rev004AccountProcessIntegrationFixtureAssetsTest:校验 fixture 资源文件存在 - 新增
src/test/resources/sql/rev004/accountprocess/*.sql:为 prestorage/sold/unsold/accountLog 预留 fixture 分层入口
当前价值
- 把“真实数据库 + 外部依赖替身化”的执行边界固化到测试骨架
- 把场景矩阵的 fixture 入口落到仓库,便于后续继续实现 query/action/close-loop 场景
- 在未提供真实数据库环境变量时,不强行执行 live DB readiness 测试
下一步建议
- 补
prestorage第 1 条全闭环场景 - 补
sold的isHistory+ submit/撤销场景 - 补
accountLog的 refund/prestorage 二次动作场景
Canary 补充
- 新增
Rev004AccountProcessCanaryQueryIntegrationTest:在提供REV004_IT_DB_*环境变量时,真正启动 Spring + MockMvc,打通prestorage-page只读 query 作为最小 canary。 - 当前 fixture 仍是 bootstrap 占位,因此该 canary 的目标是“验活骨架”,不是验证完整业务数据闭环。
Fresh verification
- 执行:
mvn -Dtest='Rev004AccountProcessIntegrationFixtureAssetsTest,Rev004AccountProcessLiveDbReadinessTest,Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果:BUILD SUCCESS
- 细项:
- Fixture assets: 1 pass
- Live DB readiness: 1 skipped(未提供
REV004_IT_DB_*环境变量时跳过) - Canary query: 1 skipped(未提供
REV004_IT_DB_*环境变量时跳过)
Real DB canary verification
- 执行环境:使用
application-local.yaml中 PostgreSQL 连接参数,以REV004_IT_DB_*环境变量注入 - 执行:
mvn -Dtest='Rev004AccountProcessIntegrationFixtureAssetsTest,Rev004AccountProcessLiveDbReadinessTest,Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果:BUILD SUCCESS
- 明细:
- Fixture assets: 1 pass
- Live DB readiness: 1 pass
- Canary query (
/admin-api/business/accounting-adjust/prestorage-page): 1 pass
- 说明:当前 canary 证明了真实数据库 + Spring context + MockMvc + route wiring 可启动并返回成功包装;但 fixture 仍是最小占位,尚未证明完整业务数据闭环。
Real DB full bootstrap verification
- 执行环境:使用
application-local.yaml中 PostgreSQL 连接参数,经REV004_IT_DB_*环境变量注入 - 执行:
mvn -Dtest='Rev004AccountProcessIntegrationFixtureAssetsTest,Rev004AccountProcessLiveDbReadinessTest,Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果:BUILD SUCCESS
- 明细:
- Fixture assets: 1 pass
- Live DB readiness: 1 pass
- Canary query (
/admin-api/business/accounting-adjust/prestorage-page): 1 pass
- 说明:当前已经从“资产存在”推进到“真实数据库 + Spring context + MockMvc + canary query 验活成功”。
- 剩余缺口:fixture 仍是最小占位,尚未验证完整业务数据闭环。
First real close-loop scenario
- 场景:
prestorage-submit预存退款 - 测试文件:
Rev004AccountProcessCanaryQueryIntegrationTest - 使用真实数据库中的独立测试数据(
REV004_IT_SRC/biz_account.id=900001) - 断言:
POST /admin-api/business/accounting-adjust/prestorage-submit返回成功包装- 账户余额由
100.00变为90.00 biz_operat_log写入 1 条旧预存调整日志biz_operat_log_detail中存在与返回adjustmentNo对应的明细记录
- 执行:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果:BUILD SUCCESS(2 tests / 0 fail / 0 skip)
Sold close-loop scenario
- 场景:
sold-submit已销调整申请 - 测试文件:
Rev004AccountProcessCanaryQueryIntegrationTest - 使用真实数据库中的独立测试营业账数据(
biz_charge.id=900002,pay_state=1) - 断言:
POST /admin-api/business/accounting-adjust/sold-submit返回成功包装- 返回
resultStatus = PENDING_APPROVAL biz_operat_log写入 1 条旧账务兼容动作日志biz_operat_log_detail中存在与返回adjustmentNo对应的明细记录
- 结果:与 prestorage canary 一起执行,
Rev004AccountProcessCanaryQueryIntegrationTest当前为 3 tests / 0 fail / 0 skip
AccountLog close-loop scenario
- 场景:
log-prestorage二次动作 - 测试文件:
Rev004AccountProcessCanaryQueryIntegrationTest - 使用真实数据库中的独立源记录(
adjustmentNo=REV004-LOG-900003,biz_charge.id=900003)与目标账户(REV004_IT_TGT/biz_account.id=900004) - 断言:
POST /admin-api/business/accounting-adjust/log-prestorage返回成功包装- 源营业账
pay_state被清为0(未收) - 目标账户余额增加到
20.00 biz_operat_log写入 1 条旧账务兼容动作日志biz_operat_log_detail中存在与返回adjustmentNo对应的明细记录
- 结果:与 prestorage/sold 场景一起执行时,
Rev004AccountProcessCanaryQueryIntegrationTest当前为 4 tests / 0 fail / 0 skip
AccountLog process query scenario
- 场景:
log-process读取已有调整记录流程摘要 - 测试文件:
Rev004AccountProcessCanaryQueryIntegrationTest - 使用真实数据库中的独立源记录(
adjustmentNo=REV004-LOG-900003) - 断言:
GET /admin-api/business/accounting-adjust/log-process返回成功包装processState = UPDATEDresultStatus = SUCCESS
Current canary suite status
Rev004AccountProcessCanaryQueryIntegrationTest当前为 5 tests / 0 fail / 0 skip- 已覆盖:query canary、prestorage-submit、sold-submit、log-prestorage、log-process
2026-04-13 最新推进:accountLog refund 闭环补齐
- 新增
TransactionApi的@MockBean注入到AbstractRev004AccountProcessIntegrationTest,确保真实数据库之外的交易后续流水依赖保持替身化。 - 更新
40_accountlog_seed.sql:为REV004-LOG-900003补入originalTranSeq=T-900003、originalSysTranSeq=SYS-900003,使log-refund路径具备真实可执行前置数据。 - 新增 canary 闭环用例:
logRefund_shouldClearChargePaymentAndWriteFollowupLog
新增闭环断言
POST /admin-api/business/accounting-adjust/log-refund- 返回:
resultStatus=SUCCESS、objectType=PREPAID_REFUND、writeBackStatus=UPDATED - 数据库断言:
biz_charge.id=900003的pay_state从已收改为0biz_operat_log中新增 1 条账务调整日志,operat_content含返回的adjustmentNobiz_operat_log_detail中存在bankTranSeq=RF-900003
- 替身断言:
TransactionApi.createFollowupTransaction(...)被调用
本次真实库验证
- 执行 1:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果 1:BUILD SUCCESS
Rev004AccountProcessCanaryQueryIntegrationTest: 7 tests / 0 fail / 0 skip
- 执行 2:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcess*' test - 结果 2:BUILD SUCCESS
Rev004AccountProcessLiveDbReadinessTest: 1 passRev004AccountProcessIntegrationFixtureAssetsTest: 1 passRev004AccountProcessCanaryQueryIntegrationTest: 7 pass- 总计:9 tests / 0 fail / 0 skip
当前 canary 套件真实覆盖
prestorage-page_shouldReturnSuccessEnvelopeprestorageSubmit_shouldChangeBalanceAndWriteOperatLogsoldSubmit_shouldWritePendingOperatLoglogPrestorage_shouldClearChargePaymentAndIncreaseTargetDepositlogProcess_shouldReturnUpdatedProcessSummarylogAttachments_shouldReturnUnresolvedAttachmentReflogRefund_shouldClearChargePaymentAndWriteFollowupLog
仍待继续
unsold五类 happy path 真实库闭环revoke/log-revoke/sold-batch-revoke的真实库撤销链验证- 更高一层的“提交 -> 查询页回看 -> detail/process/attachments 全链联动”场景编排
2026-04-13 继续推进:撤销链真实库闭环补齐
- 新增真实库撤销链 canary:
prestorageRevoke_shouldRestoreBalanceAndWriteRevokeLogsoldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecordlogRevoke_shouldRestoreChargePaymentAndRollbackTransferredDeposit
- 为支持旧兼容动作撤销,本轮同时修正
AccountingAdjustProcessServiceImpl.findSyntheticSnapshot(...):- 改为按
adjustmentNo直接回查 operat_log / operat_log_detail - 避免旧预存调整 / 旧日志转预存 场景在撤销时误落入 unified snapshot 分支
- 改为按
新增闭环断言
prestorage-revoke
- 先发起
prestorage-submit - 再调用
POST /admin-api/business/accounting-adjust/prestorage-revoke - 断言:
- 返回
actionType=REVOKE biz_account.id=900001.deposit从90.00恢复到100.00- 存在
revokeOfAdjustmentNo=<原adjustmentNo>明细
- 返回
sold-batch-revoke
- 先发起
sold-submit - 再调用
POST /admin-api/business/accounting-adjust/sold-batch-revoke - 断言:
successCount=1- 存在
revokeOfAdjustmentNo=<原adjustmentNo>明细
log-revoke
- 先发起
log-prestorage - 再调用
POST /admin-api/business/accounting-adjust/log-revoke - 断言:
- 返回
actionType=REVOKE biz_charge.id=900003.pay_state恢复为1charge_method恢复为2charge_way恢复为6biz_account.id=900004.deposit从20.00回退到0.00- 存在
revokeOfAdjustmentNo=<原adjustmentNo>明细
- 返回
本次真实库验证
- 执行 1:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果 1:BUILD SUCCESS
Rev004AccountProcessCanaryQueryIntegrationTest: 10 tests / 0 fail / 0 skip
- 执行 2:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcess*' test - 结果 2:BUILD SUCCESS
Rev004AccountProcessLiveDbReadinessTest: 1 passRev004AccountProcessIntegrationFixtureAssetsTest: 1 passRev004AccountProcessCanaryQueryIntegrationTest: 10 pass- 总计:12 tests / 0 fail / 0 skip
当前 canary 套件真实覆盖(10 条)
prestoragePage_shouldReturnSuccessEnvelopeprestorageSubmit_shouldChangeBalanceAndWriteOperatLogprestorageRevoke_shouldRestoreBalanceAndWriteRevokeLogsoldSubmit_shouldWritePendingOperatLogsoldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecordlogPrestorage_shouldClearChargePaymentAndIncreaseTargetDepositlogRevoke_shouldRestoreChargePaymentAndRollbackTransferredDepositlogProcess_shouldReturnUpdatedProcessSummarylogAttachments_shouldReturnUnresolvedAttachmentReflogRefund_shouldClearChargePaymentAndWriteFollowupLog
2026-04-13 继续推进:unsold 五类真实库 happy path 补齐
- 新增
30_unsold_seed.sql真实库 fixture:biz_cust.id=900005 / code=REV004_IT_UNSOLDbiz_charge.id=900005 / pay_state=0 / bill_amount=120.00 / extended_amount=120.00 / late_fee=30.00
- 扩展
00_reset.sql,纳入900005 / REV004_IT_UNSOLD清理范围 - 新增 5 条真实库 canary:
unsoldAdjustSubmit_shouldUpdateAmountsAndWriteOperatLogunsoldSplitSubmit_shouldCreatePendingApprovalRecordunsoldLateFeeReduceSubmit_shouldCreatePendingApprovalRecordunsoldPriceDiffSubmit_shouldCreatePendingApprovalRecordunsoldBadDebtSubmit_shouldCreatePendingApprovalRecord
新增闭环断言
unsold-adjust-submit
- 返回
SUCCESS biz_charge.id=900005.extended_amount更新为88.88bill_amount更新为80.00biz_operat_log.operat_content含返回adjustmentNo
unsold-split-submit
- 返回
PENDING_APPROVAL objectType=SPLIT_ADJUSTbiz_operat_log.operat_content含返回adjustmentNo
unsold-late-fee-reduce-submit
- 返回
PENDING_APPROVAL objectType=LATE_FEE_REDUCEbiz_operat_log.operat_content含返回adjustmentNo
unsold-price-diff-submit
- 返回
PENDING_APPROVAL objectType=PRICE_DIFF_ADJUSTbiz_operat_log.operat_content含返回adjustmentNo
unsold-bad-debt-submit
- 返回
PENDING_APPROVAL objectType=BAD_DEBT_RECORDbiz_operat_log.operat_content含返回adjustmentNo
本次真实库验证
- 执行 1:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果 1:BUILD SUCCESS
Rev004AccountProcessCanaryQueryIntegrationTest: 15 tests / 0 fail / 0 skip
- 执行 2:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcess*' test - 结果 2:BUILD SUCCESS
Rev004AccountProcessLiveDbReadinessTest: 1 passRev004AccountProcessIntegrationFixtureAssetsTest: 1 passRev004AccountProcessCanaryQueryIntegrationTest: 15 pass- 总计:17 tests / 0 fail / 0 skip
当前 canary 套件真实覆盖(15 条)
prestoragePage_shouldReturnSuccessEnvelopeprestorageSubmit_shouldChangeBalanceAndWriteOperatLogprestorageRevoke_shouldRestoreBalanceAndWriteRevokeLogsoldSubmit_shouldWritePendingOperatLogsoldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecordunsoldAdjustSubmit_shouldUpdateAmountsAndWriteOperatLogunsoldSplitSubmit_shouldCreatePendingApprovalRecordunsoldLateFeeReduceSubmit_shouldCreatePendingApprovalRecordunsoldPriceDiffSubmit_shouldCreatePendingApprovalRecordunsoldBadDebtSubmit_shouldCreatePendingApprovalRecordlogPrestorage_shouldClearChargePaymentAndIncreaseTargetDepositlogRevoke_shouldRestoreChargePaymentAndRollbackTransferredDepositlogProcess_shouldReturnUpdatedProcessSummarylogAttachments_shouldReturnUnresolvedAttachmentReflogRefund_shouldClearChargePaymentAndWriteFollowupLog
剩余待补
- 更高一层的“提交 -> page/stat/detail/process/attachments 联动回看”场景编排
- 若要进一步贴近前端验收,可再补一轮按弹窗功能分组的端到端查询/动作串联用例
2026-04-13 继续推进:提交后联动回看场景补齐
- 新增 3 条更贴近前端验收的联动回看 canary:
prestorageSubmit_thenPageStatAndDetailShouldExposeNewRecordsoldSubmit_thenSoldPageAndStatShouldExposePendingRevokeCapabilitylogSeed_thenPageStatDetailProcessAndAttachmentsShouldStayConsistent
新增联动断言
prestorage提交后联动回看
- 提交
prestorage-submit - 再查:
prestorage-pageprestorage-statprestorage-detail
- 断言:
- page 能看到新
adjustmentNo - stat 的
totalCount=1 / refundCount=1 - detail 返回
resultStatus=SUCCESS / writeBackStatus=UPDATED
- page 能看到新
sold提交后联动回看
- 提交
sold-submit - 再查:
sold-pagesold-stat
- 断言:
- page 仍能看到
biz_charge.id=900002 canBatchRevoke=true- stat 的
totalCount=1 / totalActualAmount=80.00
- page 仍能看到
log全链回看
- 基于
40_accountlog_seed.sql中的REV004-LOG-900003 - 依次验证:
log-pagelog-statlog-detaillog-processlog-attachments
- 断言:
- page 可见
adjustmentNo=REV004-LOG-900003 - stat
completedCount=1 - detail 包含
originalTranSeq=T-900003与attachmentRefs[0]=mock-ref-1 - process
processState=UPDATED - attachments 可返回
mock-ref-1
- page 可见
本次真实库验证
- 执行 1:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果 1:BUILD SUCCESS
Rev004AccountProcessCanaryQueryIntegrationTest: 18 tests / 0 fail / 0 skip
- 执行 2:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcess*' test - 结果 2:BUILD SUCCESS
Rev004AccountProcessLiveDbReadinessTest: 1 passRev004AccountProcessIntegrationFixtureAssetsTest: 1 passRev004AccountProcessCanaryQueryIntegrationTest: 18 pass- 总计:20 tests / 0 fail / 0 skip
当前真实库 canary 覆盖(18 条)
prestoragePage_shouldReturnSuccessEnvelopeprestorageSubmit_shouldChangeBalanceAndWriteOperatLogprestorageRevoke_shouldRestoreBalanceAndWriteRevokeLogprestorageSubmit_thenPageStatAndDetailShouldExposeNewRecordsoldSubmit_shouldWritePendingOperatLogsoldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecordsoldSubmit_thenSoldPageAndStatShouldExposePendingRevokeCapabilityunsoldAdjustSubmit_shouldUpdateAmountsAndWriteOperatLogunsoldSplitSubmit_shouldCreatePendingApprovalRecordunsoldLateFeeReduceSubmit_shouldCreatePendingApprovalRecordunsoldPriceDiffSubmit_shouldCreatePendingApprovalRecordunsoldBadDebtSubmit_shouldCreatePendingApprovalRecordlogPrestorage_shouldClearChargePaymentAndIncreaseTargetDepositlogRevoke_shouldRestoreChargePaymentAndRollbackTransferredDepositlogSeed_thenPageStatDetailProcessAndAttachmentsShouldStayConsistentlogProcess_shouldReturnUpdatedProcessSummarylogAttachments_shouldReturnUnresolvedAttachmentReflogRefund_shouldClearChargePaymentAndWriteFollowupLog
当前剩余缺口
- 若要进一步逼近前端验收,可继续补“弹窗 A/B/C 对应多接口切换”的编排式测试摘要
- 以及基于接口返回字段做一版更面向页面的 contract/assertion matrix
2026-04-13 继续推进:unsold 查询面真实库回看补齐
- 新增 2 条真实库查询联动 canary:
unsoldSeed_thenPageAndStatShouldExposeChargeSnapshotunsoldAdjustSubmit_thenPageAndStatShouldReflectUpdatedAmounts
新增断言
unsold初始查询面
GET /admin-api/business/accounting-adjust/unsold-pageGET /admin-api/business/accounting-adjust/unsold-stat- 断言:
biz_charge.id=900005可见totalAmount=120.00billAmount=120.00penaltyAmount=30.00canAdjust/canSplit/canLateFeeReduce/canPriceDiffAdjust/canBadDebtAdjust=true- stat:
sumWaterVolume=5.000 / sumTotalAmount=120.00 / sumBillAmount=120.00 / sumPenaltyAmount=30.00
unsold-adjust-submit后查询面回看
- 先提交
unsold-adjust-submit - 再查
unsold-page / unsold-stat - 断言:
- page 中
totalAmount=88.88 - page 中
billAmount=80.00 - stat 中
sumTotalAmount=88.88 - stat 中
sumBillAmount=80.00
- page 中
本次真实库验证
- 执行 1:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果 1:BUILD SUCCESS
Rev004AccountProcessCanaryQueryIntegrationTest: 20 tests / 0 fail / 0 skip
- 执行 2:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcess*' test - 结果 2:BUILD SUCCESS
Rev004AccountProcessLiveDbReadinessTest: 1 passRev004AccountProcessIntegrationFixtureAssetsTest: 1 passRev004AccountProcessCanaryQueryIntegrationTest: 20 pass- 总计:22 tests / 0 fail / 0 skip
影响
prestorage / sold / unsold / log四条主查询面现在都至少有一组真实库回看证据- 剩余未补重点从“主链查询缺口”收敛为“预存页流程/附件链路 + 字典/UI文案展示一致性”
2026-04-13 继续推进:prestorage process / attachments 真实库补齐
- 新增 canary:
prestorageSubmit_thenProcessAndAttachmentsShouldExposeReturnedAdjustmentNo - 在
prestorage-submit场景中附带attachmentRefs=[pre-proof-2, pre-proof-3] - 提交后继续验证:
GET /admin-api/business/accounting-adjust/prestorage-processGET /admin-api/business/accounting-adjust/prestorage-attachments
新增断言
- process:
adjustmentNo与提交返回一致resultStatus=SUCCESSapprovalStatus=NOT_REQUIREDwriteBackStatus=UPDATEDprocessState=UPDATEDstages[0].message存在
- attachments:
- 返回两条附件引用
ref=pre-proof-2 / pre-proof-3resolved=false
本次真实库验证
Rev004AccountProcessCanaryQueryIntegrationTest: 21 tests / 0 fail / 0 skipRev004AccountProcess*: 总计 23 tests / 0 fail / 0 skip
影响
prestorage查询/提交流程/撤销/流程查看/附件查看 这一组链路现在都已有真实库证据- 剩余缺口进一步收敛到:字典 label / UI 文案一致性、边角筛选条件穷尽、UI 编排级验证