SlideShare a Scribd company logo
Qt/QtQuick Test
與
以QtQuick Test實現Qt GUI
Automation Testing之研究
2018/12/20
黃雲璘
大綱
• Qt提供的測試工具 – Qt Test vs Qt Quick Test
• Qt Unit Testing –網路範例與相關教學網頁
• Qt GUI Automation Testing – 實作於小型App專案
• 討論 – 使用Qt Quick test實現Qt GUI Automation Testing之可能性
• 延伸討論
Qt提供的測試工具 -
Qt Test vs Qt Quick Test
• For Unit testing applications and libraries
– QT Test
• 使用C++ 實現測試專案的架構
• 所有測試專案下的tst_*.cpp 會自動逐一執行一次
– Qt Quick Test
• 使用QML實現測試專案的架構
• 所有測試專案下的tst_*.qml 會自動逐一執行一次
• Main.cpp必須使用QUICK_TEST_MAIN macro (也可使用普通的main函式, 再
return quick_test_main, 參考https://www.slideshare.net/ICSinc/qt-test-
framework, p.50)
QtQuick Unit Testing –
相關教學網頁
• Qt Quick Test
• https://doc.qt.io/qt-5.11/qtquicktest-index.html
QtQuick Unit Testing –
相關教學網頁
• http://doc.qt.io/qt-5/qttest-qmlmodule.html
QtQuick Unit Testing –
相關教學網頁連結列表
• TestCase QML Type
• Introduction to QML Test Cases
• Data-driven Tests
• Benchmarks
• Simulating Keyboard and Mouse Events
• Managing Dynamically Created Test Objects
• 其他(包含Qt Test)
• Qt test – Unit testing framework
• Chapter 3: Simulating GUI Events
• Running Autotests
• Qt Test
• How to create a Qt-Quick Test
• Intention of GUI-Unit Testing in QML
• Writing UnitTests for my Qt Application
• (測試邏輯(包裝成static lib)的unit test)
Qt Unit Testing –
網路範例
• GUI unit testing with Qt Test – part 1 – introduction
• (和第一個範例雷同)
• https://github.com/vivaladav/BitsOfBytes/tree/master/gui-unit-testing-with-qt-
test-introduction
Qt Unit Testing –
網路範例
Qt GUI Automation Testing -
實作於小型App專案 (Alarm Clock小鬧鐘)
•專案結構 main.cpp
main.qml
alarmManager
控制小鬧鐘的
行為與資料
1. 設定存放小鬧鐘資料
2. alarmManager的singletonType註冊
Qt GUI Automation Testing -
實作於小型App專案 (Alarm Clock小鬧鐘)
• 介面功能:
1. 選 , 按下ADD ALARM, 可手動輸入時間並新增:
2. 選 , 按下ADD ALARM, 可選時間並新增:
3. 在主介面中刪除時間:
•測試專案結構
Qt Quick測試
相關Lib
測項實現
負責控制小鬧鐘
的
alarmManager
Qt GUI Automation Testing -
實作於小型App專案 (Alarm Clock小鬧鐘)
•測試專案結構
• main.cpp
1. 設定存放小鬧鐘資料
2. alarmManager的singletonType註冊
Qt GUI Automation Testing -
實作於小型App專案 (Alarm Clock小鬧鐘)
• 測試專案結構
• tst_alarmClcok.qml
2.
鑲入主介面QML
3.
測試function
4.
Key/mouse events
序列
每一個event步驟之
間的delay function,
使畫面中的步驟可
觀察
1.
Import 被測試QML與
alarmManager Type
Qt GUI Automation Testing -
實作於小型App專案 (Alarm Clock小鬧鐘)
討論 – 使用Qt Quick test實現Qt GUI Automation
Testing之可能性
• GUI Test測試前提: 保持應用程序環境一致
• 需實現測試前的相關設定(ex. 註冊Register type, 設定檔..)
• Qt Quick test為一個tst_*.qml 檔案對映一個Application中被測試的
qml (或功能), 當被測試時即instance一次
• 小鬧鐘的instance與所有的GUI Test都必須實現在同一tst_alarmClcok.qml檔
中
• 使用Qt Quick Test實現GUI Test的可能性
• 較小(結構較單純)的專案可實現沒問題
• 結構複雜龐大的專案可能不行, 或實現後維護起來很複雜
• 每一次Application的source code被修改時, 測試專案也必須注意是否需要
跟著修改
延伸討論
• 除了用QtQuik Test的架構實現之外有沒有其他作法?
延伸討論
• Active QT
• QAxWidget mediaplayer example
延伸討論
• Active QT
• QAxWidget mediaplayer example
延伸討論
• Active QT
• QAxWidget mediaplayer example
延伸討論
• 以Active QT實現外部Qt Application鑲嵌的可能性?

More Related Content

PDF
Storytelling For The Web: Integrate Storytelling in your Design Process
PDF
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
PPTX
调试技术的应用
PPTX
Android程式設計(7)
PPTX
Qt Quick - Key events
PPTX
Overview - QML and C++ Integration
PPTX
Overview - QML and C++ Integration
Storytelling For The Web: Integrate Storytelling in your Design Process
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
2024 Trend Updates: What Really Works In SEO & Content Marketing
调试技术的应用
Android程式設計(7)
Qt Quick - Key events
Overview - QML and C++ Integration
Overview - QML and C++ Integration
Ad

Overview of Qt/QtQuick Testing, and Study for Qt GUI Automation Testing by QtQuick Test

  • 1. Qt/QtQuick Test 與 以QtQuick Test實現Qt GUI Automation Testing之研究 2018/12/20 黃雲璘
  • 2. 大綱 • Qt提供的測試工具 – Qt Test vs Qt Quick Test • Qt Unit Testing –網路範例與相關教學網頁 • Qt GUI Automation Testing – 實作於小型App專案 • 討論 – 使用Qt Quick test實現Qt GUI Automation Testing之可能性 • 延伸討論
  • 3. Qt提供的測試工具 - Qt Test vs Qt Quick Test • For Unit testing applications and libraries – QT Test • 使用C++ 實現測試專案的架構 • 所有測試專案下的tst_*.cpp 會自動逐一執行一次 – Qt Quick Test • 使用QML實現測試專案的架構 • 所有測試專案下的tst_*.qml 會自動逐一執行一次 • Main.cpp必須使用QUICK_TEST_MAIN macro (也可使用普通的main函式, 再 return quick_test_main, 參考https://www.slideshare.net/ICSinc/qt-test- framework, p.50)
  • 4. QtQuick Unit Testing – 相關教學網頁 • Qt Quick Test • https://doc.qt.io/qt-5.11/qtquicktest-index.html
  • 5. QtQuick Unit Testing – 相關教學網頁 • http://doc.qt.io/qt-5/qttest-qmlmodule.html
  • 6. QtQuick Unit Testing – 相關教學網頁連結列表 • TestCase QML Type • Introduction to QML Test Cases • Data-driven Tests • Benchmarks • Simulating Keyboard and Mouse Events • Managing Dynamically Created Test Objects • 其他(包含Qt Test) • Qt test – Unit testing framework • Chapter 3: Simulating GUI Events • Running Autotests • Qt Test • How to create a Qt-Quick Test • Intention of GUI-Unit Testing in QML
  • 7. • Writing UnitTests for my Qt Application • (測試邏輯(包裝成static lib)的unit test) Qt Unit Testing – 網路範例
  • 8. • GUI unit testing with Qt Test – part 1 – introduction • (和第一個範例雷同) • https://github.com/vivaladav/BitsOfBytes/tree/master/gui-unit-testing-with-qt- test-introduction Qt Unit Testing – 網路範例
  • 9. Qt GUI Automation Testing - 實作於小型App專案 (Alarm Clock小鬧鐘) •專案結構 main.cpp main.qml alarmManager 控制小鬧鐘的 行為與資料 1. 設定存放小鬧鐘資料 2. alarmManager的singletonType註冊
  • 10. Qt GUI Automation Testing - 實作於小型App專案 (Alarm Clock小鬧鐘) • 介面功能: 1. 選 , 按下ADD ALARM, 可手動輸入時間並新增: 2. 選 , 按下ADD ALARM, 可選時間並新增: 3. 在主介面中刪除時間:
  • 11. •測試專案結構 Qt Quick測試 相關Lib 測項實現 負責控制小鬧鐘 的 alarmManager Qt GUI Automation Testing - 實作於小型App專案 (Alarm Clock小鬧鐘)
  • 12. •測試專案結構 • main.cpp 1. 設定存放小鬧鐘資料 2. alarmManager的singletonType註冊 Qt GUI Automation Testing - 實作於小型App專案 (Alarm Clock小鬧鐘)
  • 13. • 測試專案結構 • tst_alarmClcok.qml 2. 鑲入主介面QML 3. 測試function 4. Key/mouse events 序列 每一個event步驟之 間的delay function, 使畫面中的步驟可 觀察 1. Import 被測試QML與 alarmManager Type Qt GUI Automation Testing - 實作於小型App專案 (Alarm Clock小鬧鐘)
  • 14. 討論 – 使用Qt Quick test實現Qt GUI Automation Testing之可能性 • GUI Test測試前提: 保持應用程序環境一致 • 需實現測試前的相關設定(ex. 註冊Register type, 設定檔..) • Qt Quick test為一個tst_*.qml 檔案對映一個Application中被測試的 qml (或功能), 當被測試時即instance一次 • 小鬧鐘的instance與所有的GUI Test都必須實現在同一tst_alarmClcok.qml檔 中 • 使用Qt Quick Test實現GUI Test的可能性 • 較小(結構較單純)的專案可實現沒問題 • 結構複雜龐大的專案可能不行, 或實現後維護起來很複雜 • 每一次Application的source code被修改時, 測試專案也必須注意是否需要 跟著修改
  • 16. 延伸討論 • Active QT • QAxWidget mediaplayer example
  • 17. 延伸討論 • Active QT • QAxWidget mediaplayer example
  • 18. 延伸討論 • Active QT • QAxWidget mediaplayer example
  • 19. 延伸討論 • 以Active QT實現外部Qt Application鑲嵌的可能性?