It's pretty easy to roll your own. You may not want to or need to. But it's not
hard.
Here's something that you can experiment with:
-Create a directory
-Create some script to run your tests called testrunner.rb. Put these two lines
in that script:
ROOT_DIR = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift(ROOT_DIR)
#(This will allow you to require things relative to the ROOT_DIR)
-Create a folder called 'library'
-Add the following lines to your test runner script:
require 'library/mylib1.rb'
require 'library/mylib2.rb'
#(where mylib1rb and mylib2.rb contain your library code)
-Create a folder called tests
-Create a script called sample.rb in the tests folder:
class TC < Test::Unit::TestCase
def test_01_always_passes
assert(true)
end
def test_02_always_fails
assert(false, "This test always fails")
end
end
-Add the following lines to your test runner script:
require 'test/unit' #May need to use require 'minitest' instead
require "tests/#{ARGV[0]}"
>From here you should be able to call the testrunner script with the test that
>you want to run as a command line argument:
testrunner sample
Test::Unit should run the test from there.
Obviously this is pretty basic and doesn't cover reporting but it gives you
some structure to start writing libraries and executing tests.
I really like Test::Unit but there are plenty of other approaches out there.
Cucumber provides some structure and uses rake to run tests. You'll probably
want to start googling minitest, rspec and cucumber for ideas. But the example
above does quite a bit of what you want and may be enough to help you to figure
out where to go next.
________________________________
From: Sohail Mirza <[email protected]>
To: [email protected]
Sent: Saturday, July 28, 2012 12:50 PM
Subject: Re: [wtr-general] Watir Framework?
seems not able to get the point from where to start... do you have something to
help me out on this...
I wanted to have following folder structure
ObjectRepositry (should contains object repositry file and i have no idea how
to make OR here in watir)
Library (should contains library code)
Data (should contains data file)
Reports (should contains reports)
Run.rb to run all the file
Thanks
On Sat, Jul 28, 2012 at 5:31 PM, Željko Filipin <[email protected]> wrote:
On Sat, Jul 28, 2012 at 3:30 PM, Sohail Mirza <[email protected]> wrote:
>> Could you more explain page-object gem? How to setup page-object gem?
>> Could you give some link reference where i can find more details about
>> page-object gem?
>
>https://github.com/cheezy/page-object
>https://github.com/cheezy/page-object/wiki
>https://leanpub.com/cucumber_and_cheese
>
>Ž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]
>
--
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]
--
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]