bdd-legacy 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.DS_Store +0 -0
- data/._.DS_Store +0 -0
- data/._Gemfile.lock +0 -0
- data/._bdd-legacy.gemspec +0 -0
- data/Gemfile +0 -2
- data/README.markdown +208 -0
- data/bdd-legacy.gemspec +3 -5
- data/bin/.DS_Store +0 -0
- data/bin/bdd-legacy +84 -84
- data/bin/templates/addition_steps.tt +15 -15
- data/bin/templates/additions_feature.tt +9 -9
- data/bin/templates/calculator.tt +17 -17
- data/bin/templates/env.tt +59 -53
- data/bin/templates/generic_browser_steps.tt +82 -65
- data/bin/templates/landing_page_feature.tt +22 -22
- data/bin/templates/landing_page_steps.tt +30 -30
- data/bin/templates/login_feature.tt +12 -12
- data/bin/templates/login_steps.tt +33 -33
- data/bin/templates/newgem.tt +1 -1
- data/bin/templates/rakefile.tt +5 -5
- data/bin/templates/sqlhelper.tt +40 -40
- data/bin/templates/sqlserver.tt +118 -118
- data/lib/.DS_Store +0 -0
- data/lib/._.DS_Store +0 -0
- data/lib/._bdd-legacy.rb +0 -0
- data/lib/bdd-legacy/._version.rb +0 -0
- data/lib/bdd-legacy/version.rb +1 -1
- metadata +63 -114
- data/bin/addition_steps.tt +0 -15
- data/bin/additions_feature.tt +0 -10
- data/bin/calculator.tt +0 -17
- data/bin/env.tt +0 -53
- data/bin/generic_browser_steps.tt +0 -66
- data/bin/landing_page_feature.tt +0 -23
- data/bin/landing_page_steps.tt +0 -30
- data/bin/login_feature.tt +0 -13
- data/bin/login_steps.tt +0 -33
- data/bin/newgem.tt +0 -2
- data/bin/rakefile.tt +0 -5
- data/bin/sqlhelper.tt +0 -40
- data/bin/sqlserver.tt +0 -118
- data/lib/templates/addition_steps.tt +0 -15
- data/lib/templates/additions_feature.tt +0 -10
- data/lib/templates/calculator.tt +0 -17
- data/lib/templates/env.tt +0 -53
- data/lib/templates/generic_browser_steps.tt +0 -66
- data/lib/templates/landing_page_feature.tt +0 -23
- data/lib/templates/landing_page_steps.tt +0 -30
- data/lib/templates/login_feature.tt +0 -13
- data/lib/templates/login_steps.tt +0 -33
- data/lib/templates/newgem.tt +0 -2
- data/lib/templates/rakefile.tt +0 -5
- data/lib/templates/sqlhelper.tt +0 -40
- data/lib/templates/sqlserver.tt +0 -118
@@ -1,10 +1,10 @@
|
|
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
|
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
10
|
Then the result should be 120 on the screen
|
data/bin/templates/calculator.tt
CHANGED
@@ -1,17 +1,17 @@
|
|
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
|
+
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/templates/env.tt
CHANGED
@@ -1,53 +1,59 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
|
-
require 'calculator'
|
3
|
-
require 'sqlserver'
|
4
|
-
require '
|
5
|
-
require 'capybara/cucumber'
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
Capybara.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Capybara.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
#
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
$
|
50
|
-
|
51
|
-
$
|
52
|
-
$
|
53
|
-
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
|
+
require 'calculator'
|
3
|
+
require 'sqlserver'
|
4
|
+
require 'sqlhelper'
|
5
|
+
require 'capybara/cucumber'
|
6
|
+
require 'rbconfig'
|
7
|
+
|
8
|
+
$isWindows = !((Config::CONFIG['host_os'] =~ /mswin|mingw/).nil?)
|
9
|
+
|
10
|
+
Capybara.run_server = false
|
11
|
+
|
12
|
+
Capybara.register_driver :selenium_firefox do |app|
|
13
|
+
Capybara::Driver::Selenium.new(app,:browser=>:firefox)
|
14
|
+
end
|
15
|
+
|
16
|
+
if $isWindows
|
17
|
+
Capybara.register_driver :selenium_ie do |app|
|
18
|
+
Capybara::Driver::Selenium.new(app,:browser=>:ie)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
Capybara.default_driver = :selenium_firefox
|
24
|
+
|
25
|
+
workingDBServerOpt||=
|
26
|
+
workingDBOpt||={}
|
27
|
+
workingEnvLinkOpt||={}
|
28
|
+
|
29
|
+
# change to :test or :dev or :local
|
30
|
+
$currentOpt=:local
|
31
|
+
|
32
|
+
#TODO change strings to import from yaml file
|
33
|
+
#TODO exclude yaml file from check-in
|
34
|
+
# the below server name will either be in the format of 'MYSERVERNAME' or 'MYSERVERNAME\DATABASEINSTANCE'
|
35
|
+
# depending on how your sql servr is set up
|
36
|
+
workingDBServerOpt={:dev => 'MYDEVDATABASESERVER',
|
37
|
+
:test => 'MYTESTDATABASESERVER',
|
38
|
+
:local => 'MYLOCALDATABASE'}
|
39
|
+
workingDBOpt={:dev => 'devdb',
|
40
|
+
:test => 'tstdb',
|
41
|
+
:local => 'devdb'}
|
42
|
+
# if you have a list of links after logging in with a single sign on account,
|
43
|
+
# you may also have a page of separate links for local/dev/test/prod etc
|
44
|
+
workingEnvLinkOpt = {:local => 'Welcome',
|
45
|
+
:dev => 'Welcome',
|
46
|
+
:test => 'Welcome'}
|
47
|
+
|
48
|
+
$workingDBServer = workingDBServerOpt[$currentOpt]
|
49
|
+
$workingDB = workingDBOpt[$currentOpt]
|
50
|
+
$workingAppUser='myapplicationusername'
|
51
|
+
$workingAppPW='myapplicationpw'
|
52
|
+
$workingDBUser='mydatabaseusername'
|
53
|
+
$workingDBPW='mydatabasepw'
|
54
|
+
# Change this to the domain of your web server. Don't add the full url
|
55
|
+
$workingAppHostLink='http://localhost'
|
56
|
+
# add the url of your login page
|
57
|
+
$workingAppLoginRoute='/welcome/logon.asp'
|
58
|
+
$workingEnvLink = workingEnvLinkOpt[$currentOpt]
|
59
|
+
|
@@ -1,66 +1,83 @@
|
|
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}']")
|
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 if $isWindows
|
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
|
67
|
+
|
68
|
+
Then /^I should see "([^"]*)" in a dropdown$/ do |arg1|
|
69
|
+
page.should have_xpath ("//option[text()='#{arg1}']")
|
70
|
+
end
|
71
|
+
|
72
|
+
Then /^I select "([^"]*)" from a dropdown$/ do |arg1|
|
73
|
+
# debugger
|
74
|
+
myselect = page.find(:xpath, "//select[option[text()='#{arg1}']]")
|
75
|
+
myoption = page.find(:xpath, "//option[text()='#{arg1}']")
|
76
|
+
# select(myoption, :from => myselect)
|
77
|
+
# select("#{arg1}")
|
78
|
+
myoption.select_option
|
79
|
+
end
|
80
|
+
|
81
|
+
Then /^I should not see "([^"]*)" in a dropdown$/ do |arg1|
|
82
|
+
page.should_not have_xpath ("//option[text()='#{arg1}']")
|
66
83
|
end
|
@@ -1,23 +1,23 @@
|
|
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
|
8
|
-
Given I am logged in
|
9
|
-
Then I should see "My App's greeting"
|
10
|
-
And I should see "Something
|
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
|
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
|
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
23
|
Then I should not see "Heyas"
|
@@ -1,30 +1,30 @@
|
|
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
|
+
After('@sql_insert_example') do |s|
|
2
|
+
delete_message if $isWindows
|
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 if $isWindows
|
29
|
+
end
|
30
|
+
|
@@ -1,13 +1,13 @@
|
|
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
|
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
13
|
|