bdd-legacy 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- # require 'psych'
1
+ require 'psych'
2
2
  require 'yaml'
3
- YAML::ENGINE.yamler='psych' if defined?(YAML::ENGINE)
3
+ # YAML::ENGINE.yamler='psych' if defined?(YAML::ENGINE)
4
4
  require 'rubygems'
5
5
  # gem 'hoe' , '>= 2.1.0'
6
6
  require 'hoe'
@@ -2,5 +2,5 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module BddLegacy
5
- VERSION = '0.0.6'
5
+ VERSION = '0.0.7'
6
6
  end
metadata CHANGED
@@ -1,111 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bdd-legacy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Wavell Watson
9
- autorequire:
9
+ autorequire: builder
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 2011-05-16 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: cucumber
16
- requirement: &2154031080 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - =
20
- - !ruby/object:Gem::Version
21
- version: 0.10.2
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: *2154031080
25
- - !ruby/object:Gem::Dependency
26
- name: hoe
27
- requirement: &2154030580 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: 2.9.4
33
- type: :development
34
- prerelease: false
35
- version_requirements: *2154030580
36
- description: FIX (describe your package)
37
- email:
38
- - wavell.watson@gmail.com
39
- executables:
40
- - additions_feature.tt
41
- - addition_steps.tt
42
- - calculator.tt
43
- - env.tt
44
- - generic_browser_steps.tt
45
- - landing_page_feature.tt
46
- - landing_page_steps.tt
47
- - login_feature.tt
48
- - login_steps.tt
49
- - newgem.tt
50
- - rakefile.tt
51
- - sqlhelper.tt
52
- - sqlserver.tt
53
- - bdd-legacy
13
+ dependencies: []
14
+ description: Allows for use of feature driven testing of legacy (especially sql server)
15
+ applications.
16
+ email: wavell.watson@gmail.org
17
+ executables: []
54
18
  extensions: []
55
19
  extra_rdoc_files:
56
20
  - History.txt
57
21
  - Manifest.txt
58
22
  - PostInstall.txt
23
+ - Rakefile
24
+ - README.rdoc
59
25
  files:
26
+ - lib/bdd-legacy.rb
27
+ - test/test_bdd-legacy.rb
28
+ - test/test_helper.rb
60
29
  - History.txt
61
30
  - Manifest.txt
62
31
  - PostInstall.txt
63
- - README.rdoc
64
32
  - Rakefile
65
- - lib/bdd-legacy.rb
66
- - lib/bdd-legacy.thor
67
- - script/console
68
- - script/console.cmd
69
- - script/destroy
70
- - script/destroy.cmd
71
- - script/generate
72
- - script/generate.cmd
73
- - test/test_bdd-legacy.rb
74
- - test/test_helper.rb
75
- - bin/templates/additions_feature.tt
76
- - bin/templates/addition_steps.tt
77
- - bin/templates/calculator.tt
78
- - bin/templates/env.tt
79
- - bin/templates/generic_browser_steps.tt
80
- - bin/templates/landing_page_feature.tt
81
- - bin/templates/landing_page_steps.tt
82
- - bin/templates/login_feature.tt
83
- - bin/templates/login_steps.tt
84
- - bin/templates/newgem.tt
85
- - bin/templates/rakefile.tt
86
- - bin/templates/sqlhelper.tt
87
- - bin/templates/sqlserver.tt
88
- - bin/bdd-legacy
89
- - bin/additions_feature.tt
90
- - bin/addition_steps.tt
91
- - bin/calculator.tt
92
- - bin/env.tt
93
- - bin/generic_browser_steps.tt
94
- - bin/landing_page_feature.tt
95
- - bin/landing_page_steps.tt
96
- - bin/login_feature.tt
97
- - bin/login_steps.tt
98
- - bin/newgem.tt
99
- - bin/rakefile.tt
100
- - bin/sqlhelper.tt
101
- - bin/sqlserver.tt
102
- - .gemtest
103
- homepage: http://github.com/#{github_username}/#{project_name}
33
+ - README.rdoc
34
+ homepage: ''
104
35
  licenses: []
105
- post_install_message: PostInstall.txt
36
+ post_install_message:
106
37
  rdoc_options:
107
- - --main
108
- - README.rdoc
38
+ - --title
39
+ - bdd-legacy -- Easy legacy testing
109
40
  require_paths:
110
41
  - lib
111
42
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -121,11 +52,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
52
  - !ruby/object:Gem::Version
122
53
  version: '0'
123
54
  requirements: []
124
- rubyforge_project: bdd-legacy
55
+ rubyforge_project:
125
56
  rubygems_version: 1.8.2
126
57
  signing_key:
127
58
  specification_version: 3
128
- summary: FIX (describe your package)
129
- test_files:
130
- - test/test_bdd-legacy.rb
131
- - test/test_helper.rb
59
+ summary: Installs tools needed for bdd testing of legacy applications.
60
+ test_files: []
data/.gemtest DELETED
File without changes
@@ -1,15 +0,0 @@
1
- Before do
2
- @calculator = Calculator.new
3
- end
4
-
5
- Given /^I have entered ([0-9]*) into the calculator$/ do |value|
6
- @calculator.enter( value.to_i )
7
- end
8
-
9
- When /^I press add$/ do
10
- @calculator.add
11
- end
12
-
13
- Then /^the result should be ([0-9]*) on the screen$/ do |value|
14
- @calculator.screen.should equal( value.to_i )
15
- end
@@ -1,10 +0,0 @@
1
- Feature: Addition
2
- In order to avoid silly mistakes
3
- As a math idiot
4
- I want to be told the sum of two numbers
5
-
6
- Scenario: Add two numbers
7
- Given I have entered 50 into the calculator
8
- And I have entered 70 into the calculator
9
- When I press add
10
- Then the result should be 120 on the screen
@@ -1,84 +0,0 @@
1
- #!/user/bin/env ruby
2
-
3
- require 'thor'
4
- require 'thor/group'
5
-
6
- class BddLegacy < Thor::Group
7
- include Thor::Actions
8
-
9
- # Define arguments and options
10
- argument :name
11
- # class_option :test_framework, :default => :test_unit
12
-
13
- def self.source_root
14
- File.dirname(__FILE__)
15
- end
16
-
17
- def create_rake_file
18
- template('templates/rakefile.tt', "#{name}/rakefile.rb")
19
- end
20
-
21
- def create_example_feature_file
22
- template('templates/additions_feature.tt', "#{name}/features/additions.feature")
23
- end
24
-
25
- def create_login_feature_file
26
- template('templates/login_feature.tt', "#{name}/features/login.feature")
27
- end
28
-
29
- def create_landing_page_feature_file
30
- template('templates/landing_page_feature.tt', "#{name}/features/landing_page.feature")
31
- end
32
-
33
- def create_generic_steps_file
34
- template('templates/generic_browser_steps.tt', "#{name}/features/step_definitions/generic_browser_steps.rb")
35
- end
36
-
37
- def create_login_steps_file
38
- template('templates/login_steps.tt', "#{name}/features/step_definitions/login_steps.rb")
39
- end
40
-
41
- def create_landing_page_steps_file
42
- template('templates/landing_page_steps.tt', "#{name}/features/step_definitions/landing_page_steps.rb")
43
- end
44
-
45
- def create_example_steps_file
46
- template('templates/addition_steps.tt', "#{name}/features/step_definitions/addition_steps.rb")
47
- end
48
-
49
- def create_env_file
50
- template('templates/env.tt', "#{name}/features/support/env.rb")
51
- end
52
-
53
- def create_sqlserver_file
54
- template('templates/sqlserver.tt', "#{name}/lib/sqlserver.rb")
55
- end
56
-
57
- def create_sqlserver_wrapper_file
58
- template('templates/sqlhelper.tt', "#{name}/lib/sqlhelper.rb")
59
- end
60
-
61
- def create_example_code_file
62
- template('templates/calculator.tt', "#{name}/lib/calculator.rb")
63
- end
64
-
65
- # def create_feature_file
66
- # template('templates/features.tt', "#{name}/lib/#{name}.rb")
67
- # end
68
-
69
- # def create_test_file
70
- # test = options[:test_framework] == "rspec" ? :spec : :test
71
- # create_file "#{name}/#{test}/#{name}_#{test}.rb"
72
- # end
73
-
74
- # def copy_licence
75
- # if yes?("Use MIT license?")
76
- # Make a copy of the MITLICENSE file at the source root
77
- # copy_file "MITLICENSE", "#{name}/MITLICENSE"
78
- # else
79
- # say "Shame on you�", :red
80
- # end
81
- # end
82
- end
83
-
84
- BddLegacy.start
@@ -1,17 +0,0 @@
1
- class Calculator
2
- def initialize
3
- @stack = []
4
- end
5
-
6
- def enter( value )
7
- @stack.push value
8
- end
9
-
10
- def screen
11
- @stack[0]
12
- end
13
-
14
- def add
15
- @stack.push( @stack.pop + @stack.pop )
16
- end
17
- end
data/bin/env.tt DELETED
@@ -1,53 +0,0 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
- require 'calculator'
3
- require 'sqlserver'
4
- require 'sqlserver_wrapper'
5
- require 'capybara/cucumber'
6
-
7
- Capybara.run_server = false
8
-
9
- Capybara.register_driver :selenium_firefox do |app|
10
- Capybara::Driver::Selenium.new(app,:browser=>:firefox)
11
- end
12
-
13
- Capybara.register_driver :selenium_ie do |app|
14
- Capybara::Driver::Selenium.new(app,:browser=>:ie)
15
- end
16
-
17
- Capybara.default_driver = :selenium_firefox
18
-
19
- workingDBServerOpt||=
20
- workingDBOpt||={}
21
- workingEnvLinkOpt||={}
22
-
23
- # change to :test or :dev or :local
24
- $currentOpt=:local
25
-
26
- #TODO change strings to import from yaml file
27
- #TODO exclude yaml file from check-in
28
- # the below server name will either be in the format of 'MYSERVERNAME' or 'MYSERVERNAME\DATABASEINSTANCE'
29
- # depending on how your sql servr is set up
30
- workingDBServerOpt={:dev => 'MYDEVDATABASESERVER',
31
- :test => 'MYTESTDATABASESERVER',
32
- :local => 'MYLOCALDATABASE'}
33
- workingDBOpt={:dev => 'devdb',
34
- :test => 'tstdb',
35
- :local => 'devdb'}
36
- # if you have a list of links after logging in with a single sign on account,
37
- # you may also have a page of separate links for local/dev/test/prod etc
38
- workingEnvLinkOpt = {:local => 'Welcome',
39
- :dev => 'Welcome',
40
- :test => 'Welcome'}
41
-
42
- $workingDBServer = workingDBServerOpt[$currentOpt]
43
- $workingDB = workingDBOpt[$currentOpt]
44
- $workingAppUser='myapplicationusername'
45
- $workingAppPW='myapplicationpw'
46
- $workingDBUser='mydatabaseusername'
47
- $workingDBPW='mydatabasepw'
48
- # Change this to the domain of your web server. Don't add the full url
49
- $workingAppHostLink='http://localhost'
50
- # add the url of your login page
51
- $workingAppLoginRoute='/welcome/logon.asp'
52
- $workingEnvLink = workingEnvLinkOpt[$currentOpt]
53
-
@@ -1,66 +0,0 @@
1
- Before('@firefox') do
2
-
3
- Capybara.app_host = $workingAppHostLink
4
-
5
- Capybara.current_driver = :selenium_firefox
6
- visit $workingAppLoginRoute
7
-
8
- end
9
-
10
- After('@firefox') do
11
- Capybara.use_default_driver
12
- end
13
-
14
- Before('@ie') do
15
- Capybara.app_host = $workingAppHostLink
16
- Capybara.current_driver = :selenium_ie
17
- visit $workingAppLoginRoute
18
- end
19
-
20
- After('@ie') do
21
- Capybara.use_default_driver
22
- end
23
-
24
- When /^I press "([^"]*)"$/ do |arg1|
25
- continue = find_by_id arg1
26
- continue.click
27
- end
28
-
29
- #example of making something ie specific
30
- Given /^I press "([^"]*)" in internet explorer$/ do |arg1|
31
- mybutton = find_button arg1
32
- mybutton.click
33
- end
34
-
35
- Then /^I select the link "([^"]*)"$/ do |arg1|
36
- click_link arg1
37
- end
38
-
39
-
40
- Then /^I should see "([^"]*)"$/ do |arg1|
41
- page.should have_content(arg1)
42
- end
43
-
44
- Then /^I should not see "([^"]*)"$/ do |arg1|
45
- page.should_not have_content(arg1)
46
- end
47
-
48
- Given /^I evaluate the script for "([^"]*)"$/ do |arg1|
49
- page.evaluate_script arg1
50
- end
51
-
52
- # popup example
53
- Then /^within the "([^"]*)" window, I should see "([^"]*)"$/ do |arg1, arg2|
54
- page.within_window(arg1){page.should have_content(arg2)}
55
- end
56
-
57
- Then /^within the "([^"]*)" window, I select "([^"]*)"$/ do |arg1, arg2|
58
- page.within_window(arg1) do
59
- myelem = page.find(:xpath, "//*[@value='#{arg2}']")
60
- myelem.click
61
- end
62
- end
63
-
64
- Then /^I should see "([^"]*)" in a field$/ do |arg1|
65
- page.should have_xpath("//*[@value='#{arg1}']")
66
- end
@@ -1,23 +0,0 @@
1
- Feature: Landing Page
2
- In order to work in my app
3
- As my app's personnel
4
- I need to land on the home page
5
-
6
- @firefox
7
- Scenario: Land on the landing page page
8
- Given I am logged in
9
- Then I should see "My App's greeting"
10
- And I should see "Something Else that I want to check"
11
-
12
- @firefox @sql_insert_example
13
- Scenario: Landing page messages
14
- Given I am logged in
15
- And I have a message that says "Heyas" waiting for me
16
- Then I should see "Heyas"
17
-
18
- @ie @sql_insert_example
19
- Scenario: Delete Home page messages
20
- Given I have a message that says "Heyas" waiting for me
21
- And I am logged in
22
- And I press "Remove" in internet explorer
23
- Then I should not see "Heyas"
@@ -1,30 +0,0 @@
1
- After('@sql_insert_example') do |s|
2
- delete_message
3
- end
4
-
5
- # This is an example. If you need to do setup and teardown data in your database
6
- # obviously you'll have your own table replace 'messages' below
7
- def insert_message()
8
- insertsql||=[]
9
- insertsql[0]= <<-eos
10
- INSERT INTO [Messages]
11
- ([Message])
12
- VALUES
13
- ('Heyas')
14
- eos
15
-
16
- insertsql[1]= 'select @@IDENTITY'
17
-
18
- results, field_lists = SqlServer.helperqueries(insertsql)
19
-
20
- @insertID = results[1][0][0] #get *first* result from *second* query
21
- end
22
-
23
- def delete_message
24
- result = SqlServer.helperquery("delete from Messages where Messageid = #{@insertID}")
25
- end
26
-
27
- Given /^I have a message that says "([^"]*)" waiting for me$/ do |arg1|
28
- insert_message
29
- end
30
-
@@ -1,13 +0,0 @@
1
- Feature: Login
2
- In order to log into my app
3
- As my app's personnel
4
- I want to put in my user name and password
5
-
6
- @firefox
7
- Scenario: Log in
8
- Given I enter my username
9
- And I enter my password
10
- When I press Continue
11
- Then I should see the environment link
12
- And I select the environment link
13
-
@@ -1,33 +0,0 @@
1
- # if you have trouble finding a button using the text of the button
2
- # in either firefox or ie, try using the id
3
- When /^I press login$/ do
4
- login = find_by_id 'loginid'
5
- login.click
6
- end
7
-
8
-
9
- Given /^I enter my username$/ do
10
- fill_in 'Username', :with => $workingAppUser
11
- end
12
-
13
- Given /^I enter my password$/ do
14
- fill_in 'Password', :with => $workingAppPW
15
- end
16
-
17
- Then /^I should see the environment link$/ do
18
- page.should have_content($workingEnvLink)
19
- end
20
-
21
- Then /^I select the environment link$/ do
22
- click_link $workingEnvLink
23
- end
24
-
25
- Given /^I am logged in$/ do
26
- steps %Q{
27
- Given I enter my username
28
- And I enter my password
29
- When I press Continue
30
- Then I should see the environment link
31
- And I select the environment link
32
- }
33
- end
@@ -1,2 +0,0 @@
1
- class <%= name.capitalize %>
2
- end
@@ -1,5 +0,0 @@
1
- require 'cucumber/rake/task'
2
-
3
- Cucumber::Rake::Task.new do |t|
4
- t.cucumber_opts = "--format pretty"
5
- end
@@ -1,40 +0,0 @@
1
- require 'sqlserver'
2
-
3
- # example use
4
- # insertsql||=[]
5
- # insertsql[0]= <<-eos
6
- # INSERT INTO [Messages]
7
- # ([Message])
8
- # VALUES
9
- # ('Do your hours')
10
- # eos
11
- # insertsql[1]= 'select @@IDENTITY'
12
- # results, field_lists = SqlServer.helperqueries(insertsql)
13
- # @insertID = results[1][0][0] #get *first* result from *second* query
14
-
15
- class SqlServer
16
-
17
- #multiple statements need an array
18
- #don't error out on statements that don't return anything
19
- def self.helperqueries(sql=[])
20
- return [],[] if sql.empty?
21
-
22
- db = SqlServer.new($workingDBServer, $workingDBUser, $workingDBPW)
23
- db.open($workingDB)
24
- data, field_lists = db.queries(sql)
25
- db.close
26
- return data, field_lists
27
- end
28
-
29
-
30
- def self.helperquery(sql)
31
- db = SqlServer.new($workingDBServer, $workingDBUser, $workingDBPW)
32
- db.open($workingDB)
33
- db.query(sql)
34
- field_names = db.fields
35
- data = db.data
36
- db.close
37
- return data, field_names
38
- end
39
- end
40
-
@@ -1,118 +0,0 @@
1
- require 'win32ole'
2
-
3
- # example use
4
- # db = SqlServer.new
5
- # db.open
6
- # db.query("SELECT PLAYER FROM PLAYERS WHERE TEAM = 'REDS';")
7
- # field_names = db.fields
8
- # players = db.data
9
- # db.close
10
-
11
- class SqlServer
12
-
13
- # This class manages database connection and queries
14
- attr_accessor :connection, :data, :fields
15
- attr_writer :username, :password
16
-
17
- def initialize(host, username = 'sa', password='')
18
- @connection = nil
19
- @data = nil
20
- @host = host
21
- @username = username
22
- @password = password
23
- end
24
-
25
- def open(database)
26
- # Open ADO connection to the SQL Server database
27
- connection_string = "Provider=SQLOLEDB.1;"
28
- connection_string << "Persist Security Info=False;"
29
- connection_string << "User ID=#{@username};"
30
- connection_string << "password=#{@password};"
31
- connection_string << "Initial Catalog=#{database};"
32
- connection_string << "Data Source=#{@host};"
33
- connection_string << "Network Library=dbmssocn"
34
- @connection = WIN32OLE.new('ADODB.Connection')
35
- @connection.Open(connection_string)
36
- end
37
-
38
- def queries(sql=[])
39
- # debugger
40
- return [],[] if sql.empty?
41
-
42
- results ||=[]
43
- field_lists ||=[]
44
- # debugger
45
- sql.each do |s|
46
- result, fields = query_field_data(s)
47
- results << result
48
- field_lists << fields
49
- end
50
- return results, field_lists
51
- end
52
-
53
-
54
- def query_field_data(sql)
55
- # Create an instance of an ADO Recordset
56
- recordset = WIN32OLE.new('ADODB.Recordset')
57
- # Open the recordset, using an SQL statement and the
58
- # existing ADO connection
59
- recordset.Open(sql, @connection)
60
- # Create and populate an array of field names
61
- # debugger
62
- fields = []
63
- recordset.Fields.each do |field|
64
- fields << field.Name
65
- end
66
- begin
67
- # Move to the first record/row, if any exist
68
- recordset.MoveFirst
69
- # Grab all records
70
- data = recordset.GetRows
71
- # record only needs to be closed if movefirst doesn't cause an error
72
- recordset.Close
73
- rescue
74
- data = []
75
- end
76
-
77
- # An ADO Recordset's GetRows method returns an array
78
- # of columns, so we'll use the transpose method to
79
- # convert it to an array of rows
80
- data = data.transpose
81
- return data, fields
82
- end
83
-
84
-
85
- def query(sql)
86
- # Create an instance of an ADO Recordset
87
- recordset = WIN32OLE.new('ADODB.Recordset')
88
- # Open the recordset, using an SQL statement and the
89
- # existing ADO connection
90
- recordset.Open(sql, @connection)
91
- # Create and populate an array of field names
92
- # debugger
93
- @fields ||=[]
94
- recordset.Fields.each do |field|
95
- @fields << field.Name
96
- end
97
- begin
98
- # Move to the first record/row, if any exist
99
- recordset.MoveFirst
100
- # Grab all records
101
- @data = recordset.GetRows
102
- # record only needs to be closed if movefirst doesn't cause an error
103
- recordset.Close
104
- rescue
105
- @data = []
106
- end
107
- # An ADO Recordset's GetRows method returns an array
108
- # of columns, so we'll use the transpose method to
109
- # convert it to an array of rows
110
- @data = @data.transpose
111
- return @data, @fields
112
- end
113
-
114
- def close
115
- @connection.Close
116
- end
117
- end
118
-
@@ -1,15 +0,0 @@
1
- Before do
2
- @calculator = Calculator.new
3
- end
4
-
5
- Given /^I have entered ([0-9]*) into the calculator$/ do |value|
6
- @calculator.enter( value.to_i )
7
- end
8
-
9
- When /^I press add$/ do
10
- @calculator.add
11
- end
12
-
13
- Then /^the result should be ([0-9]*) on the screen$/ do |value|
14
- @calculator.screen.should equal( value.to_i )
15
- end
@@ -1,10 +0,0 @@
1
- Feature: Addition
2
- In order to avoid silly mistakes
3
- As a math idiot
4
- I want to be told the sum of two numbers
5
-
6
- Scenario: Add two numbers
7
- Given I have entered 50 into the calculator
8
- And I have entered 70 into the calculator
9
- When I press add
10
- Then the result should be 120 on the screen
@@ -1,17 +0,0 @@
1
- class Calculator
2
- def initialize
3
- @stack = []
4
- end
5
-
6
- def enter( value )
7
- @stack.push value
8
- end
9
-
10
- def screen
11
- @stack[0]
12
- end
13
-
14
- def add
15
- @stack.push( @stack.pop + @stack.pop )
16
- end
17
- end
@@ -1,53 +0,0 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
- require 'calculator'
3
- require 'sqlserver'
4
- require 'sqlserver_wrapper'
5
- require 'capybara/cucumber'
6
-
7
- Capybara.run_server = false
8
-
9
- Capybara.register_driver :selenium_firefox do |app|
10
- Capybara::Driver::Selenium.new(app,:browser=>:firefox)
11
- end
12
-
13
- Capybara.register_driver :selenium_ie do |app|
14
- Capybara::Driver::Selenium.new(app,:browser=>:ie)
15
- end
16
-
17
- Capybara.default_driver = :selenium_firefox
18
-
19
- workingDBServerOpt||=
20
- workingDBOpt||={}
21
- workingEnvLinkOpt||={}
22
-
23
- # change to :test or :dev or :local
24
- $currentOpt=:local
25
-
26
- #TODO change strings to import from yaml file
27
- #TODO exclude yaml file from check-in
28
- # the below server name will either be in the format of 'MYSERVERNAME' or 'MYSERVERNAME\DATABASEINSTANCE'
29
- # depending on how your sql servr is set up
30
- workingDBServerOpt={:dev => 'MYDEVDATABASESERVER',
31
- :test => 'MYTESTDATABASESERVER',
32
- :local => 'MYLOCALDATABASE'}
33
- workingDBOpt={:dev => 'devdb',
34
- :test => 'tstdb',
35
- :local => 'devdb'}
36
- # if you have a list of links after logging in with a single sign on account,
37
- # you may also have a page of separate links for local/dev/test/prod etc
38
- workingEnvLinkOpt = {:local => 'Welcome',
39
- :dev => 'Welcome',
40
- :test => 'Welcome'}
41
-
42
- $workingDBServer = workingDBServerOpt[$currentOpt]
43
- $workingDB = workingDBOpt[$currentOpt]
44
- $workingAppUser='myapplicationusername'
45
- $workingAppPW='myapplicationpw'
46
- $workingDBUser='mydatabaseusername'
47
- $workingDBPW='mydatabasepw'
48
- # Change this to the domain of your web server. Don't add the full url
49
- $workingAppHostLink='http://localhost'
50
- # add the url of your login page
51
- $workingAppLoginRoute='/welcome/logon.asp'
52
- $workingEnvLink = workingEnvLinkOpt[$currentOpt]
53
-
@@ -1,66 +0,0 @@
1
- Before('@firefox') do
2
-
3
- Capybara.app_host = $workingAppHostLink
4
-
5
- Capybara.current_driver = :selenium_firefox
6
- visit $workingAppLoginRoute
7
-
8
- end
9
-
10
- After('@firefox') do
11
- Capybara.use_default_driver
12
- end
13
-
14
- Before('@ie') do
15
- Capybara.app_host = $workingAppHostLink
16
- Capybara.current_driver = :selenium_ie
17
- visit $workingAppLoginRoute
18
- end
19
-
20
- After('@ie') do
21
- Capybara.use_default_driver
22
- end
23
-
24
- When /^I press "([^"]*)"$/ do |arg1|
25
- continue = find_by_id arg1
26
- continue.click
27
- end
28
-
29
- #example of making something ie specific
30
- Given /^I press "([^"]*)" in internet explorer$/ do |arg1|
31
- mybutton = find_button arg1
32
- mybutton.click
33
- end
34
-
35
- Then /^I select the link "([^"]*)"$/ do |arg1|
36
- click_link arg1
37
- end
38
-
39
-
40
- Then /^I should see "([^"]*)"$/ do |arg1|
41
- page.should have_content(arg1)
42
- end
43
-
44
- Then /^I should not see "([^"]*)"$/ do |arg1|
45
- page.should_not have_content(arg1)
46
- end
47
-
48
- Given /^I evaluate the script for "([^"]*)"$/ do |arg1|
49
- page.evaluate_script arg1
50
- end
51
-
52
- # popup example
53
- Then /^within the "([^"]*)" window, I should see "([^"]*)"$/ do |arg1, arg2|
54
- page.within_window(arg1){page.should have_content(arg2)}
55
- end
56
-
57
- Then /^within the "([^"]*)" window, I select "([^"]*)"$/ do |arg1, arg2|
58
- page.within_window(arg1) do
59
- myelem = page.find(:xpath, "//*[@value='#{arg2}']")
60
- myelem.click
61
- end
62
- end
63
-
64
- Then /^I should see "([^"]*)" in a field$/ do |arg1|
65
- page.should have_xpath("//*[@value='#{arg1}']")
66
- end
@@ -1,23 +0,0 @@
1
- Feature: Landing Page
2
- In order to work in my app
3
- As my app's personnel
4
- I need to land on the home page
5
-
6
- @firefox
7
- Scenario: Land on the landing page page
8
- Given I am logged in
9
- Then I should see "My App's greeting"
10
- And I should see "Something Else that I want to check"
11
-
12
- @firefox @sql_insert_example
13
- Scenario: Landing page messages
14
- Given I am logged in
15
- And I have a message that says "Heyas" waiting for me
16
- Then I should see "Heyas"
17
-
18
- @ie @sql_insert_example
19
- Scenario: Delete Home page messages
20
- Given I have a message that says "Heyas" waiting for me
21
- And I am logged in
22
- And I press "Remove" in internet explorer
23
- Then I should not see "Heyas"
@@ -1,30 +0,0 @@
1
- After('@sql_insert_example') do |s|
2
- delete_message
3
- end
4
-
5
- # This is an example. If you need to do setup and teardown data in your database
6
- # obviously you'll have your own table replace 'messages' below
7
- def insert_message()
8
- insertsql||=[]
9
- insertsql[0]= <<-eos
10
- INSERT INTO [Messages]
11
- ([Message])
12
- VALUES
13
- ('Heyas')
14
- eos
15
-
16
- insertsql[1]= 'select @@IDENTITY'
17
-
18
- results, field_lists = SqlServer.helperqueries(insertsql)
19
-
20
- @insertID = results[1][0][0] #get *first* result from *second* query
21
- end
22
-
23
- def delete_message
24
- result = SqlServer.helperquery("delete from Messages where Messageid = #{@insertID}")
25
- end
26
-
27
- Given /^I have a message that says "([^"]*)" waiting for me$/ do |arg1|
28
- insert_message
29
- end
30
-
@@ -1,13 +0,0 @@
1
- Feature: Login
2
- In order to log into my app
3
- As my app's personnel
4
- I want to put in my user name and password
5
-
6
- @firefox
7
- Scenario: Log in
8
- Given I enter my username
9
- And I enter my password
10
- When I press Continue
11
- Then I should see the environment link
12
- And I select the environment link
13
-
@@ -1,33 +0,0 @@
1
- # if you have trouble finding a button using the text of the button
2
- # in either firefox or ie, try using the id
3
- When /^I press login$/ do
4
- login = find_by_id 'loginid'
5
- login.click
6
- end
7
-
8
-
9
- Given /^I enter my username$/ do
10
- fill_in 'Username', :with => $workingAppUser
11
- end
12
-
13
- Given /^I enter my password$/ do
14
- fill_in 'Password', :with => $workingAppPW
15
- end
16
-
17
- Then /^I should see the environment link$/ do
18
- page.should have_content($workingEnvLink)
19
- end
20
-
21
- Then /^I select the environment link$/ do
22
- click_link $workingEnvLink
23
- end
24
-
25
- Given /^I am logged in$/ do
26
- steps %Q{
27
- Given I enter my username
28
- And I enter my password
29
- When I press Continue
30
- Then I should see the environment link
31
- And I select the environment link
32
- }
33
- end
@@ -1,2 +0,0 @@
1
- class <%= name.capitalize %>
2
- end
@@ -1,5 +0,0 @@
1
- require 'cucumber/rake/task'
2
-
3
- Cucumber::Rake::Task.new do |t|
4
- t.cucumber_opts = "--format pretty"
5
- end
@@ -1,40 +0,0 @@
1
- require 'sqlserver'
2
-
3
- # example use
4
- # insertsql||=[]
5
- # insertsql[0]= <<-eos
6
- # INSERT INTO [Messages]
7
- # ([Message])
8
- # VALUES
9
- # ('Do your hours')
10
- # eos
11
- # insertsql[1]= 'select @@IDENTITY'
12
- # results, field_lists = SqlServer.helperqueries(insertsql)
13
- # @insertID = results[1][0][0] #get *first* result from *second* query
14
-
15
- class SqlServer
16
-
17
- #multiple statements need an array
18
- #don't error out on statements that don't return anything
19
- def self.helperqueries(sql=[])
20
- return [],[] if sql.empty?
21
-
22
- db = SqlServer.new($workingDBServer, $workingDBUser, $workingDBPW)
23
- db.open($workingDB)
24
- data, field_lists = db.queries(sql)
25
- db.close
26
- return data, field_lists
27
- end
28
-
29
-
30
- def self.helperquery(sql)
31
- db = SqlServer.new($workingDBServer, $workingDBUser, $workingDBPW)
32
- db.open($workingDB)
33
- db.query(sql)
34
- field_names = db.fields
35
- data = db.data
36
- db.close
37
- return data, field_names
38
- end
39
- end
40
-
@@ -1,118 +0,0 @@
1
- require 'win32ole'
2
-
3
- # example use
4
- # db = SqlServer.new
5
- # db.open
6
- # db.query("SELECT PLAYER FROM PLAYERS WHERE TEAM = 'REDS';")
7
- # field_names = db.fields
8
- # players = db.data
9
- # db.close
10
-
11
- class SqlServer
12
-
13
- # This class manages database connection and queries
14
- attr_accessor :connection, :data, :fields
15
- attr_writer :username, :password
16
-
17
- def initialize(host, username = 'sa', password='')
18
- @connection = nil
19
- @data = nil
20
- @host = host
21
- @username = username
22
- @password = password
23
- end
24
-
25
- def open(database)
26
- # Open ADO connection to the SQL Server database
27
- connection_string = "Provider=SQLOLEDB.1;"
28
- connection_string << "Persist Security Info=False;"
29
- connection_string << "User ID=#{@username};"
30
- connection_string << "password=#{@password};"
31
- connection_string << "Initial Catalog=#{database};"
32
- connection_string << "Data Source=#{@host};"
33
- connection_string << "Network Library=dbmssocn"
34
- @connection = WIN32OLE.new('ADODB.Connection')
35
- @connection.Open(connection_string)
36
- end
37
-
38
- def queries(sql=[])
39
- # debugger
40
- return [],[] if sql.empty?
41
-
42
- results ||=[]
43
- field_lists ||=[]
44
- # debugger
45
- sql.each do |s|
46
- result, fields = query_field_data(s)
47
- results << result
48
- field_lists << fields
49
- end
50
- return results, field_lists
51
- end
52
-
53
-
54
- def query_field_data(sql)
55
- # Create an instance of an ADO Recordset
56
- recordset = WIN32OLE.new('ADODB.Recordset')
57
- # Open the recordset, using an SQL statement and the
58
- # existing ADO connection
59
- recordset.Open(sql, @connection)
60
- # Create and populate an array of field names
61
- # debugger
62
- fields = []
63
- recordset.Fields.each do |field|
64
- fields << field.Name
65
- end
66
- begin
67
- # Move to the first record/row, if any exist
68
- recordset.MoveFirst
69
- # Grab all records
70
- data = recordset.GetRows
71
- # record only needs to be closed if movefirst doesn't cause an error
72
- recordset.Close
73
- rescue
74
- data = []
75
- end
76
-
77
- # An ADO Recordset's GetRows method returns an array
78
- # of columns, so we'll use the transpose method to
79
- # convert it to an array of rows
80
- data = data.transpose
81
- return data, fields
82
- end
83
-
84
-
85
- def query(sql)
86
- # Create an instance of an ADO Recordset
87
- recordset = WIN32OLE.new('ADODB.Recordset')
88
- # Open the recordset, using an SQL statement and the
89
- # existing ADO connection
90
- recordset.Open(sql, @connection)
91
- # Create and populate an array of field names
92
- # debugger
93
- @fields ||=[]
94
- recordset.Fields.each do |field|
95
- @fields << field.Name
96
- end
97
- begin
98
- # Move to the first record/row, if any exist
99
- recordset.MoveFirst
100
- # Grab all records
101
- @data = recordset.GetRows
102
- # record only needs to be closed if movefirst doesn't cause an error
103
- recordset.Close
104
- rescue
105
- @data = []
106
- end
107
- # An ADO Recordset's GetRows method returns an array
108
- # of columns, so we'll use the transpose method to
109
- # convert it to an array of rows
110
- @data = @data.transpose
111
- return @data, @fields
112
- end
113
-
114
- def close
115
- @connection.Close
116
- end
117
- end
118
-
@@ -1,77 +0,0 @@
1
- class BddLegacy < Thor::Group
2
- include Thor::Actions
3
-
4
- # Define arguments and options
5
- argument :name
6
- # class_option :test_framework, :default => :test_unit
7
-
8
- def self.source_root
9
- File.dirname(__FILE__)
10
- end
11
-
12
- def create_rake_file
13
- template('templates/rakefile.tt', "#{name}/rakefile.rb")
14
- end
15
-
16
- def create_example_feature_file
17
- template('templates/additions_feature.tt', "#{name}/features/additions.feature")
18
- end
19
-
20
- def create_login_feature_file
21
- template('templates/login_feature.tt', "#{name}/features/login.feature")
22
- end
23
-
24
- def create_landing_page_feature_file
25
- template('templates/landing_page_feature.tt', "#{name}/features/landing_page.feature")
26
- end
27
-
28
- def create_generic_steps_file
29
- template('templates/generic_browser_steps.tt', "#{name}/features/step_definitions/generic_browser_steps.rb")
30
- end
31
-
32
- def create_login_steps_file
33
- template('templates/login_steps.tt', "#{name}/features/step_definitions/login_steps.rb")
34
- end
35
-
36
- def create_landing_page_steps_file
37
- template('templates/landing_page_steps.tt', "#{name}/features/step_definitions/landing_page_steps.rb")
38
- end
39
-
40
- def create_example_steps_file
41
- template('templates/addition_steps.tt', "#{name}/features/step_definitions/addition_steps.rb")
42
- end
43
-
44
- def create_env_file
45
- template('templates/env.tt', "#{name}/features/support/env.rb")
46
- end
47
-
48
- def create_sqlserver_file
49
- template('templates/sqlserver.tt', "#{name}/lib/sqlserver.rb")
50
- end
51
-
52
- def create_sqlserver_wrapper_file
53
- template('templates/sqlhelper.tt', "#{name}/lib/sqlhelper.rb")
54
- end
55
-
56
- def create_example_code_file
57
- template('templates/calculator.tt', "#{name}/lib/calculator.rb")
58
- end
59
-
60
- # def create_feature_file
61
- # template('templates/features.tt', "#{name}/lib/#{name}.rb")
62
- # end
63
-
64
- # def create_test_file
65
- # test = options[:test_framework] == "rspec" ? :spec : :test
66
- # create_file "#{name}/#{test}/#{name}_#{test}.rb"
67
- # end
68
-
69
- # def copy_licence
70
- # if yes?("Use MIT license?")
71
- # Make a copy of the MITLICENSE file at the source root
72
- # copy_file "MITLICENSE", "#{name}/MITLICENSE"
73
- # else
74
- # say "Shame on you�", :red
75
- # end
76
- # end
77
- end
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/bdd-legacy.rb'}"
9
- puts "Loading bdd-legacy gem"
10
- exec "#{irb} #{libs} --simple-prompt"
@@ -1 +0,0 @@
1
- @ruby script/console %*
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -1 +0,0 @@
1
- @ruby script/destroy %*
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)
@@ -1 +0,0 @@
1
- @ruby script/generate %*