Hi,

Here is a small sample of the test scripts we are using at the moment,
can you tell if there is much work required to change it to RSpec?

require "rubygems"

require "logger"
require "test/unit"
require "watir"
require "library/CSVRead"
require "library/PARRead"
require "library/Login"
require "library/browseTree"

class WorkflowSelectorTest < Test::Unit::TestCase
    def setup
        #Setup Variables
        myPAR = PARRead.new("001_parameters.txt")

        #Create log file
        $log = Logger.new(myPAR.logfile)
        $log.debug "===Initializing Test Setup==="

        testSite = myPAR.url
        title = myPAR.title

        #Choose Browser
        Watir::Browser.default = myPAR.browser

        #Start Test Run
        $log.debug "===Start==="
        $log.debug "Goto web page, "+ testSite
        $browser = Watir::Browser.start(testSite)

        #Login
        tmp = Login.new($browser,myPAR.user,myPAR.password)

        $log.debug "Test WebClient Title"
        assert($browser.title.include? title)

        #Wait for jQuery to render
        Watir::Waiter.wait_until {$browser.label(:id,"acms-ws-select-
label").exists?}
        $log.debug "Check workspace label"
        assert($browser.label(:id, "acms-ws-select-label").exists?)
    end

    def teardown
        $log.debug "===Test Teardown==="
        #TODO Logout when implemented in client
        if $DEBUG then
                    #Do not close the browser
                        puts "Finished"
                else
                        $browser.close
                end
        $log.close
    end

    def testWorkflowSelector1
        #Test choosing workspaces
        myData = CSVRead.new("data/testWorkflowSelector1.csv")
        workspaceName = myData.array

        $log.debug "===testWorkflowSelector1==="
        $log.debug "Test choosing workspaces"
        $log.debug "Select workflow dropdown check"
        assert($browser.select_list(:id, "ACMS-Workspace-Selector"))
        $log.debug "Change workflow dropdown check"
                dropDown = $browser.select_list(:id, "ACMS-Workspace-Selector")
        i=0
        while i < workspaceName.length
                        dropDown.select workspaceName[i][0]
                        dropDown.set workspaceName[i][0]
                        assert_equal(dropDown.value,workspaceName[i][0])
                        i+=1
        end

        $log.debug "===testWorkflowSelector1==="
    end
end


Regards,
Alastair

On Nov 12, 1:40 pm, Željko Filipin <[email protected]>
wrote:
> On Fri, Nov 12, 2010 at 12:44 PM, Alastair Montgomery <[email protected]>
> wrote:
>
> > Do you need to do any changes to your test scripts to run them with
> > RSpec?
>
> It depends. :)
>
> If you provide some sample code I could change it to use RSpec.
>
> Željko

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to