1) If install QC as cluster, then all the node must be same: same application container, same OS, same path of installed ALM Platform, and same web site management database. besides, the ALM platform must be same version.
2) Keep two system service open.
➤ Secondary Logon
➤ Windows Management Instrumentation
-------------------------------------------------------------------------------
to install:
  1. the starter version can only be installed on winXP.
  2. don't change the password of database when installing.
  3. the communication password, I used 2ert2ert2ert.
  4. I didn't set the email server, because didn't know where to input username and password for the smtp server.
  5. the website admin account I used SA as username and pasword used 2ert2ert2ert.
  6. made the hp machine and Acer machine connect to same lan (I used our neighbor's lan, so the server's ip is 192.168.0.103)
  7. -------------
  8. the client application must be installed in XP, can not be installed in Win7
  9. So I installed it in Acer's VM: just visit http://192.168.0.103:8080/qcbin/start_a.jsp, and download the client.
-- Sam 05:36 17/07/2014

 Mockito
  1. 在pom.xml中加入相应依赖:
    1.  <groupId>org.mockito</groupId>
    2.  <artifactId>mockito-all</artifactId>
    3.  <version>1.9.5</version>
    4.  <scope>test</scope>
  2. 用@mock 注解标示哪些变量要进行mock
  3. 在@beforeClass 方法中调用MockitoAnnotations.initMocks( this );//这句话作用不知道是啥?给所有的@mock注解的变量赋Mock值?
  4. 在各@test方法中为用到的mock变量设置when( personDAO.fetchPerson( 1 ) ).thenReturn( person );
-- Sam 16:42 06/09/2014
 **********************单元测试***************************
  1. 要确保编译通过先(废话),并做代码审查,因为:
    1. 代码审查可以高效去除多数错误。
    2. 代码的不同设计方法,决定了代码容易在不同的情况下出现问题,决定了单元测试案例的设计方向。
  2. 驱动数据设计,有的数据是不能简单准备好的,比如位数为上百万的数组....
  3. Mock的设计,有的方法需要下级程序的反馈,才能正常执行,所以用Mock简单实现下级程序的功能。
    1. Mock设计要尽量简单,避免出错。
    2. 整合测试时,要重新测试该功能,防止mock的设计错误。
  4. 设计blackBox用例
    1. 基本功能测试,给个典型输入即可,证明方法至少在某种情况下是通过的。
    2. 正面测试用例,如符合
    3. 负面测试案例
    4. 性能测试案例
  5. 设计whiteBox用例
    1. 根据代码,设计逻辑上容易出错的案例
    2. 根据代码,设计边界上容易出错的案例
  6. 注意代码的执行顺序:
    1. @BeforeClass -> @Before -> @Test -> @After -> @AfterClass;
  7. @test的参数:
    1. @Test(expected=XXXException.class)  没有跑出XXXException则报错。
    2. @Test(timeout = 1000)时间超过1秒则报错。
  8. @Ignore的用处,跟注释掉或者把@Test拿掉一样效果。好处在于,加@ignore注解,则该方法仍被编译为class,所以若需要的话,仍然可以通过反射把这些方法统计出来,做个报告啥的,如果注释掉就不会进入classfile了,如果去掉@test也不能通过反射,根据@ignore轻易找出来了。
  9. 执行器和testsuit
  10. 参数化
    1. 若参数化,运行器必须为 org.junit.runners.Parameterized。
    2. 参数声明为类变量,对应的期望值也声明为类变量。
    3. 为测试类声明一个使用 org.junit.runners.Parameterized.Parameters 注解的,返回值为 Collection 的公共静态方法,并在此方法中初始化所有需要测试的参数对。
    4. 为测试类声明一个带有参数的公共构造函数,并在其中为第二个环节中声明的几个变量赋值。
    5. 编写测试方法,使用定义的变量作为参数进行测试。
    6. 例子:
      1. @RunWith(Parameterized.class) 
      2. public class TestWordDealUtilWithParam { 

      3.         private String expected; 
      4.     
      5.         private String target; 
      6.     
      7.         @Parameters 
      8.         public static Collection words(){ 
      9.             return Arrays.asList(new Object[][]{ 
      10.                 {"employee_info", "employeeInfo"},      // 测试一般的处理情况
      11.                 {null, null},                           // 测试 null 时的处理情况
      12.                 {"", ""},                               // 测试空字符串时的处理情况
      13.                 {"employee_info", "EmployeeInfo"},      // 测试当首字母大写时的情况
      14.                 {"employee_info_a", "employeeInfoA"},   // 测试当尾字母为大写时的情况
      15.                 {"employee_a_info", "employeeAInfo"}    // 测试多个相连字母大写时的情况
      16.             }); 
      17.         } 
      18.     
      19.          /** 
      20.          * 参数化测试必须的构造函数
      21.          * @param expected     期望的测试结果,对应参数集中的第一个参数
      22.          * @param target     测试数据,对应参数集中的第二个参数
      23.          */ 
      24.         public TestWordDealUtilWithParam(String expected , String target){ 
      25.             this.expected = expected; 
      26.             this.target = target; 
      27.         } 
      28.     
      29.          /** 
      30.          * 测试将 Java 对象名称到数据库名称的转换
      31.          */ 
      32.         @Test public void wordFormat4DB(){ 
      33.             assertEquals(expected, WordDealUtil.wordFormat4DB(target)); 
      34.         } 
      35. }
-- Sam 18:36 06/09/2014
chapter?
when do we use senario recover? only when know the type of the error, but don't know when and where it will occur, we use senario recovery, otherwise, we use on Error go next, then check the error type.
-- Sam 05:52 29/07/2014
VM Notices:
  1. the password of accpac is jmao.
  2. when the accpac vm is unzipped, check if it can connect to internet? if can not, right click it on the left hand bar, and select the settings, the network should be NAT. (my copy of accpc is by default "connect only to localhost".
  3. the accpac support only to IE 7, seems not useful any more. the other vm are cloned from zhuyu's disk. and it's win7, while it can not run on wei's machine, don't know why (could it because the cpu is not intel?)
-- Sam 12:15 27/07/2014
---***QTP知识总结 ***---

Chapter1 when shoudl automation be used and not used??
  1. will be excuted multi time
  2. function will not changed often
    -----------------------------------------
  1. look and feel
  2. one time test is enough.
  3. random case, like play poker, card are delievered ramdomly.
  4. input and out put are in differnt environment: input in web, output are in an flex desktop app.
一句话,想想自动测试1,可能否,2,划算不。

Chapter2 如何用帮助
  1. Content下的web下列举了QTP定义的对象类型
  2. 如果想知道没个对象的get/setTOProperty方法的参数,看参考帮助下的identification properties的说明。
  3. get/setTOProperty and getROProperty的方法,参数都相同,但没有setROproperty方法,想改变其行为直接调方法即可驱动网页跳舞
Chapter3 对象库OR
  1. 加入OR两种方法:录制自动加,和手动加。
  2. Per-Action OR 和shared OR:为避免脚本多了时太多对象,就都用sharedOR 得了。大不了多被备份,少改动对象名。
  3. Object Identification:强制类属性,辅助类属性,外加三种Ordinal identifier。
  4. User-defined OBJ. 对于非标准控件,QTP识别不了,就手工给归个类。
Chapter4 数据表DataTables
  1. Global and Actoion: Global放多次运行全部脚本时所不一样的参数,如用户名密码等。Action中放多次运行单个脚本时不一样的参数。
  2. Design-time nd Run-time datatable: 运行时把设计状态的数据表复制了一份,所以可以随便改,脚本完了,改动自动丢失。
  3. 右击脚本,可以设置遍历的规则,如只跑哪行到哪行
  4. 三大对象:DataTable/DTSheet/DTParameter.
  5. 常用方法:
                                 -------------表中取值------------
    1. val = DataTable.getSheet("sheetName").getParameter("paraName").valueByeRow(rowNumber)//通吃格式。
    2. val = DataTable.value("paramName" "sheetName"/sheetIndex); 缩写形式为DataTable ("ParamName")//sheetName表当前行,”ParamNme“列)sheetName也可以用actionName,因为action会对应到一个sheet。
    3. val = DataTable.GlobalSheet.GetParameter("paraName").Value//同样效果,Global表,paraName列,当前行,
    4. val = DataTable.GlobalSheet.GetParameter("paraName").ValueByRow(1) //取某行的值。
    5. val = DataTable.LocalSheet.GetParemeter("paraName").value.
      ------------------------check 表是否存在--------------------
    6. Function isExist ( sheetName)
        On errro resume next
        isExist = true
        Err.clear
        set objSheet = DataTable.getSheet(sheetName)
        if Err.number <> 0 then
            isExist = false
        end if
      End Function
    7. 防止string被变数字:DataTable("paraname") = "'" & "1234"
    8. check 表中参数是否存在:DataTable.GetSheet(sheetName).getParameter(paraname)//结合上面的function格式。
    9. 表的有效内容行数:DataTable.GetSheet(sheetName).GetRowCount。
    10. 有效内容列数:
      DataTable.GlobalSheet.AddParameter "new",    "=COUNTA(A1:A65536)"//两参数,第二个是个excel表达式。
      val = DataTable("new")//取出其中的值。
    11. 改变当前行:DataTable.GetSheet(sheetName).setCurrentRow i
    12. 把page中table的内容拷贝入Sheet:
      Set objTable = Browser("").Page(""),webTable("") //抓到webtable元素
      rowCount = objTable.RowCount                               //几行?
      colCount = objTable.ColCount(1)                             //几列?
      Set outsheet = DataTable.addSheet("output")       增加个新表
      for i = 2 to colCount                                                      为啥从第二列开始遍历?
        cellText = objTable.getCellData(1,i)
        outSheet.AddParameter cellText, ""                        //页面表元素,第一行第二列起,没个cell的内容,作为数据表的表头加上
      next

      for i = 2 to rowCount                                                    //从页面表元素的第二行开始大遍
        outSheet.setCurrentRow i -1                                   //写入数据表时,从第一行开始写
        colCount = objTable.columnCount(i)         
        for j= 2 to colCount                                                                 //小遍为页面表元素的该行列数
          cellText = objTable.getCellData(i,j)
          outSheet.GetParameter(j - 1).value =cellText                 //写入
        next
      next
Chapter 5 Action

-- Sam 07:01 17/07/2014
---***性能测试***---
 How do I start a performance test?
  1. list out all the function list first. because we still need to know the functions first, then can decide which function should be tested.
  2. if the spec said that no functions should respons slower than 3 seconds, then we need to test each function in specific environment. like given server environment, netwlork environment and 
  3. list out which functions are possiblly be used by a lot of people together, like the login function, the regester function.
  4. 听在national bank(20万员工)做过内部员工使用的系统的性能测试的人说,一般用1%的比例模拟,即2~3k的同步并发量。
-- Sam 06:44 16/07/2014
 QTP question
  1. how to record use firefox?
  2. why performance test start from mid of system test?
  3. how to record under win7?
  4. how to split actions?
  5. how to add check point? why it's better to use globle sheet as test report?
  6. how to run script up with shell? why it's useful?
  7. how to know the RO propertys that a controller has?
  8. 每个插件分别有什么用?
  9. why should install QTP in vm? beause it will expire in 30days, and it will make the current java applications can not start up.
  10. 一个中型项目会有多少脚本?一千多
  11. 当运行一个action时可以跟多个参数,这些参数会被变成action的parameter,问题是,系统如何知道那个参数对应哪个action的parameter呢 (I guess it's on order, the first one is the parameter)
  12. 实际工作中,所有的action都放在一个test中吗?那不是会有成百上千个挤在QTP左侧的树控件中吗?QTP会有性能问题吗?如果真这样的话,一般用什么规则命名呢?(实际上是没个testcase写成一个Test,里面只有一个或少数几个action,然后用一个maincontroltest来动态装载这些Test。
  13. 实际工作中,如果每个function module设计为一个test的话,那么像login这样的都需要用到的action如何设置成共有,从而让其他Test都能调用到?
    1. 第一步,在创建action时,可以将其设置成public。

  14. 实际工作中,听说经常用VBS来运行测试计划,那么VBS做什么具体活呢?是把各个Test中的globle表中的某个testPlan的runcolumn值设为yes吗?(不用VBS)
  15. Don't we need to declare every variable? (no, not necessary, but it's a good habit to use dim to define the variable first.
  16.  where can I download a qtp? (we've downloaded in acer machine)
  17. why can not add debug point in QTP ? (because didn't install "debug viewer" or  because  didn't restart after installing the debug veiwer)
  18. Don't we need to declare every variable? (no, not necessary, but it's a good habit to use dim to define the variable first.
  19.  where can I download a qtp? (we've downloaded in acer machine)
  20. why can not add debug point in QTP ? (because didn't install "debug viewer" or  because  didn't restart after installing the debug veiwer)
-- Sam 19:28 04/09/2014

Please click here to login and add comments! || automatically refresh content every seconds