docs: Data uploader SDK Content

This commit is contained in:
杭城小刘
2020-07-06 14:28:00 +08:00
parent 028d446ac6
commit 95829c86b2
4 changed files with 39 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
# 如何写好测试 # 写好测试,提升应用质量
> 软件测试的功能非常重要,现在结合过往经验谈谈如何做软件测试 > 软件测试的功能非常重要,现在结合过往经验谈谈如何做软件测试
@@ -50,5 +50,8 @@
> UITest可以测你页面渲染的对不对、按钮点击是否有问题 > UITest可以测你页面渲染的对不对、按钮点击是否有问题
不过 macaca appium 都可以做到iOS自动化 不过 macaca appium 都可以做到iOS自动化
12318 * 0.09 + 4091 * 0.04 + 3216 * 0.0316 + 5099 * 0.0164 +5351 * 0.0579 + 3196 * 0.0475 + 6092 * 0.0123 + 4382 * 0.0652 + 3238 * 0.0633 + 5617 * 0.0642 + 3211 * 0.0492 + 6296 * 0.0437 + 7089 * 0.0921 + 5274 * 0.025

View File

@@ -121,7 +121,7 @@ _##keyName = [decoder decode##dataType##ForKey:NSStringFromSelector(@selector(ke
// 初始化一份默认配置 // 初始化一份默认配置
- (void)setDefaultConfigurationModel { - (void)setDefaultConfigurationModel {
PCTConfigurationModel *configurationModel = [[PCTConfigurationModel alloc] init]; PCTConfigurationModel *configurationModel = [[PCTConfigurationModel alloc] init];
configurationModel.url = @"https://.com"; configurationModel.url = @"https://***DomainName.com";
configurationModel.isUpload = YES; configurationModel.isUpload = YES;
configurationModel.isGather = YES; configurationModel.isGather = YES;
configurationModel.isUpdateClear = YES; configurationModel.isUpdateClear = YES;
@@ -1147,6 +1147,20 @@ NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
@end @end
``` ```
上面有个地方需要注意下,因为经常需要根据类型来判读操作那个数据表,使用频次很高,所以写成内联函数的形式
```objective-c
NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
if (type == PCTLogTableTypeMeta) {
return PCT_LOG_TABLE_META;
}
if (type == PCTLogTableTypePayload) {
return PCT_LOG_TABLE_PAYLOAD;
}
return @"";
}
```
### 5. 数据存储流程 ### 5. 数据存储流程
@@ -1348,6 +1362,8 @@ NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
- 由于频率会比较高,所以需要做节流的逻辑 - 由于频率会比较高,所以需要做节流的逻辑
很多人会搞不清楚防抖和节流的区别。一言以蔽之:“函数防抖关注一定时间连续触发的事件只在最后执行一次,而函数节流侧重于一段时间内只执行一次”。此处不是本文重点,感兴趣的的可以查看[这篇文章](https://segmentfault.com/a/1190000018445196)
- 上报流程会首先判断(为了节约用户流量) - 上报流程会首先判断(为了节约用户流量)
- 判断当前网络环境为 WI-FI 则实时上报 - 判断当前网络环境为 WI-FI 则实时上报
@@ -1515,9 +1531,13 @@ NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
也可以使用 [slather](https://github.com/SlatherOrg/slather)。在项目终端环境下新建 `.slather.yml` 配置文件,然后执行语句 `slather coverage -s --scheme prism-client-Example --workspace prism-client.xcworkspace prism-client.xcodeproj`。 也可以使用 [slather](https://github.com/SlatherOrg/slather)。在项目终端环境下新建 `.slather.yml` 配置文件,然后执行语句 `slather coverage -s --scheme prism-client-Example --workspace prism-client.xcworkspace prism-client.xcodeproj`。
关于质量保证的最基础、可靠的方案之一软件测试,在各个端都有一些需要注意的地方,还需要结合工程化,我会写专门的[文章](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.75.md)谈谈经验心得。
## 五、 接口设计
## 五、 接口设计及核心实现
### 1. 接口设计
```objective-c ```objective-c
@interface PrismClient : NSObject @interface PrismClient : NSObject
@@ -1596,7 +1616,11 @@ NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
} }
``` ```
真正处理逻辑的是 `PCTService` 类。这里贴一下代码,点击展开
### 2. 核心实现
真正处理逻辑的是 `PCTService` 类。
```objective-c ```objective-c
#define PCT_SAVED_FLOW @"PCT_SAVED_FLOW" #define PCT_SAVED_FLOW @"PCT_SAVED_FLOW"
@@ -1772,9 +1796,9 @@ NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
// 基础配置 // 基础配置
- (void)setupConfig { - (void)setupConfig {
_requestBaseUrl = @"https://common.***.com"; _requestBaseUrl = @"https://***DomainName.com";
_metaURL = @"prism/metrics/meta"; _metaURL = @"prism/***";
_payloadURL = @"prism/metrics/detail"; _payloadURL = @"prism/***";
} }
- (void)executeHandlerWhenAppLaunched - (void)executeHandlerWhenAppLaunched
@@ -2479,6 +2503,8 @@ UT 是质量保证的一个方面,另一个就是 MR 机制。我们团队 MR
- [WAL](https://en.wikipedia.org/wiki/Write-ahead_logging) - [WAL](https://en.wikipedia.org/wiki/Write-ahead_logging)
- [WCDB 的 WAL 模式和异步 Checkpoint](https://cloud.tencent.com/developer/article/1031030) - [WCDB 的 WAL 模式和异步 Checkpoint](https://cloud.tencent.com/developer/article/1031030)
- [sqlite vacuum](https://www.sqlite.org/lang_vacuum.html)
- [彻底弄懂函数防抖和函数节流](https://segmentfault.com/a/1190000018445196)

View File

@@ -78,7 +78,7 @@
* [72、架构设计心得](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.72.md) * [72、架构设计心得](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.72.md)
* [73、Ruby学习](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.73.md) * [73、Ruby学习](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.73.md)
* [74、带你打造一套 APM 监控系统](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.74.md) * [74、带你打造一套 APM 监控系统](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.74.md)
* [75、如何写好测试](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.75.md) * [75、写好测试,提升应用质量](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.75.md)
* [76、iOS Crash分析](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.76.md) * [76、iOS Crash分析](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.76.md)
* [77、iOS 打包系统构建加速](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.77.md) * [77、iOS 打包系统构建加速](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.77.md)
* [78、App 上架包预检](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.78.md) * [78、App 上架包预检](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.78.md)

View File

@@ -77,7 +77,7 @@
* [72、架构设计心得](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.72.md) * [72、架构设计心得](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.72.md)
* [73、Ruby学习](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.73.md) * [73、Ruby学习](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.73.md)
* [74、APM](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.74.md) * [74、APM](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.74.md)
* [75、如何写好测试](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.75.md) * [75、写好测试,提升应用质量](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.75.md)
* [76、iOS Crash分析](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.76.md) * [76、iOS Crash分析](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.76.md)
* [77、iOS 打包系统构建加速](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.77.md) * [77、iOS 打包系统构建加速](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.77.md)
* [78、上架包预检](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.78.md) * [78、上架包预检](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.78.md)