From 92f58ba276426a81e1afb402bc356954ad7588ba Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sat, 1 Dec 2012 06:50:23 -0800 Subject: [PATCH 01/18] Initial commit --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..65bb52e --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +util +==== \ No newline at end of file From 61db356e4ccd25a5782997df0b80b277def1ad39 Mon Sep 17 00:00:00 2001 From: mengjuesh Date: Sat, 1 Dec 2012 23:10:41 +0800 Subject: [PATCH 02/18] test2 --- test.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 test.md diff --git a/test.md b/test.md new file mode 100644 index 0000000..44d9242 --- /dev/null +++ b/test.md @@ -0,0 +1,3 @@ +*** test +*** test2 +*** test3 \ No newline at end of file From 8abcbda1786c88444b5c65058bb3ee7084416215 Mon Sep 17 00:00:00 2001 From: mengjuesh Date: Sat, 1 Dec 2012 23:40:15 +0800 Subject: [PATCH 03/18] :qkjkjkj dddddddddddddddddddddddddddddddddd:q :q q :q --- test.html | 0 test2.html | 1 + 2 files changed, 1 insertion(+) create mode 100644 test.html create mode 100644 test2.html diff --git a/test.html b/test.html new file mode 100644 index 0000000..e69de29 diff --git a/test2.html b/test2.html new file mode 100644 index 0000000..718f4d2 --- /dev/null +++ b/test2.html @@ -0,0 +1 @@ +t From a7bf16e6d2ecfaaf8162aacb9453950e0cb476c3 Mon Sep 17 00:00:00 2001 From: mengjuesh Date: Sat, 1 Dec 2012 23:44:35 +0800 Subject: [PATCH 04/18] test-branch --- test3.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 test3.html diff --git a/test3.html b/test3.html new file mode 100644 index 0000000..df6b0d2 --- /dev/null +++ b/test3.html @@ -0,0 +1 @@ +test3 From 3561fbf38ca7a9bb5c925062b8ba5a3882ff2847 Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sun, 21 Jul 2013 02:37:12 +0800 Subject: [PATCH 05/18] Update and rename test.html to maven_advanced.md --- maven_advanced.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++ test.html | 0 2 files changed, 68 insertions(+) create mode 100644 maven_advanced.md delete mode 100644 test.html diff --git a/maven_advanced.md b/maven_advanced.md new file mode 100644 index 0000000..da0cc84 --- /dev/null +++ b/maven_advanced.md @@ -0,0 +1,68 @@ +###Profile + +利用多个profile分离开发、测试和产品环境: + +``` + + + + development + + true + + + + profile-development.properties + + + + + production + + + profile-production.properties + + + + + +``` + +###Filter功能 + +来自于Maven Resource Plugin,利用项目属性或者系统属性的值来替代项目资源文件的值(比如properties、xml文件等): + ++ -Duser.name=foo ++ ${user.name}将会被替换为foo + +```xml + + + + src/main/resource + true + + + +``` + ++ 利用项目里的属性值 + +```xml + + + foo + foo@bar.com + + +``` + +```xml + + + + project.properties + + + +``` diff --git a/test.html b/test.html deleted file mode 100644 index e69de29..0000000 From da1abd42a968e027c07dffc79430ada3b221a1f1 Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sun, 21 Jul 2013 02:37:40 +0800 Subject: [PATCH 06/18] Update maven_advanced.md --- maven_advanced.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven_advanced.md b/maven_advanced.md index da0cc84..e4349a6 100644 --- a/maven_advanced.md +++ b/maven_advanced.md @@ -2,7 +2,7 @@ 利用多个profile分离开发、测试和产品环境: -``` +```xml From 3f5fa188218fa7ec330952c62ac78ca7fc28d4da Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sun, 21 Jul 2013 03:41:38 +0800 Subject: [PATCH 07/18] Update and rename README.md to cucumber-jvm.md --- README.md | 2 -- cucumber-jvm.md | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 README.md create mode 100644 cucumber-jvm.md diff --git a/README.md b/README.md deleted file mode 100644 index 65bb52e..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -util -==== \ No newline at end of file diff --git a/cucumber-jvm.md b/cucumber-jvm.md new file mode 100644 index 0000000..2c11a72 --- /dev/null +++ b/cucumber-jvm.md @@ -0,0 +1,4 @@ +How to run Cucumber-jvm from commandline: + +http://stackoverflow.com/questions/11466040/cucumber-jvm-ant-task + From 5092b37351f390ec87cb22ca50c63c8cfe2e51d4 Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sun, 21 Jul 2013 03:41:56 +0800 Subject: [PATCH 08/18] Update cucumber-jvm.md --- cucumber-jvm.md | 1 - 1 file changed, 1 deletion(-) diff --git a/cucumber-jvm.md b/cucumber-jvm.md index 2c11a72..2c33362 100644 --- a/cucumber-jvm.md +++ b/cucumber-jvm.md @@ -1,4 +1,3 @@ How to run Cucumber-jvm from commandline: - http://stackoverflow.com/questions/11466040/cucumber-jvm-ant-task From 009071ce5feb8e2a6bafe12c815d0b5bc3bf609e Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sun, 21 Jul 2013 03:42:17 +0800 Subject: [PATCH 09/18] Update cucumber-jvm.md --- cucumber-jvm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cucumber-jvm.md b/cucumber-jvm.md index 2c33362..f734dc2 100644 --- a/cucumber-jvm.md +++ b/cucumber-jvm.md @@ -1,3 +1,3 @@ -How to run Cucumber-jvm from commandline: +How to run Cucumber-jvm from commandline: http://stackoverflow.com/questions/11466040/cucumber-jvm-ant-task From 43d6e89ddbded35e1d57be5870b49053a0e3509b Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sun, 21 Jul 2013 03:56:33 +0800 Subject: [PATCH 10/18] Update cucumber-jvm.md --- cucumber-jvm.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cucumber-jvm.md b/cucumber-jvm.md index f734dc2..c857c69 100644 --- a/cucumber-jvm.md +++ b/cucumber-jvm.md @@ -1,3 +1,10 @@ How to run Cucumber-jvm from commandline: http://stackoverflow.com/questions/11466040/cucumber-jvm-ant-task +Take Screenshot in Cucumber: +http://stackoverflow.com/questions/16160200/take-a-screenshot-with-cucumber + +Cucumber want to quit when any test case fails: +http://stackoverflow.com/questions/15272523/what-is-the-cucumber-jvm-equivalent-of-cucumber-wants-to-quit + + From 7c9b8498b6587ca49296e6f6db3c2c19f92d0655 Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sun, 21 Jul 2013 04:12:41 +0800 Subject: [PATCH 11/18] Update cucumber-jvm.md --- cucumber-jvm.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cucumber-jvm.md b/cucumber-jvm.md index c857c69..33cc2ad 100644 --- a/cucumber-jvm.md +++ b/cucumber-jvm.md @@ -7,4 +7,11 @@ http://stackoverflow.com/questions/16160200/take-a-screenshot-with-cucumber Cucumber want to quit when any test case fails: http://stackoverflow.com/questions/15272523/what-is-the-cucumber-jvm-equivalent-of-cucumber-wants-to-quit +Embed screenshot into test: +http://rlogiacco.blogspot.com/2012/10/embedding-screenshots-in-cucumber-jvm.html +Slideshare: +http://www.slideshare.net/search/slideshow?searchfrom=header&q=cucumber-jvm + +Speakdeck: +https://speakerdeck.com/search?q=cucumber-jvm From 1dacebaadfd363e8e21a80b15141fd4939f667b4 Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sun, 21 Jul 2013 12:37:42 +0800 Subject: [PATCH 12/18] Update cucumber-jvm.md --- cucumber-jvm.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cucumber-jvm.md b/cucumber-jvm.md index 33cc2ad..3654fc4 100644 --- a/cucumber-jvm.md +++ b/cucumber-jvm.md @@ -15,3 +15,30 @@ http://www.slideshare.net/search/slideshow?searchfrom=header&q=cucumber-jvm Speakdeck: https://speakerdeck.com/search?q=cucumber-jvm + +How to run cucumber-jvm from command line: +https://groups.google.com/forum/#!topic/cukes/9EqBYV3FJc8 + +```java +D:\maven_repo\info\cukes\cucumber-core\1.1.3>java -cp D:/maven_repo/info/cukes/cucumber-core/1.1.3/cucumber-core-1.1.3.jar;D:/maven_repo/info/cukes/cucumber-java/1.1.3/cucumber-java-1.1.3.jar cucumber.api.cli.Main --help +``` + +```java +Usage: java cucumber.api.cli.Main [options] [ [FILE|DIR][:LINE[:LINE]*] ]+ + +Options: + + -g, --glue PATH Where glue code (step definitions and hooks) is loaded from. + -f, --format FORMAT[:PATH_OR_URL] How to format results. Goes to STDOUT unless PATH_OR_URL is specified. + Available formats: junit, html, pretty, progress, json, json-pretty. + -t, --tags TAG_EXPRESSION Only run scenarios tagged with tags matching TAG_EXPRESSION. + -n, --name REGEXP Only run scenarios whose names match REGEXP. + -d, --[no-]-dry-run Skip execution of glue code. + -m, --[no-]-monochrome Don't colour terminal output. + -s, --[no-]-strict Treat undefined and pending steps as errors. + --dotcucumber PATH_OR_URL Where to write out runtime information. PATH_OR_URL can be a file system + path or a URL. + -v, --version Print version. + -h, --help You're looking at it. + +``` From c5e8e6c4ff01944a0ef5ceb725301188843d3897 Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sun, 21 Jul 2013 23:10:03 +0800 Subject: [PATCH 13/18] Update and rename test.md to selenium-framework.md --- selenium-framework.md | 22 ++++++++++++++++++++++ test.md | 3 --- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 selenium-framework.md delete mode 100644 test.md diff --git a/selenium-framework.md b/selenium-framework.md new file mode 100644 index 0000000..39b692c --- /dev/null +++ b/selenium-framework.md @@ -0,0 +1,22 @@ +*User Story* + +A user story is a limited set of funcaitonality that the team feels comfortable implementing over the course of a single +iteration. These are tiny slices through the functionality. Usually a team strives to implement several user stories in +one iteration. The business representive or product owner is responsible for defining stories. + +*Story Card* + +User stories are usually written on real cards. During the iteration, the cards are put onto the team's taskboard. + +*Refactoring* + +Refactoring is changing the structure of the source code without changing what it does. Usually I refactor codes before +introducing changes. By refactoring the code, I make the task of implementing the upcoming changes more easy. + +*TDD* + +In test-driven developement you write one single test that fails, write just enough code that make the failing test case +pass and all the other passed test case still passes. And then refactor your code to prepare it for the next tiny step. +TDD is a design approach and helps users write better code, because testable code is written by default. + +====== diff --git a/test.md b/test.md deleted file mode 100644 index 44d9242..0000000 --- a/test.md +++ /dev/null @@ -1,3 +0,0 @@ -*** test -*** test2 -*** test3 \ No newline at end of file From 886199de58b01a715938805c0857a07318f60881 Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sun, 21 Jul 2013 23:35:41 +0800 Subject: [PATCH 14/18] Update selenium-framework.md --- selenium-framework.md | 78 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/selenium-framework.md b/selenium-framework.md index 39b692c..c8b7593 100644 --- a/selenium-framework.md +++ b/selenium-framework.md @@ -19,4 +19,80 @@ In test-driven developement you write one single test that fails, write just eno pass and all the other passed test case still passes. And then refactor your code to prepare it for the next tiny step. TDD is a design approach and helps users write better code, because testable code is written by default. -====== +------ + +####Cucumber + ++ features ++ cucumber command ++ step definition + +####Gherkin + ++ title ++ free-form narrative ++ arbitrary number of scenarios ++ arbitrary number of steps + +####Features + +In Cucumber, a feature is a high-level requirement expressed from the perspective of a person or another computer +using the system. Features play a role similar to that of user stories in XP, but we take things a step further. + +*Title* + +few words that represent an activity for which a user may engage the system. + +*Narrative* + +The connextra format: + +```xml +As a +I want +So that +``` + +###Gherkin Keywords + ++ Feature ++ Background ++ Scenario ++ Scenario outline ++ Scenarios or examples ++ Given ++ Then ++ And or but ++ | (define tables) ++ `"""` define multiline string ++ # comment + +*Scenario* + +concrete example of how we want the system to behaviour. + +*Steps* + +Scenario use an arbitrary number of steps to describe everything that happen within a scenario. A step is generally a +single line of text that start with one of step keywords: Given, When, Then, And, But. + +###Cucumber command + +Cucumber command runs all the `*.feature` files below the features directories. + +*Tags* + +`cucumber --tags @wip` + +`cucumber --tags @foo, @bar` `@foo || @bar` + +`cucumber --tags @foo --tags @bar` `@foo && @bar` + +``` +cucumber --tags ~@foo +!@foo +``` + + + + From f21159a240b7e8402a950c5fc88ba5a8f62d6737 Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Sun, 21 Jul 2013 23:50:33 +0800 Subject: [PATCH 15/18] Update selenium-framework.md --- selenium-framework.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/selenium-framework.md b/selenium-framework.md index c8b7593..3938841 100644 --- a/selenium-framework.md +++ b/selenium-framework.md @@ -94,5 +94,14 @@ cucumber --tags ~@foo ``` +###Cucumber Details +*Step Definition* + +Argument + +If a step definition’s regular expression contains one or more capture groups, it will treat them as arguments +to the step definition’s block. + +World From b97d6a31f726317ef5f98504ad2ec7b33942c713 Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Mon, 22 Jul 2013 01:05:19 +0800 Subject: [PATCH 16/18] Update selenium-framework.md --- selenium-framework.md | 63 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/selenium-framework.md b/selenium-framework.md index 3938841..0c9490d 100644 --- a/selenium-framework.md +++ b/selenium-framework.md @@ -98,10 +98,69 @@ cucumber --tags ~@foo *Step Definition* -Argument +**Argument** If a step definition’s regular expression contains one or more capture groups, it will treat them as arguments to the step definition’s block. -World +**World** + +(https://groups.google.com/forum/#!topic/cukes/8ugcVreXP0Y) + +The purpose of a "World" is twofold: +1) Isolate state between scenarios. +2) share data between step definitions and hooks within a scenario. + +The equivalent of the World in Cucumber-Java is _all of the objects with hook or stepdef annotations_. +In other words, any class with methods annotated with @Before, @After, @Given and so on will be instantiated exactly +once for each scenario. + +a) Use a single class for all of your step definitions and hooks +b) Use several classes divided by responsibility [1] and use dependency injection [2] to connect them to each other. + +Option a) quickly breaks down because your step definition code becomes a mess. That's why people tend to use b). + +**Nested Steps** + +(https://groups.google.com/forum/#!topic/cukes/OUy9go8AsTo) + +refactor to common method + +*Hooks* + ++ Before ++ After ++ Executed before and after each scenario! + +**Tagged Hooks** + + + + + +DI Hooks: + + + + + + +*Background* + +Hooks in features files will be executed before each scenario. + +Before Hooks will run before Background hook. + +*Multiline Text* + +use `"""` + +*Table Values* + +When Cucumber sees a | at the beginning of a line following a line with a Step keyword, it parses that +and all subsequent lines beginning with | and stores the cell values in a Cucumber::Ast::Table object, which exposes +the data as an array of hashes via a hashes( ) method. + +*Scenario Outline* From 31b112de5244943b4bfb296a07fafabd4c2d8336 Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Mon, 22 Jul 2013 01:16:56 +0800 Subject: [PATCH 17/18] Update selenium-framework.md --- selenium-framework.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/selenium-framework.md b/selenium-framework.md index 0c9490d..8102d89 100644 --- a/selenium-framework.md +++ b/selenium-framework.md @@ -164,3 +164,31 @@ the data as an array of hashes via a hashes( ) method. *Scenario Outline* +Scenario outlines solve this problem by letting us define an outline for +a scenario once, with placeholders for the values that might change +from scenario to scenario. Then we can express the values in a tabular +format that is very easy to scan and get the whole picture: + +Cucumber supports Scenarios and Examples keywords to identify tabular data for a +scenario outline. Some users prefer to use Scenarios to avoid using words we use in RSpec, +but many people like to use Examples in order to better differentiate from the Scenario +keyword. Both do exactly the same thing, so the choice is a subjective one and yours to +make. + +*Configuration* + +Cucumber - command line options and switches. + ++ wip: --tags @wip features ++ profile (maven support) ++ dryRun (only parse gherkin files) + +Misc References: + + + + + + + + From 801cbd9acf0533900615664414cd5246767e1def Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Mon, 22 Jul 2013 01:19:48 +0800 Subject: [PATCH 18/18] Update and rename test2.html to JUnit-Report-Dev.md --- JUnit-Report-Dev.md | 8 ++++++++ test2.html | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 JUnit-Report-Dev.md delete mode 100644 test2.html diff --git a/JUnit-Report-Dev.md b/JUnit-Report-Dev.md new file mode 100644 index 0000000..54b11bb --- /dev/null +++ b/JUnit-Report-Dev.md @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test2.html b/test2.html deleted file mode 100644 index 718f4d2..0000000 --- a/test2.html +++ /dev/null @@ -1 +0,0 @@ -t