专注于自动化测试的培训、自动化测试解决方案、兼职自动化测试项目,欢迎志同道合的朋友一起合作共赢未来!电子信箱:yang-zhengjiang@163.com

发布新日志

  • 基于Selenium的自动化测试框架 - SeLion学习之一(基本介绍)

    2015-05-31 11:34:14

    SeLion是一个基于Selenium的自动化测试框架,是Selenium下的一款非常优秀的框架结构,但是资料非常少,在国内使用的也就相对较少,本人会用一系列的文章,比较详细的介绍该框架结构,希望能给广大的自动化测试爱好者提供一个实现思路,如果对该本人文章感兴趣或者有什么问题,欢迎留言,我会尽量回答,也欢迎转载该系列文章。该文章是本系列第一节,SeLion的基本介绍,先让大家对SeLion有一个基本的认识。

    一:SeLion是什么?SeLion是基于Selenium的一款开源测试框架,是对Selenium的扩展和增强,该框架是ebay旗下paypal公司开发的自动化测试框架,该框架主要对Selenium的增强包括一下几个方面:

      1)自动截图功能,在测试过程中自动截图并写入到log中,对于有滚动条的网页能截取全屏。

      2)自动生成的report功能,Selenium本身没有写log的功能,即使使用testNg/ReportNg的report也不是很理想。

      3)自动等待功能。selenium中提供了多重等待的方式,我们也可以自己去封装,而在SeLion只需要简单的条用一个方法即可以实现。

      4)对常见的web对象进行了统一的封装,例如webtable,我们只需要简单的调用其中的方法即可以实现测试,当然我们也可以自己去实现。

      5)对于数据驱动提供了多中方式,excel/YAML/XML/JSON 我们只需要根据需求简单调用即可,该数据驱动基于testNg。

      6)实现了对pageobject开发模式中的页面元素和定位策略写到YAML配置文件进行分离,并可以根据该文件自动化生成该代码。

      7)增加了Selenium的grid功能,自动注册和释放node,增加长时间运行的稳定性。

      8)SeLion中同时集成了移动测试Android/IOS,这样能统一管理web测试和移动系统的测试

    以上是我自己总结的,认为SeLion中比较实用的一些功能,后面的文章中,我会针对每一个方面进行详细的讲解。

    二;SeLion的测试结构图。

      SeLion框架实际上是Selenim WebDriver + testNg + Maven + ios-driver/Selendroid/Appium的一个合集,结构图如下:

       
      在该图中集成当前最流行和使用的开源工具,包括代码管理工具git,编译工具Maven,持续集成CI工具Jenkins 再加上现有的Selion框架,上图可以看成是一个持续集成测试的自动化测试平台。如果大家有需求的话,我会详细简介该平台的搭建和应用过程,关于SeLion的基本介绍就到这了,希望大家能对该平台有一个整体的认识和了解,欢迎继续关注后面的文章。

    本系列文章 我会同步在博客园发布,欢迎大家关注。

  • 自动化测试培训-提供自动化测试解决方案-**自动化项目

    2015-03-03 22:04:18

    本人长期从事自动化测试工作,包括功能自动化、性能自动化、接口自动化以及移动系统的自动化测试等,由于移动系统的迅速崛起,移动系统的自动化测试也变得炙手可热,主要是IOS和Android两大平台的测试,本博客会陆续更新一些移动测试方面相关的自动化测试技术,供大家一起讨论和学习,欢迎持续关注!本人会以开源工具为主,商业工具有详细的技术支持不进行讨论,先剧透下准备讨论的开源工具1. 基于苹果官方的Instrument对iOS系统对自动化测试2. 基于eBay公司的iOS-driver/selendroid的自动化测试3. 基于Appium开源工具移动平台的自动化测试技术------华丽的分割线---------------------本人从事以下三方面的业务,欢迎有需要的朋友发送邮件到yang-zhengjiang@163或者加我微信号yang-zhengjiang进行ℹ️合作。1.自动化测试培训,培训的方向主要有以下几个方面:  a. 功能自动化测试包括QTP和selenium  b. 移动平台(IOS/Android)的自动化测试包括Appium     和ios-driver/selendroid等  c. 接口自动化测试包括soapUI  d. 性能自动化测试包括loadRunner和JMeter  本人在北京,如果北京的朋友可以当面授课,外地的朋友可以通过网络教学,您可以根据你自己的需求选择学习和自由搭配组合,所有教学全部以工作中的项目实战教学,只要你想学习自动化保证您学会,当然您可以选择试学,价格绝对优惠,学习不满意,退还您全部学费,详细的培训课程我会在近期详细说明。2. 自动化测试解决方案,包括以下方面:   a. 针对被测试系统提供详细实施方案   b. 组建自动化测试团队,人员配置   c. 自动化测试框架测试平台的开发3. **各类自动化测试项目的开发和实施欢迎有需要的朋友通过以上方式咨询联系,同时也欢迎志同道合的朋友加入我的团队,共创未来。
  • 北京外企招聘测试开发职位(内部推荐)

    2015-03-03 21:39:13

    招聘职位:1. 高级自动化测试工程师2. iOS/Android中高级开发工程师3. WEB端JAVA中高级开发工程师工作地点为北京,公司为做保险业务,由于是外企有到国外学习和出差到机会多,对上述职位感兴趣对人可以发送简历到yang-zhengjiang@163.com 内部推荐。
  • 关于测试的一点感想

    2009-05-15 14:32:43

      最近一段时间事情比较多,都忘记去思考了,项目暂时停下来了,突然有点感想,对于一个大型的长期的项目如何做测试才能更好的保证产品的质量?关于这个问题,我想应该不通的人有自己的想法,在这,我仅仅是表达一下自己的看法。
      做好测试首先要从整体上对软件结构有个很好的认识,其次当然是对细节的地方要有足够的认识,要做到这一点,使用流程图和功能列表是个很不错的选择。先以功能块为单位画出每个功能块的功能图,在把这些功能块按照流程关系组合成一个整体的软件结构图,在做这个图的过程中,我们便可以很好的认识到整个软件的架构,从功能上合技术上做到心中有数,接下来,我们可以对照这个整体的流程图,对性的做出功能列表,分别对应到每一个功能点上去,这样我们就准确的把握了每一个功能点,细节的地方做到轻车熟路,在做测试的时候,我们就可以对照这个功能列表区一一测试,并在出现bug多的地方重点去标记,这样经过一段时间的测试后,整个测试过程我们就已经非常的熟悉了,无形中在头脑中形成了测试路线,并知道了重点需要去测试的地方,再进一步,如果我们再做的深的话,完全可以把功能对应到相应的实现代码中,找到与之对应的实现函数,这样的话,我们就可以准确的定位到bug,大大的提高了测试效率。
      当然做这些是需要一个过程的,我们可以朝着这个方向逐步去实现,在实现这个过程中,不仅大大提高了查找bug的准确性,同时在软件的整体架构和代码级别的测试上,我们都将得到锻炼。更重要的是,如果你能把bug准确的定位到代码中去,这样无疑是大大增加了我们自己的身价。
  • 关于qtp的测试对象的进一步改进

    2009-04-19 14:05:20

    这次是在上次写的文章“关于qtp的测试对象”,地址:http://www.51testing.com/index.php?uid-174344-action-viewspace-itemid-113944 的基础上的进一步讨论,这里的改进主要是针对完全的手动开发qtp自动化测试脚本而言的,对于录制后简单的修改并不使用。在功能的自动化测试中,测试对象是基础,为了提高测试对象的高度可复用性以及便于日后的升级和维护,我们应该使用尽量少的属性去标示出这个对象,例如:创建一个JavaWindow对象

    set win = description.Create

    win("class description").value = "window"

    这样就足可以来表示出给对象了,但是当有多个JavaWindow对象对象同时存在时,这样创建时明显有问题的,这时我们就不得不再去增加一个title来识别出每一个不同的JavaWindow对象了,但是如果我们直接把title属性写入到代码中,这样在升级版本或客户要就修改标题后,我们就不得不去相应的到我们的代码中去修改这个标题,在一个大型的项目中会有很多地方需要去修改,这样既不容易该全,也很麻烦。解决办法:

    我们都知道,在软件开发中,界面上显示的文字,都是属于软件的资源而已,是不会写入到代码中去的,而是配置中软件的资源文件中而已,那在我们开发测试脚本的时候,同样这些具体的用于识别集体对象的属性不过也是属于一种资源而已,我们同样可以把这样资源写到我们的资源文件中去配置,这样当修改修改时,我们同样只需要去维护一份或几份资源文件而已,而不需要去到代码中去修改,这样大大增加了我们代码的可维护性。写一个简单的例子程序,来说明这个问题:

    get the JavaWindow object

    function getWindowByTitle(title)

       set win = description.Create

       win("class description").value = "window"

       win("title").value = title

       set getWindowByTitle = win

    end function

    *********************************************

    test.txt --this is the configure file

    #the login dialog

    TITLE="backup express 3.1"

    *********************************************

    this function get the value by name

    Function getText(name)

     Dim fso,cPath,f
     
     cPath = "E:\javaGui.txt" 
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set f = fso.OpenTextFile(cPath,1,False)
     
     Do While Not f.AtEndOfStream
     
      str = f.ReadLine()
      If Not InStr(str,"#") > 0 Then
      
       tmpArr = Split(str,"=",-1,1)
       If StrComp(tmpArr(0),name) = 0 Then
        getText = tmpArr(1)
        Exit Do
       End If
      End If 
     Loop
     
     Set f = Nothing
     Set fso = Nothing

    End Function

    *******************************************

    qtp script. code

    JavaWindow(getWindowByTitle(getText(TITLE))

    这里只是一个简单demo,在实际使用中我们可以按照这种思路去开发自己的测试脚本。

    以上仅是我自己的一点想法,欢迎大家讨论。

  • The different of run and exec method

    2009-04-07 13:05:16

    the run and exec method are very important method, I found a good article to introduce the two method, so I decided to share it, I hope this will help you if you need it, the detail as follows:
    The fact that there are two ways to run programs from a script. leads to an obvious question: which method should you use in your scripts? The answer to that
    question depends on the script. and what it needs to accomplish.
    script. can use either the Run method or the Exec method to run a program in a
    manner similar to using the Run dialog box from the Start menu. Regardless of the
    method used, the program starts, and runs in a new process.
    However, when you use the Run method, your script. will not have access to the
    standard input, output, and error streams generated by the program being run. A
    script. cannot use the Run method to run a command-line tool and retrieve its
    output.
    For example, suppose you want to run Ping.exe and then examine the output to
    see whether the computer could be successfully contacted. This cannot be done
    using the Run command. Instead, you would need to ping the computer, save the
    results of the ping command to a text file, open the text file, read the results, and
    then parse those results to determine the success or failure of the command.
    The following script. uses the Run method to call Ping.exe, redirecting the output
    to a temporary file. The script. opens and reads the text file, checks to see whether
    the command succeeded (by determining whether any of the lines of output begin
    with the word Reply), and then closes and deletes the temporary file:

    Option Explicit
    Dim oShell, oFSO, oTextFile
    Dim sTempName, sText
    Dim sComputer : sComputer = "62.241.53.16"
    '--- Creating a shell object
    Set Shell = CreateObject("WScript.Shell")
    Set FSO = CreateObject("Scripting.FileSystemObject")
    sTempName = oFSO.GetTempName
    oShell.Run "%comspec% /c ping -n 3 -w 1000 " & sComputer & " > " & sTempName, 0, True
    '--- Reading from output file
    Set TextFile = oFSO.OpenTextFile(sTempName, 1)
    Do While oTextFile.AtEndOfStream <> True
    sText = oTextFile.ReadLine
    If Instr(sText, "Reply") > 0 Then
    MsgBox "Reply received."
    Exit Do
    End If
    Loop
    '--- Closing and deleting temporary file
    oTextFile.Close : oFSO.DeleteFile(sTempName)
    '--- Cleaning used objects
    Set TextFile = Nothing : Set FSO = Nothing
    Set Shell = Nothing

    Although this approach works, it is somewhat complicated. If you need access to
    command-line output, you should use the Exec method instead. The following
    script. also parses the output generated by Ping.exe. However, it does so by using
    the Exec method and by directly reading the output. There is no need to create,
    open, read, and delete a temporary file, and the script. is only 9 lines long,
    compared with the 15 lines required to perform. this same task using the Run
    method:

    Option explicit
    Dim oShell, oExec
    Dim sText
    Dim sComputer : sComputer = "62.241.53.16"
    '--- Creating a shell object
    Set Shell = CreateObject("WScript.Shell")
    Set Exec = oShell.Exec("cmd /c ping -n 3 -w 1000 " & sComputer)
    '--- Reading from output stream
    Do While Not oExec.StdOut.AtEndOfStream
    sText = oExec.StdOut.ReadLine()
    If Instr(sText, "Reply") > 0 Then
    MsgBox "Reply received."
    Exit Do
    End If
    Loop
    '--- Cleaning used objects
    Set Shell = Nothing

    In many respects, this makes the Exec method a better choice than the Run
    method. However, the Run method is still useful in a number of situations:
    You might want to run the application in a specified window type, such as a
    minimized window. Exec offers no control over window style; Run offers
    Chapter 09 Scripting Quicktest Professional Page 43
    Dani Vainstein Windows Script. Host Page 43 of 73
    more options.
    You might need to run a script. on computers that do not have WSH 5.6
    installed. Exec is supported only on WSH 5.6.
    You might want to wait for the application being called to finish running
    before the script. resumes. This can be done with either Run or Exec but
    requires less coding with Run.
  • 浅谈QTP中的测试对象

    2009-03-31 15:11:13

    在功能的自动化测试中QTP被人们广泛的使用着,关于使用qtp自身的对象仓库的方法来管理测试对象的方式,本人认为存在着很大的局限性,在这里介绍一种通过函数的方式来管理和使用测试对象的方法,该方法的思想是基于利用函数来实现的,把要测试的每一类对象通过一个或几个公用的函数来实现,下面通过具体的code来说明,先建立一个TestObject.qfl的文件,用来模拟对象仓库的功能。

    Function getWindow

        Set win = description.Create
        win("class description").value = "window"

        Set getWindow = win

    End Function

    Function getWindowByTitle(title)

        Set win = description.Create
        win("class description").value = "window"
        win("title").value = title

        Set getWindowByTitle = win

    End Function

    Function getDialog

        Set dia = description.Create
        dia("class description").value = "window"

        Set getDialog = dia

    End Function

    Function getDialogByTitle(title)

        Set dia = description.Create
        dia("class description").value = "window"
        dia("title").value = title

        Set getDialogByTitle = dia

    End Function

    Function getEdit

        Set edt = description.Create
        edt("class description").value = "edit"

        Set getEdit = edt

    End Function

    Function getEditByText(text)

        Set edt = description.Create
        edt("class description").value = "edit"
        edt("attached text").value = text

        Set getEditByText = edt

    End Function

    Function getEditByIndex(index)

        Set edt = description.Create
        edt("class description").value = "edit"
        edt("index").value = index

        Set getEditByIndex = edt

    End Function

    Function getButton

        Set btn = description.Create
        btn("class description").value = "push_button"

        Set getButton = btn

    End Function

    Function getButtonByText(text)

        Set btn = description.Create
        btn("class description").value = "push_button"
        btn("attached text").value = text

        Set getButtonByText = btn

    End Function

    我们通过以上这种方式,可以把我们测试项目中用到的所有的测试对象加入到这个“对象仓库”中来,在使用的时候,只需要调用相应的函数即可实现,如下面的coad所示。

    SystemUtil.Run "fileName","","filePath"

    If JavaWindow(getWindow).JavaDialog(getDialog).Exist(30) Then

        With JavaWindow(getWindow).JavaDialog(getDialog)

            .JavaEdit(getEditByText("User Name")).Set "userName"
            .JavaEdit(getEditByText("Password")).Set "userPwd"
            .JavaButton(getButtonByText("Ok")).Click
        End with
    Else
        Reporter.ReportEvent micFail,"lauch error","launch error, please check the application!"
        ExitTest
    End If


    通过这种方式实现了测试对象的过度复用,更符合自动化测试的思想,在项目的测试过程中,我们只要不断的加入新类型的测试对象即可,关键是这些测试对象基本不需要怎么维护,便可以很好的进行复用,这些对象不仅仅在一个项目中可以使用,只要是同一类型的项目,我们都可以来使用这些对象,而不需要随着不同的项目我们还要去重复的去维护一个个的对象仓库了。这样大大的提高了我们的测试效率,也便于多人集体合作。



Open Toolbar