aboutsummaryrefslogtreecommitdiff
path: root/bin/test-website
diff options
context:
space:
mode:
authorzsloan2016-05-17 16:04:11 +0000
committerzsloan2016-05-17 16:04:11 +0000
commitf7520d9a6e05b103bab983c31ef0e53fad59f5e6 (patch)
treea1ba729c38a48806ca43540a960d655aaa9989e9 /bin/test-website
parent2dfc56250714cb494eb7f3072b1e7cae18edace4 (diff)
parent04afa563e6d53fe2a91ac2e6eb4af2f2fa5d5c3b (diff)
downloadgenenetwork2-f7520d9a6e05b103bab983c31ef0e53fad59f5e6.tar.gz
Merge branch 'staging' of github.com:genenetwork/genenetwork2 into development
Diffstat (limited to 'bin/test-website')
-rwxr-xr-xbin/test-website66
1 files changed, 66 insertions, 0 deletions
diff --git a/bin/test-website b/bin/test-website
new file mode 100755
index 00000000..24274713
--- /dev/null
+++ b/bin/test-website
@@ -0,0 +1,66 @@
+#!/usr/bin/env ruby
+
+
+USAGE = <<EOT
+This is Mechanical-Rob - an automated web server tester for
+ Genenetwork.org that uses the brilliant
+ mechanize gem.
+
+To use this software you need to install mechanize. Run it from
+the root of the genenetwork2 source tree as, for example,
+
+ ./bin/test-website http://localhost:5003/ (default)
+
+For more information see http://genenetwork.org/
+
+EOT
+$stderr.print USAGE
+
+require 'optparse'
+
+options = {}
+opts = OptionParser.new do |o|
+ o.banner = "Usage: #{File.basename($0)} [options] URL"
+
+ o.on('-l','--link-checker', 'Check for dead links') do
+ options[:link_checker] = true
+ end
+
+ o.separator ""
+ o.on_tail('-h', '--help', 'display this help and exit') do
+ options[:show_help] = true
+ end
+end
+
+opts.parse!(ARGV)
+
+if options[:show_help]
+ print opts
+ exit 1
+end
+
+$host =
+ if ARGV.size>0
+ ARGV.shift
+ else
+ "http://localhost:5003"
+ end
+
+$stderr.print "Testing <",$host,">\n"
+
+require 'mechanize'
+require 'minitest/spec'
+require 'minitest/autorun'
+
+# These are the actual testing modules
+
+libpath = File.dirname(File.dirname(__FILE__))
+$: << File.join(libpath,'test/lib')
+
+if options[:link_checker]
+ require 'link_checker'
+else
+ require 'main_web_functionality'
+end
+
+