Skip to Content
微前端设计与实现
book

微前端设计与实现

by Luca Mezzalira
August 2022
Beginner to intermediate
270 pages
7h 38m
Chinese
Posts & Telecom Press
Content preview from 微前端设计与实现
122
6
6.2.1
 横向拆分和纵向拆分
项目采用横向拆分还是纵向拆分会明显影响开发体验。纵向拆分就是微前端表现为单一
HTML
页面
,或一个团队独立负责单页应用。在这种情况下,开发体验与传统的单页应用
的开发体验非常相似,所有单页应用的工具和工作流在这里都适用。你可能还想创建一些
额外的工具用于特定条件下的微前端测试。比如,当一个
App shell
加载纵向拆分的微前端
时,你可能需要一个脚本或工具来测试应用在特定环境下的可用性,以确保微前端可以在
最新版本或者特定版本中正常运行。
测试阶段与普通的单页应用非常相似,我们可以配置单元测试、集成测试和端到端测试,
不需要额外的处理。因此,每个团队可以测试自己的模块以及模块之间的切换。但是,我
们要确保当前业务内的所有模块在
App shell
中加载时都是可用的。我曾经看到的一个很好
的解决方案是让维护
App shell
的团队对各模块进行端到端测试,以便覆盖所有模块。
横向拆分有不同的考虑因素。一个团队可能负责多个微前端,它们被一个或多个页面使
用。需要提供一些工具用于测试这些页面,让开发人员能够查看总体情况、潜在的依赖冲
突以及与其他团队负责的业务通信等。这些工具没有统一标准,许多公司需要开发定制化
的工具。需要注意的是,选择怎样的工具取决于环境和具体业务,因此,一家公司的工具
可能并不适合另一家公司。虽然也有一些现成的工具可以使用,但更多时候还是需要定制
一些工具来提供良好的开发体验。
横向拆分的另一个挑战是如何运行可靠的测试方案。我们需要确认单个业务的端到端测试 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Python语言及其应用(第2版)

Python语言及其应用(第2版)

Bill Lubanovic

Publisher Resources

ISBN: 9787115595089