[英]Automate real time data using java
我是自動化和Java的新寵。 我正在解決一個問題,該問題要求我從數據庫中讀取讀取的股票時間數據,並使用與UI上顯示的值相同的值對其進行驗證。 我可以將其值近似值提高到5%。 驗證這些測試是否通過對我來說很重要,即使用UI中的值聲明值。
我有一個驗證這些值的小邏輯,我想知道這是否是在Java上編碼的好方法,還是我有一種更好的方法來實現這些結果。
Alorigthm。
如果有更好的方法來處理這些值,請尋求更好的答案。
通常,讓您的斷言表示測試的含義,而必須斷言(true,true)不能執行此操作。 所以:
3. Calculate the absoluete difference between the value obtained in step 1 and the UI value (when I say absolute value, you need to remember that the UI might be higher or lower than the db value, you need to make the difference to be always positive)
4. Assert.assertThat( difference < theFivePercentValue)
您也可以考慮使用對JUnit的Hamcrest擴展,其中包括closeTo()方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.