近年來區塊鏈技術受到相當重視,相關應用也開始大量被開發。智能合約是運行於區塊鏈上,用於執行業務、交易的重要元件。近年來多學者不約而同地發現,如何驗證智能合約正確與完整反映繁瑣的業務規則,是區塊鏈應用程式開發的重要議題。然而,目前針對此議題仍欠缺系統化整合驗證與測試機制來確保所開發智慧合約的正確性。針對此一挑戰,本研究主要目的在於探究如何將行為驅動開發製程應用於區塊鏈智能合約的整合測試,利用行為驅動開發結合測試驅動開發製成實際開發一個支援BDD開發方法的Solidity智能合約語言自動整合測試平台,並且在本論文中以紅利點數交換為案例作為示範。此外,本研究亦以購物網站之購物車需求作為案例,就所開發系統進行使用者質性測試,針對易用性進行檢驗,研究結果顯示,本研究提出的機制能有效降低智能合約開發測試複雜度與負擔,提升合約品質。
The importance of blockchain technologies and applications increases rapidly in recent years. A smart contract is a software component that encapsulates business and transaction logic of an application running on top of a blockchain network. Automatic integration testing and verification of smart contracts have become a vital software engineering issue of contract development. Nevertheless, there still lacks a systematic automated integration testing and verification mechanism. This thesis proposes a BDD-style automatic integration testing platform for Solidity–based smart contracts by considering the cross-cutting concerns of integration testing. Besides, this research has implemented a prototype system and a loyalty point exchanging scenario. The outcomes of this research are helpful for minimizing the cost and complexity of smart contract development and thus increase the quality of the blockchain applications.