日历

« 2008-11-23  
      1
2345678
9101112131415
16171819202122
23242526272829
30      

统计信息

  • 访问量: 151
  • 日志数: 6
  • 建立时间: 2008-08-09
  • 更新时间: 2008-08-09

RSS订阅

关注质量与体验——电子商务与自动化测试

我的最新日志

  • How to test UrlRewrite

    2008-8-09

    目前很多网站使用了Url重写的技术,好处可以使URL变短,最主要的就是静态页面,有利于SEO,方便搜索引擎抓取,典型的例子就是我们公司的网站http://www.chiefvalue.com/,后缀都从Aspx重写成CV了,这个后缀就个性化了,同时能起一个宣传的作用。

    image

    在这里就不介绍UrlRewrite的实现了,园子里有很多文章,其中老赵的系列介绍得最详细,相关文章如下:

    重提URL Rewrite(1):IIS与ASP.NET

    重提URL Rewrite(2):使用已有组件进行URL Rewrite

    重提URL Rewrite(3):在URL Rewrite后保持PostBack地址

    重提URL Rewrite(4):不同级别URL Rewrite的一些细节与特点

    我们网站的实现方式和老赵文中提到的类似,生成Dll文件后加入IIS中,

    image

    同时在Documents中添加新的后缀配置

    image

    添加完成后,必须检查这个Dll是否可用,也就是Status是否在运行状态,由于我们是用C++写的,在一台服务器上部署时怎么也不能运行起来,包括安装了C++ Runtime,最后使用最傻的办法,把Dll文件放到Microsoft.net文件夹下才运行起来。这个是一个注意点。

    image

    配置好后,接下来就是测试是否把网站上所有的页面都重写成功了,由于UrlRewrite里是自定义了规则,同时使用正则表达式来转换指定的参数,比如?可以转换为_-_,=转换为--,但是网站带参数的页面至少也是几万,甚至几百万个,不可能所有URL都满足规则,因此需要进行一番测试,具体步骤如下:

    1、前面提到Web上有几万几十万的页面,如果一个个测试手工肯定是不行的,时间上就不允许,那么如何减少操作呢,首先必须做一个列表,那就是列出所有后缀为aspx的页面,这个是有一定数量的,大概最多也就几百个,可以列出后保存在Excel中,首先检查这些页面是否重写成功,即使手工测试也能做到,当然推荐使用自动化测试。

    2、对整个网站进行链接测试,这里推荐以前提到的工具Xenu Link Sleuth,具体使用见链接测试工具小汇一文,通过返回的状态再次检查Cancel或Timeout的页面。

    3、第二步做完后并不是万无一失了,因为还有遗漏的死角,例如,某个页面是通过点击Button弹出的,某个页面的文字描述中带有链接,这些需要专门处理,可能是正则表达式无法检测到的。

    4、到这里,基本上就可以完成使用UrlRewrite后的测试,当然如果大家有其他的经验希望能分享一下。

    虽然这个项目在06年就上线了,写得有点迟,但还是希望对有UrlRewrite测试需要的人提供一些参考。



    [新闻]Cuil冲着Google开站又被撞稀巴烂,搜寻引擎的机会难道只有搜寻?

    Link URL: http://www.cnblogs.com/oscarxie/archive/2008/05/20/1203334.html
  • How to test web load balance

    2008-8-09

    现在大部分网站都有使用负载均衡的技术,这样可以提高网站的稳定性和访问量的分流,加快访问速度。下图是一个演化的过程,从单台Server到多台Server:

    image

    负载均衡技术的介绍,网上有很多,这里引用一段:

    由于网络的数据流量多集中在中心服务器一端,所以现在所说的负载均衡,多指的是对访问服务器的负载进行均衡(或者说分担)措施。负载均衡,从结构上分为本地负载均衡和地域负载均衡(全局负载均衡),前一种是指对本地的服务器集群做负载均衡,后一种是指对分别放置在不同的地理位置、在不同的网络及服务器群集之间作负载均衡。

    每个主机运行一个所需服务器程序的独立拷贝,诸如Web、FTP、Telnet或e-mail服务器程序。对于某些服务(如运行在Web服务器上的那些服务)而言,程序的一个拷贝运行在群集内所有的主机上,而网络负载均衡则将工作负载在这些主机间进行分配。对于其他服务(例如e-mail),只有一台主机处理工作负载,针对这些服务,网络负载均衡允许网络通讯量流到一个主机上,并在该主机发生故障时将通讯量移至其他主机。

    其他参考:网络负载均衡技术概况

    现在对于大型的商务网站,都会购买负载均衡器来完成硬件的负载均衡,比如使用DNS,代理服务器等,但是对于测试环境由于条件和成本的限制,往往无法使用硬件,一般是使用双网卡,同时安装Network load banlancing协议,使用软件的方式来实现负载均衡,之后在属性中分配指定的IP地址,如下图:

    image

    image

    image

    image

    在Host Parameters里面可以指向同一个Host,比如xxx.domain.com,这样,部署了多台的服务器都可以同时使用一个Host访问。这里以2台机器为例,一般最少需要4个IP地址,每台2个,一个IP给内部使用,一个是给外部查看。

    下面就介绍下如何测试Web的负载均衡,这里平台以Windows为例(Linux其他的实在不熟),同时Web是部署在IIS中,有2台Server组合做负载均衡,Web是Asp.net 开发的,当然Web不仅仅是以前提到的Website,同样也适用目前比较流行的WebApplication。

    其实步骤很简单:

    1、首先两台Server都启动

    2、需要开发一个页面,比如是test.aspx,用来显示此时访问的Web是使用哪台Server,也就是显示Server的外部IP地址,类似下图:

    image

    3、注意,访问Web的时候都是用Host的那个URL来访问,例如我的博客oscarxie.cnbologs.com,而不使用IP

    4、输入Host/test.aspx不断访问Web,因为这时候你所访问的Server是随机分配的,以看到2个不同的IP为准,例如2个IP为:192.168.0.1,192.168.0.2,这2个IP都能访问到即可

    5、再次访问Web,并获得此时是在哪台Server上,比如为192.168.0.1,这时关闭192.168.0.1这台Server或停止这台Server的IIS,这时继续访问Web,确保不出现异常,同时访问test页面,看是不是Server切换到192.168.0.2上,这样通过负载均衡,做到了平滑的切换。(这个过程手工或自动化都可以)

    当然如果Web使用了Session,这个时候还需要做程序的处理,比如Session需要在2台Server都要存在,Session的存储,是在State Service还是在DB中不属于讨论的范围了,博客园中很多牛人肯定介绍过,不在此班门弄斧了。

    通过负载均衡还有一个好处就是当Web在真实环境时,新的项目上线部署可以不必停掉Web,可以逐台关闭Server进行部署,不影响Web的正常使用,只要保证还有一台Server在运行就可以了。



    [新闻]Cuil冲着Google开站又被撞稀巴烂,搜寻引擎的机会难道只有搜寻?

    Link URL: http://www.cnblogs.com/oscarxie/archive/2008/05/20/1203157.html
  • [ZZ]WatiN & Selenium RC-自动化测试工具比较

    2008-8-09

  • [ZZ]Gallio .NET测试自动化平台

    2008-8-09

    Gallio .NET测试自动化平台

    作者 Al Tenhundfeld译者 张逸 发布于 2008年7月6日 上午1时6分

    社区
    .NET
    主题
    单元测试
    标签
    PowerShell,
    MbUnit,
    NUnit,
    MSTest,
    MSBuild,
    质量
    Gallio自动化平台发布了更新的alpha版。Gallio是一个针对.NET测试框架的自动化平台:
    Gallio自动化平台是一个针对.NET的开放的、可扩展的中立系统,提供了一个公用对象模型、运行时服务和工具(例如测试运行器),从而可被众多测试框架所利用。
    Gallio主要是由MbUnit测试框架的同一支团队开发。当MbUnit的开发者认识到构建一个新的.NET测试框架所需要的大量时间主要是消耗在编写支持工具和服务的时候,他们就开始了对Gallio项目的开发。在功能基本相同的情况下,为每个框架提供定制的APIs和工具就显得毫无必要了。Gallio正是通过提供一个其他框架均能够构建的测试自动化平台,来解决这种重复性劳动。

    尽管还处于开发的早期阶段,对于.NET软件社区而言,Gallio仍然具有两大潜在的优势。对于那些希望编写一个新的测试框架的人员而言,门槛降低了。如果Gallio能够满足可扩展性目标,测试框架的开发人员就能够将更多精力投入到对新的测试模式和测试方法的创新上。通过编写一个Gallio适配器插件,新的测试框架就可以从Gallio的自动化服务和工具中获益。对于那些想要使用多个测试框架来测试他们代码库的人员而言,Gallio能够提供一个单独的集成和自动化点。如果一个开发团队需要使用MbUnit对数据访问层的测试,以及对表示层的MSTest,Gallio测试运行器GUI能够运行所有的测试集,而Gallio CruiseControl.NET任务则能够将所有的测试集作为持续集成过程的一部分而执行。

    随着Alpha 3的第三次更新,Gallio能够运行来自于MbUnit、MSTestNBehaveNUnitxUnit.Net的测试。据文档介绍,Gallio集成了CCNet, MSBuild, NAnt, NCover, Pex, Powershell, Resharper, TestDriven.Net, TypeMockVisual Studio Team System

    查看英文原文:Gallio .NET Test Automation Platform

    PS:
    Gallio的官方网站:
    http://www.gallio.org/



    [新闻]Microsoft Office文件翻译集成Live Translator

    Link URL: http://www.cnblogs.com/oscarxie/archive/2008/07/10/1240298.html
  • Use Python to Drive Selenium RC

    2008-8-09

    Selenium RC支持多种编程语言驱动客户端浏览器,这里主要介绍使用Python在Windows下驱动Selenium RC。Python是一种面向对象的解释性的计算机程序设计语言。

    1、准备工作:

    下载Java:目前是1.6 update7,下载地址:http://www.java.com/zh_CN/

    下载Python:目前稳定版本为2.5.2,下载地址:http://www.python.org/download/,Python的相关信息参见:http://www.python.org/

    下载Selenium RC:目前是1.0 Beta1版本,下载地址:http://selenium-rc.openqa.org/download.html,Selenium RC相关信息参见:http://selenium-rc.openqa.org/

    2、开始运行

    • 首先启动Selenium Server,把下载的Selenium RC解压后,会有一个selenium-server-1.0-beta-1的文件夹,就是Selenium Server的存放目录,通过命令行Java -jar selenium-server.jar来启动Selenium Server端的服务,

    • 以在Google上搜索Hello World为例,Python的脚本如下:

    "*firefox"是指支持的浏览器或是通过Selenium RC调用的浏览器,Selenium支持以下的浏览器类型,

    Supported browsers include:
    *iexplore
    *konqueror
    *firefox
    *mock
    *pifirefox
    *piiexplore
    *chrome
    *safari
    *opera
    *iehta
    *custom

    在这里,仅使用*iexplore或*firefox则表示浏览器安装在默认的路径,即IE安装在"C:\Program Files\Internet Explorer\iexplore.exe",Firefox安装在"C:\Program Files\Mozilla Firefox\firefox.exe"。如果不是安装在默认的路径,需要指明浏览器安装的地址,如:"*firefox D:\Program Files\Mozilla Firefox\\firefox.exe"。

    "def tearDown(self):
       self.selenium.stop()"

    这段表示浏览器运行结束后直接关闭浏览器,这里可以注释掉。

    • 首先,使用IE为浏览器运行一次,代码如下:

     点击Python IDE上的Run菜单下拉中的Run Module或是快捷键F5,开始运行Python代码。通过Selenium直接调用IE浏览器进行客户端运行。

    同时命令行窗口显示Selenium Server进行的每个步骤操作

     

    • 接下来使用Firefox作为浏览器进行访问

    修改代码,*iexplore"修改为"*custom D:\Program Files\Mozilla Firefox\\firefox.exe",因为我电脑上的Firefox为3.0版本,目前Selenium RC不支持此版本,不管是使用"*chrome"还是"*firefox",都无法把Firefox调出;但是如果你机器上使用的Firefox是低于3.0版本,那么可以直接使用"*chrome"这个参数。

    在运行之前,需要将Firefox中的代理设置成和Selenium Server一致,Localhost,端口为4444。

     

    对于其他的浏览器只需要相应的修改参数为如*safari或*opera等,就能调用访问,实现一个多浏览器的兼容性测试。

    其他相关文章:

    Running Selenium in Python Driven Mode

    http://agiletesting.blogspot.com/2006/01/running-s...

    Web app testing with Python part 1: MaxQ

    http://agiletesting.blogspot.com/2005/02/web-app-testing-with-python-part-1.html

    Web app testing with Python part 2: Selenium and Twisted

    http://agiletesting.blogspot.com/2005/03/web-app-testing-with-python-part-2.html

    OscarXie.net

    关注质量与体验——电子商务与自动化测试
    http://www.cnblogs.com/oscarxie/

  • Selenium——开源的自动化测试框架

    2008-8-09

    Selenium是一个很好的多平台多浏览器的自动化测试框架,Selenium提供了2种运行模式——Core和Remote Control(RC),除此之外,ThoughtWorks还为Selenium提供了Firefox的Add-on——Selenium IDE以及RC模式的扩展Selenium Grid。现在的版本为Selenium 1.0 beta-1 released (March 5, 2008)

    支持的平台和浏览器:

    Supported Platforms:

    • Windows:
      • Internet Explorer 6.0 and 7.0
      • Firefox 0.8 to 2.0
      • Mozilla Suite 1.6+, 1.7+
      • Seamonkey 1.0
      • Opera 8 & 9
      • Mac OS X:
        • Safari 2.0.4+
        • Firefox 0.8 to 2.0
        • Camino 1.0a1
        • Mozilla Suite 1.6+, 1.7+
        • Seamonkey 1.0
        Not yet supported: OmniWeb
        • Linux:
          • Firefox 0.8 to 2.0
          • Mozilla Suite 1.6+, 1.7+
          • Konqueror
          • Opera 8 & 9

        Selenium is a test tool for web applications. Selenium tests run directly in a browser, just like real users do. It runs in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh, Safari on the Mac.  We have plans to target Safari on the iPhone in some months. 

        具体信息可以参见Selenium首页,http://selenium.openqa.org/

        1、Selenium Corehttp://selenium-core.openqa.org/

        Core模式一般是通过编写HTML后加载到要测试的Web程序中

        Core mode: The Javascrīpt core library and the tests in question are loaded into your webapp. It is a simpler form of Selenium, and suitable for non-developers, but it has some inherent limitations. Below is a simplified representation of the architecture.

        Your tests scrīpts (written in HTML) and the Selenium Test Runner itself are uploaded to the same web server that hosts the application you are trying to test.  That suggests that you know how to deploy to that web server (or know someone who does).
        You open a browser at a URL that will kick off the tests, and watch them run by.
        Selenium Core works on muliple browsers - more than the three shown on the left.

        2、Selenium RChttp://selenium-rc.openqa.org/

        The Remote Control mode is more advanced. It is able to test a wider range of web-applications than Selenium-Core and is more scalable, but requires some technical knowledge to set up.  Below is a simplified architectural representation of it ..

        RC模式可以通过多种编程语言支持驱动客户端浏览器,

      • - Java
      • - .NET
      • - Perl
      • - PHP
      • - Python
      • - ruby
      • - Selenese
      • - Javascrīpt

        最主要的是还能支持AJAX应用程序(The Selenium Server is great for testing complex AJAX-based web user interfaces under a Continuous Integration system. It is also an ideal solution for users of Selenium Core or Selenium IDE who want to write tests in a more expressive programming language than the Selenese HTML table format customarily used with Selenium Core.)

        Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream Javascrīpt-enabled browser.

        Selenium RC comes in two parts. 

        1. A server which can automatically launch and kill supported browsers, and acts as a HTTP proxy for web requests from those browsers.
        2. Client libraries for your favorite computer language.

        3、Selenium Gridhttp://selenium-grid.openqa.org/

        Selenium Grid is a tool that dramatically speeds up functional testing of web-apps by leveraging your existing computing infrastructure. It allows you to easily run multiple tests in parallel, on multiple machines, in an heterogeneous enviroment. 

        This additional server piece allows the several Remote Control servers to accessed in parallel by one or more driving processes.  You may want to do this if you want to use scale to speed everything up, or because you need to test on Mac and/or Linux, as well as Windows from one driving test-suite.

        Based on the excellent Selenium web testing tool, Selenium Grid allows you to run multiple instances of Selenium Remote Control in parallel. Even better, it makes all these Selenium Remote Controls appear as a single one, so your tests do not have to worry about the actual infrastructure. Selenium Grid cuts down on the time required to run a Selenium test suite to a fraction of the time that a single instance of Selenium instance would take to run.

        Of course, you get to choose which language you develop your tests in: Ruby, Java, Python, C#, PHP, ...

        4、Selenium IDEhttp://selenium-ide.openqa.org/

        Selenium IDE is an integrated development environment for Selenium tests. It is implemented as a Firefox extension, and allows you to record, edit, and debug tests. Selenium IDE includes the entire Selenium Core, allowing you to easily and quickly record and play back tests in the actual environment that they will run.

        Selenium IDE is not only recording tool: it is a complete IDE. You can choose to use its recording capability, or you may edit your scrīpts by hand. With autocomplete support and the ability to move commands around quickly, Selenium IDE is the ideal environment for creating Selenium tests no matter what style of tests you prefer.

        Features:

        • Easy record and playback
        • Intelligent field selection will use IDs, names, or XPath as needed
        • Autocomplete for all common Selenium commands
        • Walk through tests
        • Debug and set breakpoints
        • Save tests as HTML, Ruby scrīpts, or any other format
        • Support for Selenium user-extensions.js file
        • Option to automatically assert the title of every page

        This Firefox plugin allows you to record and playback tests in the browser.  Here is a screen shot of it in use (in the side-bar of Firefox):

        目前Selenium IDE有了支持Firefox 3.0的版本,

        Version 1.0 Beta 2

        http://selenium-ide.openqa.org/download.jsp

        5、ThoughtWorks

        Selenium是由ThoughtWorks团队开发的开源自动化测试框架,http://www.thoughtworks.com.cn/,ThoughtWorks是一个全球IT咨询公司。交付客户定制应用软件,提供注重实效的咨询服务,为企业开发软件,帮助企业敏捷开发。

        Selenium was developed by team of developers and testers at ThoughtWorks. It is open-source software and can be downloaded and used without charge. It is currently under active development developers from multiple companies. See who made Selenium for more details.
        ThoughtWorks is a leader in Agile development methods for enterprise software development. Selenium is designed specifically for the acceptance testing requirements of Agile teams. However, teams using more traditional development will also find it useful.

      OscarXie.net

      关注质量与体验——电子商务与自动化测试
      http://www.cnblogs.com/oscarxie/

      Open Toolbar