Tuesday 14 March 2017

學習自動化測試日記


2017/2/17 :
                   之前就很想學自動化測試,但是一直沒有好的機會學,市面上的書都寫得很深不然就是說個大概而已。 這次在udemy上看到 Seleniun 課程,決定今年要學好,就買下了
!!


 
2017/3/3 :
                 今天上完課了!! 但是發現學了很基本的概念,也發現要學的東西更多,多了一個Robot Framework 。
                寫一個Login測試腳本,遇到問題1. 輸入帳號與密碼登入後要進入下一個並輸入專案名稱,程式跑太快還沒到登入完畢就進入下一步故報Eorre, 解決方案: WebDriverWait (解決)。問題2: 等一次 ,要再等第二次時發現之前的code無法用 (解決)。 問題3: 無法click button which is in iframe.

2017/3//6 :
               上周找問題時看到 Selenium的學習網站 ( http://selenium-python.readthedocs.io/getting-started.html ), 今天發點時間來看,但是看到2.3 Using Selenium to write tests 看到 unitest (pyhton unit testing framework ),看起來很複雜,而且這個是似乎針對 python 的單元測試,目前我的專案是C# ,等學完後要切換至C#學selenium,現在學python因為網路資料多且也想趁機學python。

2017/3/7 :
                今天學Robot Framework,Robot Framework是跑測試並產生出一個報告

2017/3/15
                上週蠻忙得,不過都有寫一點點的測試,最大問題是有時firefox or chrome無法正常執行,例如driver有問題、跳出來是blank page、timeout等等問題。發現當寫測試時要把瀏覽器停止自動更新,因為更新後selenium的driver也許無法搭配使用。昨天就花一個下午解決firefox無法完整執行測試程式,執行firefox後就一直是blank page,爬很多文,最後解決問題是去升級selenium到3.3.1版本。

google key word: "why-blank-page-opens-in-firefox-when-run-with-selenium-for-the-first-time"
          
本來想試這個解決方法的 沒想到升級的解決了我的問題
https://coderwall.com/p/-h-oxa/run-selenium-with-latest-firefox-versions

解決了就繼續往下走,目標是產生測試報告。

2017/3/29
               1. 用 HTMLTestRunner 可以跑出report 但是在unittest下是無法產生的, 一直找不出辦法,也貼在stack overflow 貼文了 還是沒有回應,看來要自己解決了。 http://stackoverflow.com/questions/42945583/python3-htmltestrunner-not-generating-report
          2. 開始寫自動化測試教學。


目前測試環境是
python36
selenium 3.3.1
firefox 48.0.2
chrome Version 56.0.2924.87

2017/3/20 :
            上一周寫一個測試程式,但是是要做drag and drop的測試,一直都弄不出來,問題是我一直執著在用click_and_hold ,當初想是selenium的執行動作太快了所以無法完成,一直想有沒有辦法讓它慢下來,今天改用  click_and_hold 來完成。Yeah!!  繼續往下走


        actions = ActionChains(driver) 
        actions.click_and_hold(righttree)
        actions.move_to_element(target) 
        actions.click(target) 
        actions.release() 
        actions.perform()


https://seleniumhq.github.io/selenium/docs/api/py/webdriver/selenium.webdriver.common.action_chains.html

學習路徑 :  1. install python
                    2. install selenium
                    3. write the first testing script -open browser, find elements on page and input value
                    4. install Robot Framework
                 
          2017/3/6 :
                             unitest :  https://docs.python.org/2/library/unittest.html
                              中文網站 : http://www.webdriver.org/nav2/ - 這是已Java當主機的網站
          2017/3/15
                            how to get selenium to wait for page load after a click
                            http://www.obeythetestinggoat.com/how-to-get-selenium-to-wait-for-page-load-after-a-click.html


     

No comments:

Post a Comment

how-to-recursively-create-subfolder-in-each-folder-of-a-directory-in-cmd

test.cmd: @echo off setlocal for /f "usebackq tokens=*" %%a in (`dir /b /a:d`) do ( rem enter the directory pushd %%a echo...