Search code examples
ruby-on-railsrubyscriptingcmdwatir

How to run multiple watir scripts from one general script


I have 3 different watir scripts testing different functionality of a website. I want to be able to run one single script which brings these different scripts together and runs them one after another. Is there any way of doing this?


Solution

  • The simplest thing is to require all files explicitly in one file and then run that file. For example, you have Watir code in file1.rb, file2.rb and file3.rb. Create file.rb that contains:

    require "file1"
    require "file2"
    require "file3"
    

    and then in command line execute file.rb with:

    ruby file.rb