diff --git a/.gitignore b/.gitignore index e735579..31f7722 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,10 @@ # Can ignore specific files .DS_Store +.gradle # Use wildcards as well # *~ # *.swp # Can also ignore all directories and files in a directory. -# tmp/**/* +# tmp/**/* \ No newline at end of file diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md new file mode 100644 index 0000000..6eee058 --- /dev/null +++ b/README.md @@ -0,0 +1,376 @@ +This proof of concept demonstrates using acceptance test frameworks to do web searches so that one can see different the different/similar implementations of layering: + + - cucumber + - concordion + - concordion.net + - FitLibraryWeb + +Tested on Mozilla 10 (OS X) (Note: concondion/webdriver has been known not to work on Mozilla 11 OS X) and Win 7 (for .net implementation) + +Cucumber +======== + +Also, you may want to look at [this tutorial](http://watir.com/2011/01/22/simple-cucumber-watir-page-object-pattern-framework/) +and [this blog series](http://www.cheezyworld.com/2010/12/16/ui-tests-putting-it-all-together/) + +Ensure that you are in the cucumber/ folder. + +Installation +------------ + +This code is written in ruby and tested on 1.8.7 + + $ ruby -v + ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin10.0] + +You will also require the installation of the following GEMS via the commands: + + gem install rake + gem install rspec + gem install watir-webdriver + gem install cucumber + + $ gem list + + *** LOCAL GEMS *** + + childprocess (0.3.1, 0.1.9) + cucumber (1.1.8, 0.3.97, 0.2.3, 0.1.12, 0.1.10) + multi_json (1.0.4) + rake (0.8.7, 0.8.3) + rspec (2.6.0, 1.3.0, 1.2.8, 1.2.2, 1.1.11, 1.1.8, 0.5.15) + rspec-core (2.6.3) + rspec-expectations (2.6.0) + rspec-mocks (2.6.0) + rspec_generator (0.5.15) + rubygems-update (1.3.6, 1.3.5, 1.3.1, 1.3.0) + selenium-webdriver (2.19.0, 0.2.0) + term-ansicolor (1.0.7, 1.0.4, 1.0.3) + watir-webdriver (0.5.3) + +Test using Rake +--------------- + + Ensure that you have rake installed and then to see the tests available, from the root directory run rake with the option to show tasks + + cucumber $ rake -T + + rake default # Run Cucumber features + rake prod # Run Cucumber features + +Sample run +---------- + + cucumber $ rake + + (in /Users/todd/Documents/src/AutomationTutorial) + /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I "/Library/Ruby/Gems/1.8/gems/cucumber-1.1.8/lib:lib" "/Library/Ruby/Gems/1.8/gems/cucumber-1.1.8/bin/cucumber" --profile default + Using the default profile... + Code: + * features/support/env.rb + * config/config_common.rb + * config/config_dev.rb + * features/pages/bing_search_page.rb + * features/pages/google_search_page.rb + * features/step_definitions/search_steps.rb + + Features: + * features/search.feature + Parsing feature files took 0m0.047s + + Feature: + Potential Assurity customers need to be able to find company information, services and address details when searching on the internet + + Scenario: # features/search.feature:4 + Given I am using google # features/step_definitions/search_steps.rb:1 + When I search for 'Assurity' # features/step_definitions/search_steps.rb:5 + Then the top result should be 'Assurity - Ensuring Software Health - Welcome' # features/step_definitions/search_steps.rb:10 + + Scenario: # features/search.feature:9 + Given I am using google # features/step_definitions/search_steps.rb:1 + When I search for 'test agile new zealand' # features/step_definitions/search_steps.rb:5 + Then the results include the text 'Assurity' # features/step_definitions/search_steps.rb:14 + + 2 scenarios (1 pending, 1 passed) + 6 steps (1 pending, 5 passed) + 0m8.368s + +Concordion +========== + +Ensure that you are in the concordion/ folder. + +Installation +------------ + +This code was written using Eclipse, java and gradle + +1. Ensure Eclipse is installed +2. Download [gradle](http://gradle.org/) and add to bin folder to your path (eg export PATH=/usr/local/gradle/bin:$PATH in ~/.profile) + +3. Test gradle installation + + concordion $ gradle tasks + The reportsDir property has been deprecated and will be removed in the next version of Gradle. Please use the reporting.baseDir property instead. + :tasks + + ------------------------------------------------------------ + All tasks runnable from root project + ------------------------------------------------------------ + + Build tasks + ----------- + assemble - Assembles all Jar, War, Zip, and Tar archives. + build - Assembles and tests this project. + buildDependents - Assembles and tests this project and all projects that depend on it. + buildNeeded - Assembles and tests this project and all projects it depends on. + classes - Assembles the main classes. + clean - Deletes the build directory. + jar - Assembles a jar archive containing the main classes. + testClasses - Assembles the test classes. + + Documentation tasks + ------------------- + groovydoc - Generates Groovydoc API documentation for the main source code. + javadoc - Generates Javadoc API documentation for the main source code. + + Help tasks + ---------- + dependencies - Displays the dependencies of root project 'concordion'. + help - Displays a help message + projects - Displays the sub-projects of root project 'concordion'. + properties - Displays the properties of root project 'concordion'. + tasks - Displays the tasks runnable from root project 'concordion' (some of the displayed tasks may belong to subprojects). + + IDE tasks + --------- + cleanEclipse - Cleans all Eclipse files. + eclipse - Generates all Eclipse files. + + Verification tasks + ------------------ + check - Runs all checks. + test - Runs the unit tests. + + Rules + ----- + Pattern: build: Assembles the artifacts of a configuration. + Pattern: upload: Assembles and uploads the artifacts belonging to a configuration. + Pattern: clean: Cleans the output files of a task. + + To see all tasks and more detail, run with --all. + + BUILD SUCCESSFUL + + Total time: 5.658 secs + + +4. From the root of the project, prepare for loading in Eclipse. + + $ cd concordion/ + concordion $ gradle eclipse + $ gradle eclipse + The reportsDir property has been deprecated and will be removed in the next version of Gradle. Please use the reporting.baseDir property instead. + :eclipseClasspath + :eclipseJdt + :eclipseProject + :eclipse + + BUILD SUCCESSFUL + + Total time: 9.625 secs + +5. Load into Eclipse workspace: + + Import > Existing Projects into Workspace > Select root directory > Finish + +Sample run +---------- + +Run tests from Eclipse + + Run as JUnit Tests + +Run tests from gradle (commandline) + + concordion $ gradle test + + :compileJava UP-TO-DATE + :compileGroovy UP-TO-DATE + :processResources UP-TO-DATE + :classes UP-TO-DATE + :compileTestJava UP-TO-DATE + :compileTestGroovy UP-TO-DATE + :processTestResources UP-TO-DATE + :testClasses UP-TO-DATE + :test + + BUILD SUCCESSFUL + + Total time: 1 mins 43.695 secs + +Concordion.net +============== + +Ensure that you are in the concordion.net/ folder (and running in .net) + +Installation +------------ + +Ensure that you have [.NET Framework 4](http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17851) installed, +with either Visual Studio or [Microsoft Windows SDK for Windows 7 and .NET Framework 4](http://www.microsoft.com/download/en/details.aspx?displayLang=en&id=8279). + +You will also need to install the Gallio runner (from the tools folder of this package). + +The Concordion output location is set in the file src/concordion.spec/Concordion.Spec.Config (currently set to /results director in the proj folder). The format of this config file is documented at http://code.google.com/p/concordion-net/wiki/ConfigurationFile. + +Sample Run +---------- + +Run from commandline or from GUI. + + > run-spec-with-echo.cmd + + Microsoft (R) Build Engine Version 4.0.30319.1 + [Microsoft .NET Framework, Version 4.0.30319.1] + Copyright (C) Microsoft Corporation 2007. All rights reserved. + + Build started 1/03/2012 9:33:29 p.m.. + Project "Z:\Documents\src\AutomationTutorial\concordion.net\Concordion.sln" on + node 1 (default targets). + ValidateSolutionConfiguration: + Building solution configuration "Release|Any CPU". + Project "Z:\Documents\src\AutomationTutorial\concordion.net\Concordion.sln" (1) + is building "Z:\Documents\src\AutomationTutorial\concordion.net\src\concordion + .spec\Concordion.Spec.csproj" (2) on node 1 (default targets). + GenerateTargetFrameworkMonikerAttribute: + Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output fi + les are up-to-date with respect to the input files. + CoreCompile: + Skipping target "CoreCompile" because all output files are up-to-date with resp + ect to the input files. + _CopyOutOfDateSourceItemsToOutputDirectory: + Skipping target "_CopyOutOfDateSourceItemsToOutputDirectory" because all output + files are up-to-date with respect to the input files. + _CopyOutOfDateSourceItemsToOutputDirectoryAlways: + Copying file from "Z:\Documents\src\AutomationTutorial\concordion.net\src\con + cordion.spec\Google\AssuritySearch.html" to "bin\Release\Google\AssuritySearch. + html". + CopyFilesToOutputDirectory: + Concordion.Spec -> Z:\Documents\src\AutomationTutorial\concordion.net\src\con + cordion.spec\bin\Release\Concordion.Spec.dll + Done Building Project "Z:\Documents\src\AutomationTutorial\concordion.net\src\c + oncordion.spec\Concordion.Spec.csproj" (default targets). + + Done Building Project "Z:\Documents\src\AutomationTutorial\concordion.net\Conco + rdion.sln" (default targets). + + + Build succeeded. + 0 Warning(s) + 0 Error(s) + + Time Elapsed 00:00:00.48 + !!! You must have Gallio installed and have Gallio.Echo.exe in the PATH to run t + his batch file !!! + + Gallio Echo - Version 3.2 build 744 + Get the latest version at http://www.gallio.org/ + + Start time: 9:31 p.m. + Initializing the runtime and loading plugins. + Verifying test files. + Initializing the test runner. + Running the tests. + [failed] Fixture Concordion.Spec/AssuritySearchTest + Disposing the test runner. + Stop time: 9:31 p.m. (Total execution time: 23.486 seconds) + + 1 run, 0 passed, 1 failed, 0 inconclusive, 0 skipped + + +The Concordion specification output will be in the folder results\Concordion\Spec\Google\AssuritySearchPage.html + + start /results/ + + +FitLibraryWeb +============= + +FitLibraryWeb has been picked over Fitnesse or Slim because it provides a DSL for interacting with web pages. It will demonstrate the layering of the wiki pages with out the complexity of writing fixtures. Without it, you would use the the Java or C# implementation of the Google search and result page classes. + +Ensure that you are in the fitlibraryweb/ folder. + +Installation +------------ + +This code was tested on java version 1.6 + + $ java -version + java version "1.6.0_29" + Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527) + Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode) + +Run the installation script. This will download a prepackaged fitnesse, update the wiki, start Fitnesse and open a browser at the correct page. + + fitlibraryweb $ chmod +x install.sh + fitlibraryweb $ install.sh + $ ./install.sh + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed + 100 43.1M 100 43.1M 0 0 131k 0 0:05:34 0:05:34 --:--:-- 336k + Archive: Fitnesse-Apr2011.zip + inflating: Fitnesse-Apr2011/build.xml + inflating: Fitnesse-Apr2011/fitlibrary.jar + inflating: Fitnesse-Apr2011/FitLibraryLogger.properties + inflating: Fitnesse-Apr2011/fitnesse.jar + creating: Fitnesse-Apr2011/FitNesseRoot/ + ... + inflating: Fitnesse-Apr2011/log4j.properties + inflating: Fitnesse-Apr2011/releaseWebREAD-ME.html + inflating: Fitnesse-Apr2011/run.bat + + FitNesse (v20110104) Started... + port: 8980 + root page: fitnesse.wiki.FileSystemPage at ./FitNesseRoot + logger: none + authenticator: fitnesse.authentication.PromiscuousAuthenticator + html page factory: fitnesse.html.HtmlPageFactory + page version expiration set to 0 days. + +This will also open a browser that you should then refresh and press the test button! + +Sample run via browser +-------------------------- + +Ensure that have run the installation and you should be at the sample google page. The test will use the Spider Fixture. + + fitlibraryweb $ chmod +x ./run-test.sh + fitlibraryweb $ ./run-test.sh + +This will open the browser and run the test in the browser + +Sample run via commandline +-------------------------- + + fitlibraryweb $ chmod +x run-test.sh + fitlibraryweb $ ./run-test.sh + + FitNesse (v20110104) Started... + port: 9123 + root page: fitnesse.wiki.FileSystemPage at ./FitNesseRoot + logger: none + authenticator: fitnesse.authentication.PromiscuousAuthenticator + html page factory: fitnesse.html.HtmlPageFactory + page version expiration set to 14 days. + Executing command: FitLibraryWeb.SpiderFixture.TestAssurity?test&format=text + -----Command Output----- + + Starting Test System: fit using fitlibrary.suite.FitLibraryServer. + . 13:57:37 R:10 W:0 I:0 E:0 TestAssurity (FitLibraryWeb.SpiderFixture.TestAssurity) 12.829 seconds + -------- + 1 Tests, 0 Failures 15.046 seconds. + 0 + Exit-Code: 0 + + \ No newline at end of file diff --git a/answers/Rakefile b/answers/Rakefile deleted file mode 100755 index 9eed8a1..0000000 --- a/answers/Rakefile +++ /dev/null @@ -1,11 +0,0 @@ -require 'rubygems' -require 'cucumber' -require 'cucumber/rake/task' - -Cucumber::Rake::Task.new(:default) do |t| - t.profile = :default -end - -Cucumber::Rake::Task.new(:prod) do |t| - t.profile = :prod -end diff --git a/answers/config/config_dev.rb b/answers/config/config_dev.rb deleted file mode 100755 index d144d81..0000000 --- a/answers/config/config_dev.rb +++ /dev/null @@ -1,5 +0,0 @@ -$config.merge!( -{ -"google_search_page_location" => "http://www.google.co.nz", "bing_search_page_location" => "http://nz.bing.com" -} -) \ No newline at end of file diff --git a/answers/features/pages/bing_search_page.rb b/answers/features/pages/bing_search_page.rb deleted file mode 100755 index b91a252..0000000 --- a/answers/features/pages/bing_search_page.rb +++ /dev/null @@ -1,20 +0,0 @@ -require File.join(File.dirname(__FILE__), 'search_page') - -class BingSearchPage < SearchPage - - def set_search(text) - @browser.text_field(:id => "sb_form_q").set(text) - end - - def click_search_button - @browser.button(:id => "sb_form_go").click - end - - def should_contain?(text) - wait_for_div('results') - found = @browser.text.include? text - found.should == true - end - -end - diff --git a/answers/features/pages/google_search_page.rb b/answers/features/pages/google_search_page.rb deleted file mode 100755 index d706f79..0000000 --- a/answers/features/pages/google_search_page.rb +++ /dev/null @@ -1,40 +0,0 @@ -require File.join(File.dirname(__FILE__), 'search_page') - -class GoogleSearchPage < SearchPage - - def set_search(text) - @browser.text_field(:name, /q/).set(text) - end - - def click_search_button - @browser.button(:name, /btnG/).click - end - - def top_result_contains(text) - wait_for_div('ires') - @browser.div(:id, 'ires').links[0].text.should == text - end - - def should_contain?(text) - wait_for_div('ires') - found = @browser.text.include? text - found.should == true - end - - def has_map? - wait_for_div('ires') - s = false - @browser.images.each do |image| - s = true if image.class_name.downcase.match(/map/i) - end - - s.should == true - end - - def results - wait_for_div('ires') - @browser.div(:id, 'ires').ol.lis.count - end - -end - diff --git a/answers/features/pages/search_page.rb b/answers/features/pages/search_page.rb deleted file mode 100755 index 84a05ff..0000000 --- a/answers/features/pages/search_page.rb +++ /dev/null @@ -1,21 +0,0 @@ -class SearchPage - def initialize (browser, site) - @browser = browser - @site = site - end - - def open - @browser.goto(@site) - end - - def wait_for_div(id) - i = 0 - while !@browser.div(:id => id).exists? do - raise 'Can not locate element' if i >= 10 - i = i + 1 - sleep 1 - end - end - -end - diff --git a/answers/features/search.feature b/answers/features/search.feature deleted file mode 100755 index b953b35..0000000 --- a/answers/features/search.feature +++ /dev/null @@ -1,45 +0,0 @@ -Feature: -Potential Assurity customers need to be able to find company information, services and address details when searching on the internet - -Scenario: - Given I am using google - When I search for 'Assurity' - Then the top result should be 'Assurity - Ensuring Software Health - Welcome' - -Scenario: - Given I am using google - When I search for 'test agile new zealand' - Then the results include the text 'Assurity' - -Scenario: - Given I am using google - When I search for 'assurity auckland address' - Then the results include the text 'Auckland Level 3, Dilworth Building' - -Scenario: - Given I am using google - When I search for 'assurity wellington address' - Then the results include the text 'Majestic Centre, 100 Willis Street' - -Scenario: - Given I am using bing - When I search for 'Assurity' - Then the results include the text 'Assurity - Ensuring Software Health - Welcome' - -Scenario: - Given I am using bing - When I search for 'test agile new zealand' - Then the results include the text 'Assurity' - -Scenario Outline: Search for adresss by city - Given I am using google - When I search for - Then the results include the text - - Examples: - | search_text | result_text | - | 'assurity wellington address' | 'Majestic Centre, 100 Willis Street' | - | 'assurity auckland address' | 'Auckland Level 3, Dilworth Building' | - - - diff --git a/answers/features/step_definitions/search_steps.rb b/answers/features/step_definitions/search_steps.rb deleted file mode 100755 index 9d22cd4..0000000 --- a/answers/features/step_definitions/search_steps.rb +++ /dev/null @@ -1,23 +0,0 @@ -Given /^I am using google$/ do - @search_page = google_search_page - @search_page.open -end - -Given /^I am using bing$/ do - @search_page = bing_search_page - @search_page.open -end - -When /^I search for '(.*)'$/ do |text| - @search_page.set_search(text) - @search_page.click_search_button -end - -Then /^the top result should be '(.*)'$/ do |text| - @search_page.top_result_contains(text) -end - -Then /^the results include the text '(.*)'$/ do |text| - @search_page.should_contain?(text) -end - diff --git a/concordion.net/.gitignore b/concordion.net/.gitignore new file mode 100644 index 0000000..a775d59 --- /dev/null +++ b/concordion.net/.gitignore @@ -0,0 +1,52 @@ +#OS junk files +[Tt]humbs.db +*.DS_Store + +#Visual Studio files +*.suo +*.[Oo]bj +*.user +*.aps +*.pch +*.vspscc +*.vssscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.[Cc]ache +*.ilk +*.log +*.lib +*.sbr +*.sdf +*.opensdf +*.unsuccessfulbuild +ipch/ +obj/ +[Bb]in +[Dd]ebug*/ +[Rr]elease*/ +Ankh.NoLoad +# Test results +results/ + +#Tooling +_ReSharper*/ +*.resharper +[Tt]est[Rr]esult* + +#Project files +[Bb]uild/ + +#Subversion files +.svn + +# Office Temp Files +~$* + +#NuGet +packages/ \ No newline at end of file diff --git a/concordion.net/Concordion.sln b/concordion.net/Concordion.sln new file mode 100644 index 0000000..893c781 --- /dev/null +++ b/concordion.net/Concordion.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Concordion.Spec", "src\concordion.spec\Concordion.Spec.csproj", "{78C35958-361C-4373-BC37-B2727832D069}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {78C35958-361C-4373-BC37-B2727832D069}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78C35958-361C-4373-BC37-B2727832D069}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78C35958-361C-4373-BC37-B2727832D069}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78C35958-361C-4373-BC37-B2727832D069}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/concordion.net/lib/Gallio-Concordion-Adapter/Concordion.config b/concordion.net/lib/Gallio-Concordion-Adapter/Concordion.config new file mode 100644 index 0000000..1d2e6f3 --- /dev/null +++ b/concordion.net/lib/Gallio-Concordion-Adapter/Concordion.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/concordion.net/lib/Gallio-Concordion-Adapter/Concordion.dll b/concordion.net/lib/Gallio-Concordion-Adapter/Concordion.dll new file mode 100644 index 0000000..130dce4 Binary files /dev/null and b/concordion.net/lib/Gallio-Concordion-Adapter/Concordion.dll differ diff --git a/concordion.net/lib/Gallio-Concordion-Adapter/Concordion.pdb b/concordion.net/lib/Gallio-Concordion-Adapter/Concordion.pdb new file mode 100644 index 0000000..81723fa Binary files /dev/null and b/concordion.net/lib/Gallio-Concordion-Adapter/Concordion.pdb differ diff --git a/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdapter.dll b/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdapter.dll new file mode 100644 index 0000000..0fa34df Binary files /dev/null and b/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdapter.dll differ diff --git a/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdapter.pdb b/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdapter.pdb new file mode 100644 index 0000000..be492d7 Binary files /dev/null and b/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdapter.pdb differ diff --git a/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdapter.xml b/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdapter.xml new file mode 100644 index 0000000..26aab80 --- /dev/null +++ b/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdapter.xml @@ -0,0 +1,141 @@ + + + + Gallio.ConcordionAdapter + + + + + + + + + + Initializes a new instance of the class. + + The name. + The code element. + The type info. + The resource. + The fixture type. + + + + Gets or sets the type info. + + The type info. + + + + Gets or sets the resource. + + The resource. + + + + Gets or sets the fixture. + + The fixture. + + + + Gets or sets the source. + + The source. + + + + Gets or sets the target. + + The target. + + + + Controls the execution of Concordion tests + + + + + + + + Explores an assembly for Concordion tests + + + + + Builds a test object model, based on Concordion attributes using reflection + + + + + + + + Adapts type information for Concordion + + + + + Initializes a new instance of the class. + + The target. + + + + Gets or sets the target. + + The target. + + + + Attaches the HTML specification that concordion outputs to the Gallio result + + + + + Handles the SpecificationProcessing event that is triggered before the specification is processed + + The sender. + The instance containing the event data. + + + + Handles the SpecificationProcessed event that is triggered after the specification is processed + + The sender. + The instance containing the event data. + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to Running Concordion Tests .... + + + + + Looks up a localized string similar to Concordion v{0}. + + + + + Looks up a localized string similar to Concordion. + + + + diff --git a/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdaptor.plugin b/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdaptor.plugin new file mode 100644 index 0000000..b0fc86f --- /dev/null +++ b/concordion.net/lib/Gallio-Concordion-Adapter/Gallio.ConcordionAdaptor.plugin @@ -0,0 +1,33 @@ + + + + Concordion Adapter + 1.0.0.0 + Provides support for running Concordion tests. + + + + + + + + + + + + + + + + Concordion + Assembly + Concordion + + + + diff --git a/concordion.net/lib/Gallio-Concordion-Adapter/OGNL.dll b/concordion.net/lib/Gallio-Concordion-Adapter/OGNL.dll new file mode 100644 index 0000000..d335a90 Binary files /dev/null and b/concordion.net/lib/Gallio-Concordion-Adapter/OGNL.dll differ diff --git a/concordion.net/lib/WebDriver/Castle.Core.dll b/concordion.net/lib/WebDriver/Castle.Core.dll new file mode 100644 index 0000000..af61d76 Binary files /dev/null and b/concordion.net/lib/WebDriver/Castle.Core.dll differ diff --git a/concordion.net/lib/WebDriver/Ionic.Zip.dll b/concordion.net/lib/WebDriver/Ionic.Zip.dll new file mode 100644 index 0000000..95fa928 Binary files /dev/null and b/concordion.net/lib/WebDriver/Ionic.Zip.dll differ diff --git a/concordion.net/lib/WebDriver/Newtonsoft.Json.dll b/concordion.net/lib/WebDriver/Newtonsoft.Json.dll new file mode 100644 index 0000000..7fe2c74 Binary files /dev/null and b/concordion.net/lib/WebDriver/Newtonsoft.Json.dll differ diff --git a/concordion.net/lib/WebDriver/Selenium.WebDriverBackedSelenium.dll b/concordion.net/lib/WebDriver/Selenium.WebDriverBackedSelenium.dll new file mode 100644 index 0000000..7f4825c Binary files /dev/null and b/concordion.net/lib/WebDriver/Selenium.WebDriverBackedSelenium.dll differ diff --git a/concordion.net/lib/WebDriver/ThoughtWorks.Selenium.Core.dll b/concordion.net/lib/WebDriver/ThoughtWorks.Selenium.Core.dll new file mode 100644 index 0000000..dbfd267 Binary files /dev/null and b/concordion.net/lib/WebDriver/ThoughtWorks.Selenium.Core.dll differ diff --git a/concordion.net/lib/WebDriver/WebDriver.Support.dll b/concordion.net/lib/WebDriver/WebDriver.Support.dll new file mode 100644 index 0000000..3cf982c Binary files /dev/null and b/concordion.net/lib/WebDriver/WebDriver.Support.dll differ diff --git a/concordion.net/lib/WebDriver/WebDriver.dll b/concordion.net/lib/WebDriver/WebDriver.dll new file mode 100644 index 0000000..3fcb29c Binary files /dev/null and b/concordion.net/lib/WebDriver/WebDriver.dll differ diff --git a/concordion.net/run-spec-with-echo.cmd b/concordion.net/run-spec-with-echo.cmd new file mode 100644 index 0000000..0c0facc --- /dev/null +++ b/concordion.net/run-spec-with-echo.cmd @@ -0,0 +1,15 @@ +@echo off + +:: Ensure msbuild is on path +set PATH=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319;%PATH% + +:: Build in Release configuration +set config=Release + +:: this will pickup the solution file +msbuild /p:Configuration=%config% + +echo !!! You must have Gallio installed and have Gallio.Echo.exe in the PATH to run this batch file !!! + +Gallio.Echo.exe /pd:lib\Gallio-Concordion-Adapter /hd:lib\Gallio-Concordion-Adapter /runner:Local /wd:. src\concordion.spec\bin\%config%\Concordion.Spec.dll +pause \ No newline at end of file diff --git a/concordion.net/src/concordion.spec/Concordion.Spec.Config b/concordion.net/src/concordion.spec/Concordion.Spec.Config new file mode 100755 index 0000000..c698bf8 --- /dev/null +++ b/concordion.net/src/concordion.spec/Concordion.Spec.Config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/concordion.net/src/concordion.spec/Concordion.Spec.csproj b/concordion.net/src/concordion.spec/Concordion.Spec.csproj new file mode 100644 index 0000000..ef53c72 --- /dev/null +++ b/concordion.net/src/concordion.spec/Concordion.Spec.csproj @@ -0,0 +1,104 @@ + + + + Release + AnyCPU + 8.0.30703 + 2.0 + {78C35958-361C-4373-BC37-B2727832D069} + Library + Properties + Concordion.Spec + Concordion.Spec + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\lib\WebDriver\Castle.Core.dll + + + False + ..\..\lib\Gallio-Concordion-Adapter\Concordion.dll + + + ..\..\lib\Gallio-Concordion-Adapter\Gallio.ConcordionAdapter.dll + + + ..\..\lib\WebDriver\Ionic.Zip.dll + + + ..\..\lib\WebDriver\Newtonsoft.Json.dll + + + False + ..\..\lib\Gallio-Concordion-Adapter\OGNL.dll + + + ..\..\lib\WebDriver\Selenium.WebDriverBackedSelenium.dll + + + + + + + + + + ..\..\lib\WebDriver\ThoughtWorks.Selenium.Core.dll + + + ..\..\lib\WebDriver\WebDriver.dll + + + ..\..\lib\WebDriver\WebDriver.Support.dll + + + + + + + + + + + + Always + + + + + PreserveNewest + + + + + PreserveNewest + + + + + \ No newline at end of file diff --git a/concordion.net/src/concordion.spec/Google/AssuritySearch.html b/concordion.net/src/concordion.spec/Google/AssuritySearch.html new file mode 100644 index 0000000..581c31b --- /dev/null +++ b/concordion.net/src/concordion.spec/Google/AssuritySearch.html @@ -0,0 +1,24 @@ + + + + +

Search results on Assurity

+ +

Potential Assurity customers need to be able to find company information, services and address details when searching on the internet

+ +

Scenario:

+

+ Given I am using google
+ When I search for Assurity
+ Then the results include the text Assurity - Ensuring Software Health - Welcome +

+ +

Scenario:

+

+ Given I am using google
+ When I search for test agile new zealand
+ Then the results include the text Agile Testing Training Courses in Auckland New Zealand +

+ + + \ No newline at end of file diff --git a/concordion.net/src/concordion.spec/Google/AssuritySearchTest.cs b/concordion.net/src/concordion.spec/Google/AssuritySearchTest.cs new file mode 100644 index 0000000..6652065 --- /dev/null +++ b/concordion.net/src/concordion.spec/Google/AssuritySearchTest.cs @@ -0,0 +1,18 @@ +using System; +using Concordion.Integration; +using Concordion.Spec.Provider; + +namespace Concordion.Spec.Google +{ + [ConcordionTest] + public class AssuritySearchTest : DriverFixture + { + + public String ResultFor(string provider, string keywords) + { + var searchPage = new GoogleSearchPage(WebDriver); + var resultsPage = searchPage.SearchFor(keywords); + return resultsPage.Results(); + } + } +} \ No newline at end of file diff --git a/concordion.net/src/concordion.spec/Google/DriverFixture.cs b/concordion.net/src/concordion.spec/Google/DriverFixture.cs new file mode 100644 index 0000000..428d964 --- /dev/null +++ b/concordion.net/src/concordion.spec/Google/DriverFixture.cs @@ -0,0 +1,17 @@ +using System; +using OpenQA.Selenium; +using OpenQA.Selenium.Firefox; + +namespace Concordion.Spec.Google +{ + public class DriverFixture : IDisposable + { + protected readonly IWebDriver WebDriver = new FirefoxDriver(); + + public void Dispose() + { + // TODO: unsure why this isn't getting called - tb, feb 2012 + WebDriver.Quit(); + } + } +} \ No newline at end of file diff --git a/concordion.net/src/concordion.spec/Properties/AssemblyInfo.cs b/concordion.net/src/concordion.spec/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0e50cc4 --- /dev/null +++ b/concordion.net/src/concordion.spec/Properties/AssemblyInfo.cs @@ -0,0 +1,38 @@ +using System.Reflection; +using System.Runtime.InteropServices; +using Concordion.Integration; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Concordion")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Goneopen Limited")] +[assembly: AssemblyProduct("Concordion")] +[assembly: AssemblyCopyright("Copyright © goneopen 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4fba4522-d0ed-4e10-98f5-6090d0bf707d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: ConcordionAssembly] \ No newline at end of file diff --git a/concordion.net/src/concordion.spec/Provider/GoogleResultsPage.cs b/concordion.net/src/concordion.spec/Provider/GoogleResultsPage.cs new file mode 100644 index 0000000..2684f36 --- /dev/null +++ b/concordion.net/src/concordion.spec/Provider/GoogleResultsPage.cs @@ -0,0 +1,45 @@ +/** + * Code ported from java from https://bitbucket.org/twoten/opensourcetesting + * todd@goneopen.com 2012 + */ + +using System; +using System.Linq; +using OpenQA.Selenium; +using OpenQA.Selenium.Support.UI; + +namespace Concordion.Spec.Provider +{ + public class GoogleResultsPage + { + private readonly By _results = By.Id("res"); + private readonly By _headings = By.Id("s"); + private readonly By _footer = By.Id("foot"); + private readonly By _links = By.ClassName("r"); + + private readonly IWebDriver _webDriver; + + public GoogleResultsPage(IWebDriver webDriver) + { + _webDriver = webDriver; + waitForFooter(); + } + + public bool ResultsContain(string text) + { + var resultsText = _webDriver.FindElement(_results).FindElements(_headings); + return resultsText.Any(result => result.Text.Contains(text)); + } + + public string Results() + { + return _webDriver.FindElement(_links).Text; + } + + private void waitForFooter() + { + var wait = new WebDriverWait(_webDriver, TimeSpan.FromSeconds(30)); + wait.Until(ExpectedConditions.ElementIsVisible(_footer)); + } + } +} diff --git a/concordion.net/src/concordion.spec/Provider/GoogleSearchPage.cs b/concordion.net/src/concordion.spec/Provider/GoogleSearchPage.cs new file mode 100644 index 0000000..5fab66b --- /dev/null +++ b/concordion.net/src/concordion.spec/Provider/GoogleSearchPage.cs @@ -0,0 +1,26 @@ +/** + * Code ported from java from https://bitbucket.org/twoten/opensourcetesting + * todd@goneopen.com 2012 + */ +using OpenQA.Selenium; + +namespace Concordion.Spec.Provider +{ + public class GoogleSearchPage + { + private readonly IWebDriver _webDriver; + private readonly By _queryBox = By.Name("q"); + + public GoogleSearchPage(IWebDriver webDriver) + { + _webDriver = webDriver; + webDriver.Navigate().GoToUrl("http://google.com"); + } + + public GoogleResultsPage SearchFor(string queryString) + { + _webDriver.FindElement(_queryBox).SendKeys(queryString); + return new GoogleResultsPage(_webDriver); + } + } +} diff --git a/concordion.net/src/concordion.spec/concordion.css b/concordion.net/src/concordion.spec/concordion.css new file mode 100755 index 0000000..a6e4429 --- /dev/null +++ b/concordion.net/src/concordion.spec/concordion.css @@ -0,0 +1,81 @@ +* { + font-family: Arial; +} +body { + padding: 32px; +} +pre { + padding: 6px 28px 6px 28px; + background-color: #E8EEF7; +} +pre, pre *, code, kbd { + font-family: Courier New, Courier; + font-size: 10pt; +} +h1, h1 * { + font-size: 24pt; +} +p, td, th, li, .breadcrumbs { + font-size: 10pt; +} +p, li { + line-height: 140%; +} +table { + border-collapse: collapse; + empty-cells: show; + margin: 8px 0px 8px 0px; +} +th, td { + border: 1px solid black; + padding: 3px; +} +td { + background-color: white; + vertical-align: top; +} +th { + background-color: #C3D9FF; +} +li { + margin-top: 6px; + margin-bottom: 6px; +} + + +.example { + padding: 2px 12px 6px 12px; + border: 1px solid #C3D9FF; + margin: 6px 0px 28px 0px; + background-color: #F5F9FD; +} +.example h3 { + margin-top: 8px; + margin-bottom: 8px; + font-size: 12pt; +} + +.special { + font-style: italic; +} + +.idea { + font-size: 9pt; + color: #888; + font-style: italic; +} +.tight li { + margin-top: 1px; + margin-bottom: 1px; +} +.commentary { + float: right; + width: 200px; + background-color: #ffffd0; + padding:8px; + border: 3px solid #eeeeb0; + margin: 10px 0px 10px 10px; +} +.commentary, .commentary * { + font-size: 8pt; +} \ No newline at end of file diff --git a/concordion.net/tools/GallioBundle-3.2.517.0-Setup-x86.msi b/concordion.net/tools/GallioBundle-3.2.517.0-Setup-x86.msi new file mode 100644 index 0000000..d8776c9 Binary files /dev/null and b/concordion.net/tools/GallioBundle-3.2.517.0-Setup-x86.msi differ diff --git a/concordion/.gitignore b/concordion/.gitignore new file mode 100644 index 0000000..c3e3786 --- /dev/null +++ b/concordion/.gitignore @@ -0,0 +1,8 @@ +.settings +.gradle +.settings +.classpath +.project +build +bin +results \ No newline at end of file diff --git a/concordion/build.gradle b/concordion/build.gradle new file mode 100644 index 0000000..21e219e --- /dev/null +++ b/concordion/build.gradle @@ -0,0 +1,21 @@ +apply plugin: 'java' +apply plugin: 'groovy' +apply plugin: 'eclipse' + +sourceCompatibility = 1.6 + +repositories { + mavenCentral() +} + +dependencies { + testCompile 'junit:junit:4.8.2' + testCompile 'org.concordion:concordion:1.4.2' + testCompile "org.seleniumhq.selenium:selenium-java:2.14.0" +} + +test { + include '**/*Test.*' + //systemProperties['concordion.output.dir'] = "$reporting.baseDir/spec" + systemProperties['concordion.output.dir'] = "results" +} \ No newline at end of file diff --git a/concordion/src/test/java/base/DriverFixture.java b/concordion/src/test/java/base/DriverFixture.java new file mode 100755 index 0000000..4c4f1d1 --- /dev/null +++ b/concordion/src/test/java/base/DriverFixture.java @@ -0,0 +1,20 @@ +package base; + +import org.junit.After; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.firefox.FirefoxDriver; + +public class DriverFixture { + + private WebDriver driver; + + protected WebDriver getDriver() { + driver = new FirefoxDriver(); + return driver; + } + + @After + public void close() { + driver.close(); + } +} diff --git a/concordion/src/test/java/google/search/AssuritySearchTest.java b/concordion/src/test/java/google/search/AssuritySearchTest.java new file mode 100644 index 0000000..409d35b --- /dev/null +++ b/concordion/src/test/java/google/search/AssuritySearchTest.java @@ -0,0 +1,22 @@ +package google.search; + +import nz.co.twoten.driver.google.GoogleResultsPage; +import nz.co.twoten.driver.google.GoogleSearchPage; + +import org.concordion.integration.junit4.ConcordionRunner; +import org.junit.runner.RunWith; +import org.openqa.selenium.WebDriver; + +import base.DriverFixture; + +@RunWith(ConcordionRunner.class) +public class AssuritySearchTest extends DriverFixture { + + private WebDriver driver = getDriver(); + + public String resultFor(String searchProvider, String keywords) { + GoogleSearchPage searchPage = new GoogleSearchPage(driver); + GoogleResultsPage resultsPage = searchPage.searchFor(keywords); + return resultsPage.getResult(); + } +} \ No newline at end of file diff --git a/concordion/src/test/java/nz/co/twoten/driver/google/GoogleResultsPage.java b/concordion/src/test/java/nz/co/twoten/driver/google/GoogleResultsPage.java new file mode 100755 index 0000000..3b6af95 --- /dev/null +++ b/concordion/src/test/java/nz/co/twoten/driver/google/GoogleResultsPage.java @@ -0,0 +1,73 @@ +/** + * Code from https://bitbucket.org/twoten/opensourcetesting + */ +package nz.co.twoten.driver.google; + +import java.util.List; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +/** + * A WebDriver Page Object corresponding to the Google Results Page. + */ +public class GoogleResultsPage { + + @FindBy(id = "res") + private WebElement resultWrapper; + + @FindBy(className = "l") + private WebElement firstResultLink; + + @FindBy(className = "r") + private WebElement resultLink; + + private final WebDriver driver; + + /** + * Initialises the results page and waits for the page to fully load. + * Assumes that the results page is already loading. + */ + public GoogleResultsPage(WebDriver driver) { + this.driver = driver; + PageFactory.initElements(driver, this); + waitForFooter(); + } + + /** + * Checks whether the specified text occurs in any result on the results page. + */ + public boolean resultsContain(String text) { + List resultsText = resultWrapper.findElements(By.className("s")); + for (WebElement result : resultsText) { + if (result.getText().contains(text)) { + return true; + } + } + return false; + } + + /** + * Returns the text of the topmost result from the results page. + */ + public String getTopResultTitle() { + return firstResultLink.getText(); + } + + /** + * Returns the text of the calculator result from the results page. + */ + public String getResult() { + return resultLink.getText(); + } + + private void waitForFooter() { + WebDriverWait wait = new WebDriverWait(driver, 30); + wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("foot"))); + } +} \ No newline at end of file diff --git a/concordion/src/test/java/nz/co/twoten/driver/google/GoogleSearchPage.java b/concordion/src/test/java/nz/co/twoten/driver/google/GoogleSearchPage.java new file mode 100755 index 0000000..76843e7 --- /dev/null +++ b/concordion/src/test/java/nz/co/twoten/driver/google/GoogleSearchPage.java @@ -0,0 +1,40 @@ +/** + * Code from https://bitbucket.org/twoten/opensourcetesting + */ +package nz.co.twoten.driver.google; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; + +/** + * A WebDriver Page Object corresponding to the Google Search Page. + */ +public class GoogleSearchPage { + + @FindBy(name = "q") + private WebElement queryBox; + + private final WebDriver driver; + + /** + * Opens the Google Search Page. + */ + public GoogleSearchPage(WebDriver webDriver) { + this.driver = webDriver; + PageFactory.initElements(driver, this); + driver.get("http://www.google.com"); + } + + /** + * Searches for the specified string and opens the results page, + * waiting for the page to fully load. + */ + public GoogleResultsPage searchFor(String query) { + queryBox.clear(); + queryBox.sendKeys(query); + queryBox.submit(); + return new GoogleResultsPage(driver); + } +} \ No newline at end of file diff --git a/concordion/src/test/resources/concordion.css b/concordion/src/test/resources/concordion.css new file mode 100644 index 0000000..6c99af9 --- /dev/null +++ b/concordion/src/test/resources/concordion.css @@ -0,0 +1,81 @@ +* { + font-family: Arial; +} +body { + padding: 32px; +} +pre { + padding: 6px 28px 6px 28px; + background-color: #E8EEF7; +} +pre, pre *, code, code *, kbd { + font-family: Courier New, Courier; + font-size: 10pt; +} +h1, h1 * { + font-size: 24pt; +} +p, td, th, li, .breadcrumbs { + font-size: 10pt; +} +p, li { + line-height: 140%; +} +table { + border-collapse: collapse; + empty-cells: show; + margin: 8px 0px 8px 0px; +} +th, td { + border: 1px solid black; + padding: 3px; +} +td { + background-color: white; + vertical-align: top; +} +th { + background-color: #C3D9FF; +} +li { + margin-top: 6px; + margin-bottom: 6px; +} + + +.example { + padding: 2px 12px 6px 12px; + border: 1px solid #C3D9FF; + margin: 6px 0px 28px 0px; + background-color: #F5F9FD; +} +.example h3 { + margin-top: 8px; + margin-bottom: 8px; + font-size: 12pt; +} + +.special { + font-style: italic; +} + +.idea { + font-size: 9pt; + color: #888; + font-style: italic; +} +.tight li { + margin-top: 1px; + margin-bottom: 1px; +} +.commentary { + float: right; + width: 200px; + background-color: #ffffd0; + padding:8px; + border: 3px solid #eeeeb0; + margin: 10px 0px 10px 10px; +} +.commentary, .commentary * { + font-size: 8pt; +} \ No newline at end of file diff --git a/concordion/src/test/resources/google/search/AssuritySearch.html b/concordion/src/test/resources/google/search/AssuritySearch.html new file mode 100644 index 0000000..4f92e5b --- /dev/null +++ b/concordion/src/test/resources/google/search/AssuritySearch.html @@ -0,0 +1,24 @@ + + + + +

Search results on Assurity

+ +

Potential Assurity customers need to be able to find company information, services and address details when searching on the internet

+ +

Scenario:

+

+ Given I am using google
+ When I search for Assurity
+ Then the results include the text Assurity - Ensuring Software Health - Welcome +

+ +

Scenario:

+

+ Given I am using google
+ When I search for test agile new zealand
+ Then the results include the text Agile Testing Training Courses in Auckland New Zealand +

+ + + \ No newline at end of file diff --git a/config/config_common.rb b/config/config_common.rb deleted file mode 100755 index 66179c2..0000000 --- a/config/config_common.rb +++ /dev/null @@ -1 +0,0 @@ -$config = {} \ No newline at end of file diff --git a/cucumber.yml b/cucumber.yml deleted file mode 100755 index cdbe5d5..0000000 --- a/cucumber.yml +++ /dev/null @@ -1 +0,0 @@ -default: --format pretty -v -r config/config_common.rb -r config/config_dev.rb -r features \ No newline at end of file diff --git a/Rakefile b/cucumber/Rakefile similarity index 100% rename from Rakefile rename to cucumber/Rakefile diff --git a/answers/config/config_common.rb b/cucumber/config/config_common.rb similarity index 100% rename from answers/config/config_common.rb rename to cucumber/config/config_common.rb diff --git a/config/config_dev.rb b/cucumber/config/config_dev.rb similarity index 100% rename from config/config_dev.rb rename to cucumber/config/config_dev.rb diff --git a/answers/cucumber.yml b/cucumber/cucumber.yml similarity index 100% rename from answers/cucumber.yml rename to cucumber/cucumber.yml diff --git a/features/pages/google_search_page.rb b/cucumber/features/pages/google_search_page.rb similarity index 100% rename from features/pages/google_search_page.rb rename to cucumber/features/pages/google_search_page.rb diff --git a/features/search.feature b/cucumber/features/search.feature similarity index 100% rename from features/search.feature rename to cucumber/features/search.feature diff --git a/features/step_definitions/search_steps.rb b/cucumber/features/step_definitions/search_steps.rb similarity index 100% rename from features/step_definitions/search_steps.rb rename to cucumber/features/step_definitions/search_steps.rb diff --git a/answers/features/support/env.rb b/cucumber/features/support/env.rb similarity index 66% rename from answers/features/support/env.rb rename to cucumber/features/support/env.rb index 06cc3e5..8800a0e 100755 --- a/answers/features/support/env.rb +++ b/cucumber/features/support/env.rb @@ -13,7 +13,7 @@ browser.close rescue nil end -class AssurityWorld +class SearchWorld public def google_search_page @@ -21,13 +21,8 @@ def google_search_page return @google_search_page end - def bing_search_page - @bing_search_page ||= BingSearchPage.new(@browser, $config["bing_search_page_location"]) - return @bing_search_page - end - end World do - AssurityWorld.new + SearchWorld.new end diff --git a/features/pages/bing_search_page.rb b/features/pages/bing_search_page.rb deleted file mode 100755 index 3447574..0000000 --- a/features/pages/bing_search_page.rb +++ /dev/null @@ -1,4 +0,0 @@ -class BingSearchPage - -end - diff --git a/features/support/env.rb b/features/support/env.rb deleted file mode 100755 index 06cc3e5..0000000 --- a/features/support/env.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'rubygems' -require 'watir-webdriver' -require 'rspec' - -browser = Watir::Browser.new(:firefox) - -Before do - @browser = browser -end - -at_exit do - sleep 3 - browser.close rescue nil -end - -class AssurityWorld - - public - def google_search_page - @google_search_page ||= GoogleSearchPage.new(@browser, $config["google_search_page_location"]) - return @google_search_page - end - - def bing_search_page - @bing_search_page ||= BingSearchPage.new(@browser, $config["bing_search_page_location"]) - return @bing_search_page - end - -end - -World do - AssurityWorld.new -end diff --git a/fitlibraryweb/.gitignore b/fitlibraryweb/.gitignore new file mode 100644 index 0000000..384f318 --- /dev/null +++ b/fitlibraryweb/.gitignore @@ -0,0 +1 @@ +Fitnesse* \ No newline at end of file diff --git a/fitlibraryweb/install.sh b/fitlibraryweb/install.sh new file mode 100755 index 0000000..8f44929 --- /dev/null +++ b/fitlibraryweb/install.sh @@ -0,0 +1,6 @@ +curl -O https://www.socialtext.net/data/workspaces/install/attachments/fitnesse_install_and_setup:20110503222247-0-2772/original/Fitnesse-Apr2011.zip +unzip Fitnesse-Apr2011.zip +mv Fitnesse-Apr2011 Fitnesse +cp -R wiki/SpiderFixture Fitnesse/FitNesseRoot/FitLibraryWeb +./open-test.sh +./start.sh \ No newline at end of file diff --git a/fitlibraryweb/open-test.sh b/fitlibraryweb/open-test.sh new file mode 100755 index 0000000..cabcef7 --- /dev/null +++ b/fitlibraryweb/open-test.sh @@ -0,0 +1 @@ +open http://localhost:8980/FitLibraryWeb.SpiderFixture.TestAssurity \ No newline at end of file diff --git a/fitlibraryweb/run-test.sh b/fitlibraryweb/run-test.sh new file mode 100755 index 0000000..f014bb0 --- /dev/null +++ b/fitlibraryweb/run-test.sh @@ -0,0 +1,2 @@ +cd Fitnesse +java -jar fitnesse.jar -c "FitLibraryWeb.SpiderFixture.TestAssurity?test&format=text" \ No newline at end of file diff --git a/fitlibraryweb/start.sh b/fitlibraryweb/start.sh new file mode 100755 index 0000000..f036c1e --- /dev/null +++ b/fitlibraryweb/start.sh @@ -0,0 +1,2 @@ +cd Fitnesse +java -jar fitnesse.jar -o -p 8980 -e 0 \ No newline at end of file diff --git a/fitlibraryweb/wiki/SpiderFixture/TestAssurity/content.txt b/fitlibraryweb/wiki/SpiderFixture/TestAssurity/content.txt new file mode 100644 index 0000000..a8fc4da --- /dev/null +++ b/fitlibraryweb/wiki/SpiderFixture/TestAssurity/content.txt @@ -0,0 +1,19 @@ +|''with spider''| + +|''get url''|http://www.google.com| + +|''title''|'''is'''|Google| + +|''url''|'''is'''|http://www.google.co.nz/| + +|''page source''|'''contains'''|Search| + +|''with''|//input[@name="q"]|''set text''|Assurity| + +|''click''|//input[@name="btnG"]| + +|''title''|'''becomes'''|Assurity - Google Search| + +|''url''|'''contains'''|&q=Assurity| + +|''page source''|contains|Ensuring Software Health| diff --git a/fitlibraryweb/wiki/SpiderFixture/TestAssurity/properties.xml b/fitlibraryweb/wiki/SpiderFixture/TestAssurity/properties.xml new file mode 100644 index 0000000..e13fdf4 --- /dev/null +++ b/fitlibraryweb/wiki/SpiderFixture/TestAssurity/properties.xml @@ -0,0 +1,12 @@ + + + true + true + true + true + true + true + true + true + true + diff --git a/fitlibraryweb/wiki/SpiderFixture/content.txt b/fitlibraryweb/wiki/SpiderFixture/content.txt new file mode 100755 index 0000000..065da36 --- /dev/null +++ b/fitlibraryweb/wiki/SpiderFixture/content.txt @@ -0,0 +1,20 @@ +|^SpiderTutorial|''A tutorial on using SpiderFixture''| + +|^DocuMentation|''How to use SpiderFixture''| + +|^SpecifySpiderFixture|''Specifications of SpiderFixture''| + +|''Examples against web sites:''| +|^TestGoogle| +|^TestAssurity| +|^TestAmazon| +|^TestTemplateSuite| + + * A general fixture that's used by SpiderFixture for pattern matching on multiple lines: + +|^SpecifyMatchingStringFixture| + +!**< def +!define COLLAPSE_SETUP {true} +!define COLLAPSE_TEARDOWN {true} +*! \ No newline at end of file