Selenium IDE: Gosub Control 使い方

定型操作のlogin

gosubを使わない例

# login user
open ${BASE_URL}/login
type name=username ${USER_USERNAME}
type name=password ${USER_PASSWORD}
clickAndWait id=btnLogin
# action and verify
...
# lougout
clickAndWait link="logout"
#
# login admin
open ${BASE_URL}/login
type name=username ${ADMIN_USERNAME}
type name=password ${ADMIN_PASSWORD}
clickAndWait id=btnLogin
# action and verify
...
# logout
clickAndWait link="logout"

gosubを使って、login user、login admin、logoutをサブルーチン化した例

gosub login_user
# action and verify
...
#
gosub logout
#
gosub login_admin
# action and verify
...
gosub logout
#
#----------------------------------------
# sub login_user
#----------------------------------------
sub login_user
open ${BASE_URL}/login
type name=username ${USER_USERNAME}
type name=password ${USER_PASSWORD}
clickAndWait id=btnLogin
endsub
#----------------------------------------
# sub login_admin
#----------------------------------------
sub login_admin
open ${BASE_URL}/login
type name=username ${ADMIN_USERNAME}
type name=password ${ADMIN_PASSWORD}
clickAndWait id=btnLogin
endsub
#----------------------------------------
# sub logout
#----------------------------------------
sub logout
clickAndWait link="logout"
endsub
#