因为热爱所以不觉的辛苦,因为发现缺陷所以变的快乐!

发布新日志

  • 用正交试验法设计测试用例实例

    2009-02-28 17:48:22

    问题来源:http://bbs.51testing.com/thread-135864-1-4.html

    问题描述:

    一个搜索功能:现在一共有五个独立变量,A B C D E ,其中A C E 都有 3 个取值,B 5 个取值 D 6 个取值。外加模糊搜索的输入框。请问如何设计测试用例。小弟实在是想不出来~困惑了2天了~请高人帮忙解决下。

    附件中为我用正交试验法设计的测试用例.

    相关学习资料

    http://www.51testing.com/index.php?uid-7139-action-viewspace-itemid-109235

  • 去阿里面试了等结果中后续

    2009-02-27 21:20:50

           最近因为“去阿里面试了等结果中”这篇文章,博客的访问量一下子大了很多。感觉占光了。有些朋友来访问主要还是想知道笔试或面试的题目。
       具体题目是不好透露的,虽然我都还记得。笔试中必答的第一部分都很简单。比较基础有过一年以上测试经验并天天看51testing的人都不会有问题。
    自动化我做了一部分。前面几题还可以,挺基础的。后面的确没用到过,只能凭感觉了。性能与sqa我没做。整体感觉试卷设计的还是比较好的,都比较基础但面比较广。
    我想试卷的设计毕竟不是想难住你。而是想了解你的知识面。
       面试也还可以,让我觉的最难的是“你工作中碰到最难测的业务?”这种问题网上常看到,阿里好像招销售也都问此类问题。一时还真比较难回答。我虽然说了,但没说清楚。
       我目前是以外包的形式在阿里工作。写下来是希望对期待着的人有所帮助。
       努力学习,总会有所突破!加油!
       最近常想到一句话:人有多大胆,地有多大产!呵呵!

  • 去阿里面试了等结果中

    2009-02-19 19:04:49

       2月17日去阿里巴巴面试了。我应聘的是测试工程师。

      上午十点开始笔试。花了一个半小时做完了试卷。接下去两位工作人员给我面试。聊到十二点二十来分。去吃了个午饭。一点钟去见总监而后又与人力的帅哥聊了会。感觉整个过程挺顺的。也比较轻松。下午回家后五点钟接到第二天去体检的通知。

      昨天一早去体检了。现在有点紧张。还没有接到入职的电话。

     

  • Watir:生成html格式的测试报告

    2009-02-05 16:00:09

    如下代码生成html格式的测试报告

    # Load classes
    require 'rubygems'
    require 'watir'

    class CLReport
      # Initialize the report class
      def initialize()
        @overallResult = 'PASSED'
        @reportContent1 = ''
        @reportContent2 = ''
      end
     
      # Create a report
      def createReport(reportName)
        # Get current time
        t = Time.now

        # Format the day
        if(t.day.to_s.length == 1)
          strDay = '0' + t.day.to_s
        else
          strDay = t.day.to_s
        end
       
        # Format the month
        if(t.month.to_s.length == 1)
          strMonth = '0' + t.month.to_s
        else
          strMonth = t.month.to_s
        end

        # Format the year
        strYear = t.year.to_s

        # Format the hour
        if(t.hour.to_s.length == 1)
          strHour = '0' + t.hour.to_s
        else
          strHour = t.hour.to_s
        end

        # Format the minutes
        if(t.min.to_s.length == 1)
          strMinutes = '0' + t.min.to_s
        else
          strMinutes = t.min.to_s
        end
       
        # Format the seconds
        if(t.sec.to_s.length == 1)
          strSeconds = '0' + t.sec.to_s
        elsif (t.sec.to_s.length == 0)
          strSeconds = '00'
        else
          strSeconds = t.sec.to_s
        end

        # Create the report name
        strTime = '_' + strDay + strMonth + strYear + '_' + strHour + strMinutes + strSeconds + '.html'
        strNiceTime = strDay + '-' + strMonth + '-' + strYear + ' @ ' + strHour + ':' + strMinutes + ':' + strSeconds
        strTotalReport = reportName + strTime 

        # Create the HTML report
        strFile = File.open(strTotalReport, 'w')
       puts strFile
        # Format the header of the HTML report
        @reportContent1 = '<html>
          <head>
          <meta content=text/html; charset=ISO-8859-1 http-equiv=content-type>
          <title>QA Test Report</title>
          <style type=text/css>
          .title { font-family: verdana; font-size: 30px;  font-weight: bold; align: left; color: #045AFD;}
          .bold_text { font-family: verdana; font-size: 12px;  font-weight: bold;}
          .normal_text { font-family: verdana; font-size: 12px;  font-weight: normal;}
          .small_text { font-family: verdana; font-size: 10px;  font-weight: normal; }
          .border { border: 1px solid #045AFD;}
          .border_left { border-top: 1px solid #045AFD; border-left: 1px solid #045AFD; border-right: 1px solid #045AFD;}
          .border_right { border-top: 1px solid #045AFD; border-right: 1px solid #045AFD;}
          .result_ok { font-family: verdana; font-size: 12px;  font-weight: bold; text-align: center; color: green;}
          .result_nok { font-family: verdana; font-size: 12px;  font-weight: bold; text-align: center; color: red;}
          .overall_ok { font-family: verdana; font-size: 12px;  font-weight: bold; text-align: left; color: green;}
          .overall_nok { font-family: verdana; font-size: 12px;  font-weight: bold; text-align: left; color: red;}
          .bborder_left { border-top: 1px solid #045AFD; border-left: 1px solid #045AFD; border-bottom: 1px solid #045AFD; background-           color:#045AFD;font-family: verdana; font-size: 12px;  font-weight: bold; text-align: center; color: white;}
          .bborder_right { border-right: 1px solid #045AFD; background-color:#045AFD;font-family: verdana; font-size: 12px;  font-weight: bold; text-align: center; color: white;}
          </style>
          </head>
          <body>
          <br>
          <center>
          <table width=800 border=0 cellpadding=2 cellspacing=2>
          <tbody>
          <tr>
          <td>
          <table width=100% border=0 cellpadding=2 cellspacing=2>
          <tbody>
          <tr>
          <td style=width: 150px;>&nbsp;</td>
          <td align=right><p class=title>QA Test Report</p></td>
          </tr>
          </tbody>
          </table>
          <br>
          <hr width=100% class=border size=1px>
          <br>
          <br>
          <center>
          <table border=0 width=95% cellpadding=2 cellspacing=2>
          <tbody>
          <tr>
          <td width=20%><p class=bold_text>Report Name</p></td>
          <td width=5%><p class=bold_text>:</p></td>
          <td width=75%><p class=normal_text>' + strTotalReport + '</p></td>
          </tr>
          <tr>
          <td width=20%><p class=bold_text>Test Execution</p></td>
          <td width=5%><p class=bold_text>:</p></td>
          <td width=75%><p class=normal_text>' + strNiceTime + '</p></td>
          </tr>
          <tr>
          <td width=20%><p class=bold_text>Overall Result</p></td>
          <td width=5%><p class=bold_text>:</p></td>'
        
        @reportContent2 = '</tr>
          </tbody>
          </table>
          </center>
          <br><br>
          <center>
          <table width=95% cellpadding=2 cellspacing=0>
          <tbody>
          <tr>
          <td class=bborder_left width=30%><p>Test Step</p></td>
          <td class=bborder_left width=10%><p>Result</p></td>
          <td class=bborder_right width=60%><p>Descrīption</p></td>
          </tr>'
       
        # Close the report
        strFile.close
       
        return strTotalReport
      end
     
      def addtoReport(reportName, step, result, descrīption)
        @reportContent2 = @reportContent2 + '<tr><td class=border_left width=30%><p class=normal_text>' + step + '</p></td>'

        # Format the body of the HTML report
        if (result == 'PASSED')
          @reportContent2 = @reportContent2 + '<td class=border_right width=10%><p class=result_ok>' + result + '</p></td>'
        else
          @overallResult = 'FAILED'
          @reportContent2 = @reportContent2 + '<td class=border_right width=10%><p class=result_nok>' + result + '</p></td>'
        end
      
        @reportContent2 = @reportContent2 + '<td class=border_right width=60%><p class=normal_text>' + descrīption + '</p></td></tr>'
      end
     
      def finishReport(reportName)
        # Open the HTML report
        strFile = File.open(reportName, 'a')

        # Format the footer of the HTML report
        @reportContent2 = @reportContent2 + '<tr>
          <td class=bborder_left width=30%><p>&nbsp;</p></td>
          <td class=bborder_left width=10%><p>&nbsp;</p></td>
          <td class=bborder_right width=60%><p>&nbsp;</p></td>
          </tr>
          </table>
          <br><br>
          <hr width=100% class=border size=1px>
          <br>
          <center><p class=small_text>&copy2008</p></center>
          <br>'
       
        strFile.puts(@reportContent1)
       
        if (@overallResult == 'PASSED')
          strFile.puts('<td width=75%><p class=overall_ok>' + @overallResult + '</p></td>')
        else
          strFile.puts('<td width=75%><p class=overall_nok>' + @overallResult + '</p></td>')
        end

        strFile.puts(@reportContent2)
      
        # Close the report
        strFile.close
      end
    end


    # The main test
    begin
      # Create the new report
      r = CLReport.new()
      testReport = r.createReport('C:\\')

      # Start browser
      browser = Watir::IE.new
      browser.goto('http://www.blabla.com')

      # --- START TEST ---

      # Do a check and report the result
      if (1 > 0)
        r.addtoReport(testReport, 'Check if 1 is bigger than 0', 'PASSED', '1 is indeed bigger than 0')
      else
        r.addtoReport(testReport, 'Check if 1 is bigger than 0', 'FAILED', '1 is NOT bigger than 0!')
      end 

      # Do another check and report the result
      if (2 > 1)
        r.addtoReport(testReport, 'Check if 2 is bigger than 1', 'PASSED', '2 is indeed bigger than 1')
      else
        r.addtoReport(testReport, 'Check if 2 is bigger than 1', 'FAILED', '2 is NOT bigger than 1!')
      end 

      # --- END TEST ---

      # Close browser
      browser.close

      # Finish the report
      r.finishReport(testReport)
    rescue
      # Send crash info to report
      r.addtoReport(testReport, 'Test crashed with reason '+$!, 'FAILED', 'Test crashed!')

      # Finish the report
      r.finishReport(testReport)
    end

    红色部分为测试结果填入.

  • Watir:Excel文件打开数据读取

    2009-02-04 17:32:32

    require 'win32ole'
     #打开excel文件
    excel = WIN32OLE.new("excel.application")
    excel.visible = true
    filepath="D:\\test.xls" #路径用两斜杠
    workbook = excel.workbooks.open(filepath)
    worksheet=workbook.worksheets(1)
    #worksheet=workbook.worksheets("sheet name") 打开表名
    #读取excel文件
    data=[]
    row=10
    while worksheet.range("a#{row}").value
       #读取单元格数据赋给数组
       data << worksheet.range("a#{row}").value.to_s
       puts data[row-10]
       row+=1
     end
    workbook.close
    excel.Quit

    注意文件路径的写法:filepath="D:\\test.xls"

     

  • watir编写阿里助手中“管理供求信息”中的重发

    2009-01-21 22:30:07

    每天要手工重发N多条的销售信息麻烦,我想用watir来实现自动发布。(当然阿里有工具不过是要钱的

    代码如下:

    # the Watir controller
    require "watir"
    require "win32ole" 
    # set a variable http://china.alibaba.com/offer/manage.htm?tracelog=myali_menu_manageoffer
    test_site = "http://china.alibaba.com/offer/manage.htm?tracelog=myali_menu_manageoffer"

    content = ""
    #open the IE browser
    ie = Watir::IE.new

    def check_for_popups

        autoit = WIN32OLE.new('AutoItX3.Control')

        #

       

        # Do forever - assumes popups could occur anywhere/anytime in your application.

        loop do

            # Look for window with given title. Give up after 1 second.

           

            ret = autoit.WinWait('Microsoft Internet Explorer', '', 1)

            #ret = WinActivate("Microsoft Internet Explorer", "")

            autoit.ControlClick("Microsoft Internet Explorer", "", "[CLASS:Button; INSTANCE:1]", 2)

            #强行点击,以使其获得focus

            puts(ret)

            #

            # If window found, send appropriate keystroke (e.g. {enter}, {Y}, {N}).

           

            if (ret==1) then autoit.Send("{Enter}") end

           

            #

            # Take a rest to avoid chewing up cycles and give another thread a go.

            # Then resume the loop.

            sleep(3)

        end

      end


    RecordNum = 0  #发布的信息条数
    while  (RecordNum<31)
        ie.goto test_site
        puts " Step 1: click resend" #点击重发
        ie.image(:src,"http://i01.c.aliimg.com/images/cn/market/myalibaba/word3a_nor.gif" ).click_no_wait
        sleep(10)
        $popup = Thread.new { check_for_popups }  # start popup handler
        at_exit { Thread.kill($popup) }
        RecordNum=RecordNum+1
    end
    ie.goto test_site

    此程序可以实现发布

    但还有如下问题,希望大家指点:

    1、点击“重发”前面三四条记录运行的比较快,后来运行会越来越慢。

    2、目前用变量RecordNum 来实现发布的条数,要改进至是否存在“重发”按钮来循环。

     

  • 我又要启航了

    2009-01-21 22:03:37

       关注51testing已经三四年,对我的帮助很大。我的大部分测试经验和管理经验都来源于此。特别是测试论坛。真的很感谢。

      我做过两年的asp开发。一年的软件测试。两年的测试主管。

      总结过去是为了迎接新的开始。为了生宝宝我告别了测试一年多的时间。完成了人生的一件大事。接下去应该是我的职业好好发展的时候了。

     祝愿自己有一个好的开始!我又要启航了!

数据统计

  • 访问量: 15232
  • 日志数: 10
  • 文件数: 9
  • 书签数: 2
  • 建立时间: 2009-01-21
  • 更新时间: 2009-02-28

RSS订阅

Open Toolbar