軟件工程第二次做業
1.選擇開發工具
因爲電腦上就有vs2010,因此採用VSTS的單元檢測方法,截圖以下
![](http://static.javashuo.com/static/loading.gif)
2. 練習自動單元測試技術
點擊測試,選擇新建測試,再選擇單元測試,輸入項目名稱,截圖以下
![](http://static.javashuo.com/static/loading.gif)
編寫被測試代碼,這是求兩個數中最小的數的函數
![](http://static.javashuo.com/static/loading.gif)
將測試代碼寫入頭文件中
![](http://static.javashuo.com/static/loading.gif)
將要測試的數據寫入源文件中,測試樣例爲兩組,分別爲10和5,20和10
![](http://static.javashuo.com/static/loading.gif)
點擊測試,而後運行,選擇因此的測試,結果以下
![](http://static.javashuo.com/static/loading.gif)
3.總結
經過本次實驗的一些操做,基本明白了單元測試的操做方法,可是此次實驗主要目的是熟悉工具的使用,但程序並無編的很好。
歡迎關注本站公眾號,獲取更多信息