【測試報告】思緒網(Java+Selenium+Jmeter自動化測試)

一、項目簡介

? ? ? ?思緒網作為一種在線交流平臺,支持用戶在平臺下發布文章,并進行討論。主要由登錄頁面,論壇頁面,帖子編輯頁,帖子詳情頁等頁面組成。

二、項目功能

1.登錄頁面:輸入正確的賬號密碼進行登錄,跳轉博客列表頁。

2.博客列表頁:加載出全部博客,左邊顯示用戶信息與博客信息,右上角可發布新博客、頁等按鈕,選擇一個博客可以進入查看博客詳細信息。

3.博客詳情頁:能查看博客完整內容,當前登錄用戶查看自己博客有編輯與刪除按鈕,其余用戶僅有查看博客權限。

4.博客編輯頁:輸入標題、正文選擇提交按鈕發布博客。

5.更新博客頁:現當前需要修改的博客信息(標題,正文),修改完成點擊提交按鈕。

6.刪除博客:在詳情頁中點擊刪除博客,可以正確刪除,不在出現在列表頁。

三、測試計劃

(一)功能測試

????????1.測試用例設計

2.測試內容
(1)登陸頁面

測試用例:

測試用例編號操作賬號密碼預期結果
1輸入正常的賬號密碼zhangsan123456登錄成功
2輸入錯誤的賬號和密碼tt333登錄失敗,提示錯誤
3輸入正確的賬號和錯誤的密碼zhangsan332登錄失敗,提示錯誤
4輸入錯誤的賬號和正確的密碼tt123456登錄失敗,提示錯誤
5不填寫賬號和密碼  登錄失敗,提示錯誤
6填寫賬號不填寫密碼zhangsan 登錄失敗,提示錯誤
7不填寫賬號填寫密碼 123456登錄失敗,提示錯誤

測試結果:

①測試用例1:

結論:登錄成功,跳轉至論壇頁面,與預期結果一致。

②測試用例2:

結論:顯示用戶名或密碼錯誤,與預期結果不一致,沒有提示賬號/密碼錯誤

③測試用例3:

結論:顯示密碼錯誤,與預期結果一致

④測試用例4:

結論:顯示用戶名不存在,與預期結果一致

⑤測試用例5:

結論:顯示用戶名小于4位,與預期結果一致。

?⑥測試用例6:

結論:顯示密碼錯誤,與預期結果一致。

⑦測試用例7:

結論:顯示用戶名小于4位,與預期結果一致。

(2)博客列表頁面
測試用例編號操作預期結果
1點擊Gitee地址可跳轉跳轉到相應Git地址
2點擊查看全文查看博客詳情
3點擊右上角寫博客進入編寫博客
4點擊右上角注銷用戶退出
5點擊右上角主頁回到列表頁
6點擊右上角發布新博客進入編寫博客

①測試用例1:

結論:正常跳轉與預期一樣

②測試用例2:

結論:與預期結果一樣

③測試用例3:

結論:與預期一致

④測試用例4:

結論:與預期一致

⑤測試用例5:

結論:與預期結果一致

⑥測試用例6:

結論:與預期結果一致

(3)博客詳情頁
測試用例編號操作預期結果
1點擊Gitee地址可跳轉跳轉到相應Git地址
2點擊編輯按鈕進行更新界面
3點擊刪除按鈕可以刪除
4點擊右上角注銷用戶退出
5點擊右上角主頁回到列表頁
6點擊右上角發布新博客進入編寫博客

①測試用例1:

結論:正常跳轉與預期一樣

②測試用例2:

結論:正常跳轉與預期一樣

③測試用例3:

結論:正常跳轉與預期一樣

④測試用例4:

結論:與預期一致

⑤測試用例5:

結論:與預期結果一致

⑥測試用例6:

結論:與預期結果一致

(4)更新博客
測試用例編號操作預期結果
1只編輯標題點擊發布正常發布
2只編輯內容點擊發布正常發布
3編輯標題與內容點擊發布正常發布
4不編輯標題與內容點擊發布正常發布

①測試用例1:

結論:與期望結果一致

②測試用例2:

結論:與期望結果一致

③測試用例3:?

結論:與期望結果一致

④測試用例4:?

結論:與期望結果一致

(5)發布博客
測試用例編號操作預期結果
1只編輯標題點擊發布發布失敗
2只編輯內容點擊發布發布失敗
3編輯標題與內容點擊發布正常發布
4不編輯標題與內容點擊發布發布失敗

①測試用例1:?

結論:發布失敗,與期望結果一致。

正文內容是系統默認的,需要正文內容不為空和不是默認的才可以進行發布

②測試用例2:?

結論:與期望結果一致

③測試用例3:?

結論:與期望結果一致

④測試用例4:?

結論:發布失敗,與期望結果一致。

正文內容是系統默認的,需要正文內容不為空和不是默認的才可以進行發布

(二)自動化測試(Java)

1.測試環境

系統:windows11

瀏覽器:Chrome137.0.7151.119

測試工具:IntelliJ IDEA 2025.1.2

2.測試內容
(1)項目結構

(2)工具類Utils
public class Utils {public static WebDriver driver = null;public static WebDriverWait wait = null;public static String blogDetailUrl = "http://1.94.188.69:9090/blog_detail.html?blogId=3";public Utils(String url) {driver = createDriver();driver.get(url);wait = new WebDriverWait(driver, Duration.ofSeconds(3));}public static WebDriver createDriver() {if (driver == null) {WebDriverManager.chromedriver().setup();ChromeOptions options = new ChromeOptions();Map<String, Object> prefs = new HashMap<>();prefs.put("credentials_enable_service", false);prefs.put("profile.password_manager_enabled", false);prefs.put("password_manager_leak_detection", false);prefs.put("profile.default_content_settings.popups", 0);options.setExperimentalOption("prefs", prefs);options.addArguments("--remote-allow-origins=*");driver = new ChromeDriver(options);driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(3));}return driver;}public void screenShot(String str) {try {SimpleDateFormat sim1 = new SimpleDateFormat("yyyy-MM-dd");SimpleDateFormat sim2 = new SimpleDateFormat("HHmmssSS");String dirTime = sim1.format(System.currentTimeMillis());String fileTime = sim2.format(System.currentTimeMillis());String fileName = "./src/test/java/images/" + dirTime + "/" + str + "_" + fileTime + ".png";File srcFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);FileUtils.copyFile(srcFile, new File(fileName));} catch (IOException e) {e.getMessage();}}public String createTime() {SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SS");String curTime = sim.format(System.currentTimeMillis());return curTime;}public static void quit() {if (driver != null) {driver.quit();driver = null; // 重置引用}}}
(3)登錄界面類BlogLoginPage
public class BlogLoginPage extends Utils {public static String url = "http://1.94.188.69:9090/blog_login.html";public BlogLoginPage() {super(url);}public void checkPageRight() {driver.findElement(By.cssSelector("body > nav > div > div.flex.items-center.space-x-3"));driver.findElement(By.cssSelector("body > nav > div > div.hidden.md\\:flex.items-center.space-x-6 > a:nth-child(1)"));driver.findElement(By.cssSelector("body > nav > div > div.hidden.md\\:flex.items-center.space-x-6 > a:nth-child(2)"));driver.findElement(By.cssSelector("#username"));driver.findElement(By.cssSelector("#password"));driver.findElement(By.cssSelector("#submit"));driver.findElement(By.cssSelector("body > div"));screenShot("BlogLoginPage_checkPageRight");}public void checkPublishButton() {driver.findElement(By.cssSelector("body > nav > div > div.hidden.md\\:flex.items-center.space-x-6 > a:nth-child(2)")).click();driver.findElement(By.cssSelector("#submit"));screenShot("BlogLoginPage_checkPublishButton");driver.navigate().back();}public void checkErrorLogin() {driver.findElement(By.cssSelector("#username")).sendKeys("ssssss");driver.findElement(By.cssSelector("#password")).sendKeys("gssaf");driver.findElement(By.cssSelector("#submit"));screenShot("BlogLoginPage_checkErrorLogin");}public void checkCorrectLogin() {driver.findElement(By.cssSelector("#username")).clear();driver.findElement(By.cssSelector("#password")).clear();driver.findElement(By.cssSelector("#username")).sendKeys("zhangsan");driver.findElement(By.cssSelector("#password")).sendKeys("123456");screenShot("BlogLoginPage_checkCorrectLogin");driver.findElement(By.cssSelector("#submit")).click();driver.findElement(By.cssSelector("body > div > div > div.right.flex-1 > div.mb-8.flex.justify-between.items-center > a"));screenShot("BlogLoginPage_checkCorrectLogin");}}
(4)博客列表頁界面類BlogListPage
public class BlogListPage extends Utils {public static String url = "http://1.94.188.69:9090/blog_list.html";public BlogListPage() {super(url);}public void CheckPageRight() {String title = driver.findElement(By.cssSelector("body > div > div > div.right.flex-1 > div.space-y-6.blog-list > div:nth-child(1) > div.title.text-xl.font-bold.text-slate-800.hover\\:text-primary.transition-custom.mb-2")).getText();String createTiem = driver.findElement(By.cssSelector("body > div > div > div.right.flex-1 > div.space-y-6.blog-list > div:nth-child(1) > div.date.text-slate-500.text-sm.flex.items-center.mb-4")).getText();String content = driver.findElement(By.cssSelector("body > div > div > div.right.flex-1 > div.space-y-6.blog-list > div:nth-child(1) > div.desc.text-slate-600.line-clamp-3.mb-4")).getText();String button = driver.findElement(By.cssSelector("body > div > div > div.right.flex-1 > div.space-y-6.blog-list > div:nth-child(1) > a")).getText();String text = driver.findElement(By.cssSelector("body > div > div > div.left.md\\:w-1\\/4.lg\\:w-1\\/5 > div > div.px-6.pb-6.-mt-12 > h3")).getText();String git = driver.findElement(By.cssSelector("body > div > div > div.left.md\\:w-1\\/4.lg\\:w-1\\/5 > div > div.px-6.pb-6.-mt-12 > a")).getText();driver.findElement(By.cssSelector("body > nav > div > div.hidden.md\\:flex.items-center.space-x-6 > a.nav-span.text-primary.font-medium.flex.items-center.gap-1\\.5"));driver.findElement(By.cssSelector("body > nav > div > div.hidden.md\\:flex.items-center.space-x-6 > a.nav-span.text-slate-600.hover\\:text-primary.transition-custom.flex.items-center.gap-1\\.5"));driver.findElement(By.cssSelector("body > nav > div > div.hidden.md\\:flex.items-center.space-x-6 > a.nav-span.text-slate-600.hover\\:text-red-500.transition-custom.flex.items-center.gap-1\\.5"));assert !title.isEmpty();assert !createTiem.isEmpty();assert !content.isEmpty();assert !text.isEmpty();assert !git.isEmpty();assert button.equals("查看全文");screenShot("BlogListPage_" + "CheckPageRight");}public void CheckPageGitAndPush() {//檢查git按鈕String beforHandle = driver.getWindowHandle();driver.findElement(By.cssSelector("body > div > div > div.left.md\\:w-1\\/4.lg\\:w-1\\/5 > div > div.px-6.pb-6.-mt-12 > a")).click();String lastHandle = driver.getWindowHandle();List<String> list = driver.getWindowHandles().stream().toList();for (String handle : list) {if (!list.equals(beforHandle)) {driver.switchTo().window(handle);}}screenShot("BlogListPage_" + "CheckPageGitAndPush");driver.switchTo();driver.close();driver.switchTo().window(beforHandle);driver.findElement(By.cssSelector("body > nav > div > div.hidden.md\\:flex.items-center.space-x-6 > a:nth-child(2)")).click();String title = driver.findElement(By.cssSelector("body > div > div > div.mb-6.animate-fade-in > h1")).getText();assert title.equals("編輯博客");driver.navigate().back();}public void CheackDteail() {String beforTitle = driver.findElement(By.cssSelector("body > div > div > div.right.flex-1 > div.space-y-6.blog-list > div:nth-child(1) > div.title.text-xl.font-bold.text-slate-800.hover\\:text-primary.transition-custom.mb-2")).getText();driver.findElement(By.cssSelector("body > div > div > div.right.flex-1 > div.space-y-6.blog-list > div:nth-child(1) > a")).click();String lastTitle = driver.findElement(By.cssSelector("#blog-content > div.p-6.md\\:p-8.border-b.border-slate-100 > h1")).getText();assert beforTitle.equals(lastTitle);blogDetailUrl = driver.getCurrentUrl();driver.findElement(By.cssSelector("body > nav > div > div.hidden.md\\:flex.items-center.space-x-6 > a:nth-child(1)")).click();}
}
(5)詳情頁界面類BlogDetailPage
public class BlogDetailPage extends Utils {public static String url = blogDetailUrl;public BlogDetailPage() {super(url);}public void checkDetailRight() {String buttonEdit = driver.findElement(By.cssSelector("#blog-content > div.p-6.md\\:p-8.border-t.border-slate-100.bg-slate-50\\/50 > div.operating.flex.flex-wrap.gap-4 > button.bg-primary.hover\\:bg-primary\\/90.text-white.px-5.py-2\\.5.rounded-lg.transition-custom.flex.items-center.gap-1\\.5.shadow-sm.btn-hover")).getText();String title = driver.findElement(By.cssSelector("#blog-content > div.p-6.md\\:p-8.border-b.border-slate-100 > h1")).getText();String text = driver.findElement(By.cssSelector("#blog-content > div.p-6.md\\:p-8.detail-content")).getText();String buttonDelete = driver.findElement(By.cssSelector("#blog-content > div.p-6.md\\:p-8.border-t.border-slate-100.bg-slate-50\\/50 > div.operating.flex.flex-wrap.gap-4 > button.bg-red-500.hover\\:bg-red-600.text-white.px-5.py-2\\.5.rounded-lg.transition-custom.flex.items-center.gap-1\\.5.shadow-sm.btn-hover")).getText();driver.findElement(By.cssSelector("body > div > div > div.left.md\\:w-1\\/4.lg\\:w-1\\/5 > div > div.px-6.pb-6.-mt-12"));driver.findElement(By.cssSelector("body > nav > div > div.hidden.md\\:flex.items-center.space-x-6 > a:nth-child(1)"));driver.findElement(By.cssSelector("body > nav > div > div.hidden.md\\:flex.items-center.space-x-6 > a:nth-child(2)"));driver.findElement(By.cssSelector("body > nav > div > div.hidden.md\\:flex.items-center.space-x-6 > a.nav-span.text-slate-600.hover\\:text-red-500.transition-custom.flex.items-center.gap-1\\.5"));assert buttonEdit.equals("編輯");assert buttonDelete.equals("刪除");assert !title.isEmpty();assert !text.isEmpty();driver.findElement(By.cssSelector("#blog-content > div.p-6.md\\:p-8.border-t.border-slate-100.bg-slate-50\\/50 > div.operating.flex.flex-wrap.gap-4 > button.bg-primary.hover\\:bg-primary\\/90.text-white.px-5.py-2\\.5.rounded-lg.transition-custom.flex.items-center.gap-1\\.5.shadow-sm.btn-hover")).click();String upPageTitle = driver.findElement(By.cssSelector("#title")).getText();assert title.equals(upPageTitle);}public void DetalUpdatepage() {String beforeTitle=driver.findElement(By.cssSelector("#title")).getText();//更新driver.findElement(By.cssSelector("#title")).clear();driver.findElement(By.cssSelector("#title")).sendKeys("自動化更新標題:" + createTime());driver.findElement(By.cssSelector("#submit")).click();String lastTitle = driver.findElement(By.cssSelector("body > div > div > div.right.flex-1 > div.space-y-6.blog-list > div:nth-child(1) > div.title.text-xl.font-bold.text-slate-800.hover\\:text-primary.transition-custom.mb-2")).getText();assert !beforeTitle.equals(lastTitle);}public void DetalDetelepage() {driver.findElement(By.cssSelector("body > div > div > div.right.flex-1 > div.space-y-6.blog-list > div:nth-child(1) > a")).click();//刪除driver.findElement(By.cssSelector("#blog-content > div.p-6.md\\:p-8.border-t.border-slate-100.bg-slate-50\\/50 > div.operating.flex.flex-wrap.gap-4 > button.bg-red-500.hover\\:bg-red-600.text-white.px-5.py-2\\.5.rounded-lg.transition-custom.flex.items-center.gap-1\\.5.shadow-sm.btn-hover")).click();wait.until(ExpectedConditions.alertIsPresent());Alert alert = driver.switchTo().alert();alert.accept();wait.until(ExpectedConditions.alertIsPresent());alert = driver.switchTo().alert();alert.accept();}
}
(6)博客編輯類BlogEditPage
public class BlogEditPage extends Utils {public static String url = "http://1.94.188.69:9090/blog_edit.html";public BlogEditPage() {super(url);}public void checkEditPage() {String editNoun = driver.findElement(By.cssSelector("body > div > div > div.mb-6.animate-fade-in > h1")).getText();driver.findElement(By.cssSelector("#submit"));driver.findElement(By.cssSelector("body > nav > div"));driver.findElement(By.cssSelector("body > div > div > div.mb-6.animate-fade-in > p"));driver.findElement(By.cssSelector("#title"));driver.findElement(By.cssSelector("#editor > div.CodeMirror.cm-s-default.CodeMirror-wrap > div.CodeMirror-scroll > div.CodeMirror-sizer > div > div"));assert editNoun.equals("編輯博客");//driver.findElement(By.cssSelector("#title")).clear();}public void EditText() {driver.findElement(By.cssSelector("#title")).sendKeys("自動化創建博客標題:" + createTime());// 定位 CodeMirror 編輯器元素WebElement element = driver.findElement(By.cssSelector("#editor > div.CodeMirror.cm-s-default.CodeMirror-wrap > div.CodeMirror-scroll > div.CodeMirror-sizer > div"));// 構建輸入內容String content = "自動化內容生成:" + createTime() + "\n" +"自動化內容生成:" + createTime() + "\n" +"自動化內容生成:" + createTime() + "\n" +"自動化內容生成:" + createTime();// 清除現有內容并輸入新內容new Actions(driver)// 移動到編輯器并點擊獲取焦點.moveToElement(element).click()// 全選內容(兼容多平臺).keyDown(System.getProperty("os.name").contains("Mac") ? Keys.COMMAND : Keys.CONTROL).sendKeys("a").keyUp(System.getProperty("os.name").contains("Mac") ? Keys.COMMAND : Keys.CONTROL)// 刪除選定內容.sendKeys(Keys.DELETE)// 添加短暫等待確保刪除完成.pause(Duration.ofMillis(200))// 輸入新內容.sendKeys(content)// 確保輸入完成后按回車結束.sendKeys(Keys.ENTER).perform();driver.findElement(By.cssSelector("#submit")).click();wait.until(ExpectedConditions.alertIsPresent());Alert alert = driver.switchTo().alert();alert.accept();}
}
(7)Main函數
public class RunTests {public static void main(String[] args) throws InterruptedException {//登錄界面BlogLoginPage blogLoginPage = new BlogLoginPage();blogLoginPage.checkPageRight();         //檢查界面元素是否加載正常blogLoginPage.checkPublishButton();     //檢查博客按鈕是否正常blogLoginPage.checkErrorLogin();        //賬號與密碼錯誤時blogLoginPage.checkCorrectLogin();      //賬號與密碼正確時//博客列表界面BlogListPage blogListPage = new BlogListPage();blogListPage.CheckPageRight();  //檢查界面元素是否加載正常blogListPage.CheckPageGitAndPush();//檢查git與發布按鈕是否可以跳轉blogListPage.CheackDteail();     //進入詳情頁//博客更新/刪除BlogDetailPage blogDetailPage = new BlogDetailPage();blogDetailPage.checkDetailRight();blogDetailPage.DetalUpdatepage();blogDetailPage.DetalDetelepage();//編輯博客BlogEditPage blogEditPage = new BlogEditPage();blogEditPage.checkEditPage();blogEditPage.EditText();Utils.quit();}
}

(三)性能測試?

使用JMeter工具對論壇系統的接口進行簡單的性能測試:

1.添加HTTP相關接口信息添加以及HTTP頭文件管理器

? ?(1)登錄接口測試

以JSON格式發送

添加CSV文件,可以保證多個用戶輪流登錄

(2)博客列表接口測試

添加基本接口信息

寫的token進行請求接口

配置JSON提取器,方便其他接口訪問當前信息

(3)博客詳情頁接口測試

(4)更新博客接口測試

(5)發布博客接口

(6)刪除接口測試

2.添加同步定時器

3.壓力性能測試報告

一、核心指標概覽

????????1、測試基礎信息

測試腳本:test.jmx

持續時間:僅1分鐘(11:54 PM → 11:55 PM),時長過短可能導致數據偶然性。

總請求量:1974次(平均并發≈33請求/秒)

????????2、成功率與失敗率

通過率:99.8%(1970次成功)

失敗率:0.2%(4次失敗)

二、深度問題診斷

????????1. 錯誤分析(致命問題)

錯誤類型

次數

影響接口

根本原因

java.net.SocketException

3

登錄接口

??TCP連接超時??

HttpHostConnectException

1

登錄接口

目標服務器無響應

錯誤細節:

Connect to 1.94.188.69:9090 failed: Connection timed out

問題定位:

目標服務器 1.94.188.69:9090 的網絡連通性故障或端口阻塞

服務器過載未及時響應(登錄接口響應中位數達 18.4秒!)

????????2. 登錄接口性能瓶頸

指標

登錄接口

其他接口(對比)

請求次數

343

≈325次/接口

錯誤次數

??3??

≤1

響應中位數

??18415ms??

約2ms~5ms

P95響應時間

??3388ms??

<10ms

結論:

登錄接口存在嚴重性能缺陷(響應延遲高達18秒)

錯誤率0.87%(遠超其他接口0%~0.31%),是系統瓶頸點

????????3. Apdex指數分析

全局Apdex:0.879(尚可接受,但局部異常)

登錄接口Apdex:0.542(遠低于均值)

用戶對登錄接口的體驗滿意度顯著劣化(500ms容忍閾值下)

以上為本次報告全部內容,感謝觀看。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/93278.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/93278.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/93278.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Nestjs框架: 基于Mongodb的多租戶功能集成和優化

概述 基于前文&#xff0c;我們知道如何集成多租戶的相關功能了, 現在我們繼續集成Monodb的多租戶形式需要注意的是&#xff0c;MongoDB 在 NestJS 中的使用過程中存在一些“坑點”如果按照默認方式集成&#xff0c;會發現連接數在不斷增長&#xff0c;即使我們請求的是相同的數…

如何利用機器學習分析篩選生物標記物

在生物信息學中&#xff0c;Lasso回歸、隨機森林&#xff08;Random Forest&#xff09;和XGBoost因其各自的特性和優勢&#xff0c;被廣泛應用于基因組學、蛋白質組學、藥物發現和疾病機制研究等領域。 Lasso回歸 癌癥亞型分類&#xff1a;從TCGA數據中篩選驅動基因&#xf…

計算機網絡(基礎篇)

TCP/IP 網絡模型 應用層&#xff08;Application Layer&#xff09; 應用層只需要專注于為用戶提供應用功能&#xff0c;比如 HTTP、FTP、Telnet、DNS、SMTP等。應用層是工作在操作系統中的用戶態&#xff0c;傳輸層及以下則工作在內核態。傳輸層&#xff08;Transport Layer&a…

全面解析 CSS Flex 布局:從入門到精通的所有屬性詳解

1. Flex 容器屬性 通過 display: flex 或 display: inline-flex 將元素設置為 Flex 容器。以下是所有容器屬性。 1.1 display: flex | inline-flex 作用&#xff1a;定義一個 Flex 容器。可選值&#xff1a; flex&#xff1a;塊級容器&#xff0c;占據整行。inline-flex&#x…

數據結構:對角矩陣(Diagonal Matrix)

目錄 矩陣的傳統表示&#xff1a;二維數組 &#x1f50d; 真正有用的數據是哪些&#xff1f; 從二維數組轉為一維數組 用 C 類實現對角矩陣 1. 對角矩陣真正需要存什么&#xff1f; 2. 對角矩陣允許哪些行為&#xff1f; 3. 為什么要動態分配數組&#xff1f; 接下來推…

Leetcode_349.兩個數組的交集

這道題的意思很明確&#xff0c;就是讓尋找兩個數組中的共同元素&#xff0c;并去重&#xff0c;由此可以聯想到哈希表的特性&#xff0c;注意到題目給的數據范圍&#xff0c;在1000以內&#xff0c;所以本題可以使用 STL 的庫函數&#xff0c;也可以使用數組進行模擬。 本題要…

STM32——寄存器映射

總 &#xff1a;STM32——HAL庫總結-CSDN博客 芯片資料&#xff1a; STM32F1系列參考手冊-V10&#xff08;中&#xff09; STM32F103ZET6(English) 一、寄存器基礎 1.1 簡介 單片機內部的控制機構。 像空氣開關控制電路一樣的原理&#xff0c;打開關閉某個開關&#xff0…

Java響應式編程

Java 響應式編程是一種基于異步數據流處理的編程范式&#xff0c;它強調數據流的聲明式構建和傳播變化的自動響應。Java 9 引入的Flow API為響應式編程提供了標準接口&#xff0c;而 Reactor 和 RxJava 等第三方庫則提供了更豐富的操作符和工具。核心概念Publisher&#xff08;…

【重學數據結構】二叉搜索樹 Binary Search Tree

目錄 二叉搜索樹的數據結構 手寫實現二叉搜索樹 樹節點定義 插入節點 源碼 流程圖 二叉樹插入步驟圖解 第一步: 插入 20 第二步: 插入 10 第三步: 插入 30 第四步: 插入 5 查找節點 源碼 場景一: 查找成功 (search for 25) 第一步: 從根節點開始 第二步:…

四、計算機組成原理——第1章:計算機系統概述

目錄 1.1計算機發展歷程 1.1.1計算機硬件的發展 1.計算機的四代變化 2.計算機元件的更新換代 1.1.2計算機軟件的發展 1.2計算機系統層次結構 1.2.1計算機系統的組成 1.2.2計算機硬件 1.馮諾依曼機基本思想 2.計算機的功能部件 (1)輸入設備 (2)輸出設備 (3)存儲器 (4)運算器 (5)…

flutter TextField 失去焦點事件

在 Flutter 中&#xff0c;處理 TextField 的失去焦點事件&#xff08;即失去焦點時觸發的操作&#xff09;通常有兩種常用方式&#xff1a;使用 FocusNode 或 onEditingComplete 回調。以下是具體實現&#xff1a; import package:flutter/material.dart;class MyTextField e…

Moonlight for ChromeOS 常見問題解決方案

Moonlight for ChromeOS 常見問題解決方案 項目基礎介紹 Moonlight for ChromeOS 是一個開源的 NVIDIA GameStream 客戶端&#xff0c;允許用戶將他們的游戲從高性能的桌面電腦流式傳輸到運行 ChromeOS 的設備上。該項目還支持 Android 和 iOS/tvOS 平臺。Moonlight for Chrome…

SQL語句:讀操作、寫操作、視圖

文章目錄讀操作分類基礎查詢語句示例高級查詢--分組查詢、子查詢、表連接、聯合查詢分組查詢&#xff1a;子查詢&#xff08;嵌套查詢&#xff09;表連接聯合查詢寫操作視圖SQL&#xff1a;結構化查詢語言讀操作 重點是where查詢&#xff0c;即高級查詢部分 分類 DML &#…

Python 機器學習實戰:基于 Scikit-learn

本文圍繞《Python 機器學習實戰&#xff1a;基于 Scikit-learn 的項目開發》展開&#xff0c;先介紹 Scikit-learn 庫的基礎特性與優勢&#xff0c;再闡述機器學習項目開發的完整流程&#xff0c;包括數據收集與預處理、模型選擇與訓練、評估與優化等。通過具體實戰案例&#x…

java里List鏈式編程

java里對list的操作&#xff0c;我們一遍使用for遍歷&#xff0c;輸出或改變里面的內容。單經常在代碼里面我們發現&#xff0c;也可以使用這樣的代碼結構daPaymentActionVo.setApnolist(paymentActionVo.getApnolist().stream().map(PaymentActionVo.Voucher::getApno).collec…

【esp32s3】7 - VSCode + PlatformIO + Arduino + 構建項目

一、PlatformIO 1.1. 概述 官方文檔&#xff1a;What is PlatformIO? PlatformIO 是一個跨平臺的物聯網開發生態系統&#xff0c;專門為嵌入式系統開發設計&#xff0c;支持多種開發板和框架。 1.1.1. 主要特點 跨平臺&#xff1a;支持 Windows、macOS 和 Linux多框架支持&…

LE AUDIO CIS/BIS音頻傳輸時延的計算

LE AUDIO音頻總時延計算方法 按照BAP的規范,LE AUDIO音頻總延時包括三個部分:Audio Processing Time,Transport Latency,Presentation Delay。如下圖所示是播放音樂的示例圖: 這里還有一個麥克風錄音的總時延示例圖: Audio Processing Time:這個就是音頻DSP獲取音頻數…

git 修改 更新

git 修改 更新先更新&#xff0c;后修改# 暫存當前修改 git add . git stash# 獲取最新的 main 分支 git checkout main git pull# 新建開發分支 git checkout -b lbg_0727# ?? 先把 main 的最新代碼合并/變基到當前分支&#xff08;用于消除沖突&#xff09; # 方法1&#x…

飛鶴困局:增長神話的裂痕

增長天花板已然逼近&#xff0c;飛鶴需要探尋新方向。作者|安德魯編輯|文昌龍“飛鶴&#xff0c;更適合中國寶寶體質”——這句曾讓無數媽媽點頭的廣告語&#xff0c;幫飛鶴坐上了中國奶粉市場的頭把交椅。可多年后&#xff0c;時代紅利退潮&#xff0c;故事不好講了。飛鶴的利…

Java設計模式之<建造者模式>

目錄 1、建造者模式 2、建造者模式結構 3、實現 4、工廠模式對比 5、適用場景差異 前言 建造者模式是一種創建型設計模式。用于封裝復雜對象的構建過程&#xff0c;通過步驟構建產品類。它包括產品類、抽象建造者、具體建造者和指揮者角色。 優點在于靈活性、解耦和易擴展…