zoukankan      html  css  js  c++  java
  • Data Driven testing

    e.g. for the login case,  originally it's hard coded in the script. now using parameters in TestNG.xml

    //private static String username = "user01;
    //private static String password = "password";

    This is a test level parameter:

    step 1: add parameter in testng.xml

    <suite name="Suite">
    <test name="firstTest">
    <parameter name="username" value="user01" />
    <parameter name="password" value="password" />

    step2:  add @Parameter annotation in the caes and pass paremeter to the method

    @Parameters({ "username", "password" })
    public void firstTest(String username, String password) {

    SecurePage securepage = LoginPage.logIn(username, password);

    step3: change the method invoked from other class, uncomment the hard coded lines, e.g code in LoginPage.java

    public static SecurePage logIn(String username, String password) {

  • 相关阅读:
    三维dem
    geoserver 通过代码实现发布地图服务
    restful发布服务
    php防攻击
    redis主从复制
    redis虚拟内存
    redis 持久化
    lamp源码安装
    mysql优化
    php匿名函数与闭包函数
  • 原文地址:https://www.cnblogs.com/amy2012/p/11623922.html
Copyright © 2011-2022 走看看