WAAT 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/.document +5 -0
  2. data/Gemfile +19 -0
  3. data/LICENSE.txt +13 -0
  4. data/README +1 -0
  5. data/README.rdoc +41 -0
  6. data/Rakefile +52 -0
  7. data/VERSION +1 -0
  8. data/WAAT.gemspec +95 -0
  9. data/features/WAAT-ruby.feature +19 -0
  10. data/features/step_definitions/WAAT-ruby_steps.rb +41 -0
  11. data/features/support/env.rb +42 -0
  12. data/features/support/hook.rb +34 -0
  13. data/lib/WAAT.rb +188 -0
  14. data/lib/WAAT/LICENSE.txt +13 -0
  15. data/lib/WAAT/docs/Jpcap_Install.html +131 -0
  16. data/lib/WAAT/docs/README +32 -0
  17. data/lib/WAAT/docs/README.rdoc +38 -0
  18. data/lib/WAAT/docs/WAAT Readme.doc +0 -0
  19. data/lib/WAAT/docs/WAAT Readme.docx +0 -0
  20. data/lib/WAAT/docs/WAAT Readme.html +2150 -0
  21. data/lib/WAAT/docs/WAAT Readme.pdf +0 -0
  22. data/lib/WAAT/lib/WAAT_v1.4.jar +0 -0
  23. data/lib/WAAT/lib/commons-lang-2.3.jar +0 -0
  24. data/lib/WAAT/lib/httpSniffer/Linux/jpcap-0.7-1.i386.rpm +0 -0
  25. data/lib/WAAT/lib/httpSniffer/Linux/jpcap-0.7.deb +0 -0
  26. data/lib/WAAT/lib/httpSniffer/Linux/libpcap-1.1.1.tar.gz +0 -0
  27. data/lib/WAAT/lib/httpSniffer/Windows/JpcapSetup-0.7.exe +0 -0
  28. data/lib/WAAT/lib/httpSniffer/Windows/System32/Jpcap.dll +0 -0
  29. data/lib/WAAT/lib/httpSniffer/Windows/System32/Packet.dll +0 -0
  30. data/lib/WAAT/lib/httpSniffer/Windows/System32/drivers/npf.sys +0 -0
  31. data/lib/WAAT/lib/httpSniffer/Windows/System32/pthreadVC.dll +0 -0
  32. data/lib/WAAT/lib/httpSniffer/Windows/System32/wpcap.dll +0 -0
  33. data/lib/WAAT/lib/httpSniffer/Windows/WinPcap_4_1_2.exe +0 -0
  34. data/lib/WAAT/lib/httpSniffer/jpcap.jar +0 -0
  35. data/lib/WAAT/lib/jpcap.jar +0 -0
  36. data/lib/WAAT/lib/log4j-1.2.16.jar +0 -0
  37. data/lib/WAAT/lib/xstream-1.3.1.jar +0 -0
  38. data/lib/WAAT/resources/log4j.properties +20 -0
  39. data/lib/WAAT/sampledata/TestData.xml +86 -0
  40. data/lib/WAAT/samplescripts/com/thoughtworks/webanalyticsautomation/scriptrunner/SeleniumScriptRunner.java +49 -0
  41. data/lib/WAAT/samplescripts/com/thoughtworks/webanalyticsautomation/scriptrunner/WebDriverScriptRunner.java +67 -0
  42. data/sampledata/TestData.xml +66 -0
  43. metadata +187 -0
Binary file
@@ -0,0 +1,20 @@
1
+ #
2
+ # Copyright 2010 Anand Bagmar (abagmar@gmail.com). Distributed under the Apache 2.0 License
3
+ #
4
+
5
+ log4j.rootLogger=, LogToConsole, LogToFile
6
+
7
+ # Console is set to be ConsoleAppender sending its output to System.out
8
+ log4j.appender.LogToConsole=org.apache.log4j.ConsoleAppender
9
+ log4j.appender.LogToConsole.threshold=INFO
10
+ log4j.appender.LogToConsole.layout=org.apache.log4j.PatternLayout
11
+ log4j.appender.LogToConsole.layout.ConversionPattern=%d %-5p [%t] %-17c{1} (%13F:%L) \n %3x - %m%n
12
+
13
+ # Appender File writes to the file "waat.log".
14
+ log4j.appender.LogToFile=org.apache.log4j.FileAppender
15
+ log4j.appender.LogToFile.File=waat.log
16
+ log4j.appender.LogToFile.threshold=INFO
17
+ log4j.appender.LogToFile.Append=true
18
+ log4j.appender.LogToFile.layout=org.apache.log4j.PatternLayout
19
+ log4j.appender.LogToFile.layout.ConversionPattern=%d %-5p [%t] %-17c{1} (%13F:%L) \n %3x - %m%n
20
+
@@ -0,0 +1,86 @@
1
+ <!--
2
+ Sample Test Specification File
3
+
4
+ * Created by: Anand Bagmar
5
+ * Email: abagmar@gmail.com
6
+ * Date: Dec 29, 2010
7
+ * Time: 4:29:12 PM
8
+ *
9
+ * Copyright 2010 Anand Bagmar (abagmar@gmail.com). Distributed under the Apache 2.0 License
10
+ -->
11
+
12
+ <!--
13
+ README for TestData specification
14
+
15
+ Section:
16
+ A set of test data which includes the actionName for which
17
+ the provided list of tags needs to be verified.
18
+
19
+ actionName:
20
+ A (String) name representing the action done in the UI,
21
+ for which we want to do Web Analytics Testing.
22
+
23
+ numberOfEventsTriggered:
24
+ The number of events that "should" be triggered for the
25
+ actionName specified.
26
+ The (numerical) value provided for this attribute indicates
27
+ the number of requests sent to the Web Analytic system for
28
+ the action.
29
+
30
+ tagList:
31
+ A delimited set of tags that you want to verify from any of
32
+ the requests sent to analytics tool on the action performed.
33
+ The tags specified are order independent, and case-SENSITIVE.
34
+
35
+ NOTE: If you are using OmnitureDebugger, the tags are seen
36
+ differently based on the UI Testing Framework being used.
37
+ This is because of the difference in the way JavaScript is
38
+ executed and results being interpreted by the individual
39
+ UI framework.
40
+
41
+ See the examples below for:
42
+ > actionName: OpenUpcomingPage_OmnitureDebugger_Selenium
43
+ > actionName: OpenUpcomingPage_OmnitureDebugger_WebDriver
44
+
45
+ delimiter:
46
+ A separator used to distinguish between tags.
47
+ || is the delimiter used in WAAT.
48
+ -->
49
+
50
+ <Sections>
51
+ <Section actionName="OpenUpcomingPage_OmnitureDebugger_Selenium"
52
+ numberOfEventsTriggered="1"
53
+ tagList="s.pageName = 'upcoming:index'||
54
+ s.eVar23 = 'upcoming:index'||
55
+ s.heir1 = 'upcoming'||
56
+ s.heir2 = 'index'||
57
+ s.channel = 'upcoming'||
58
+ s.eVar22 = 'upcoming'||
59
+ s.prop5 = 'anonymous'||
60
+ s.eVar5 = 'anonymous'||
61
+ s.prop4 = 'anonymous'||
62
+ s.eVar4 = 'anonymous'||
63
+ s.prop9 = 'all'||
64
+ s.eVar9 = 'all'||
65
+ s.events = 'event2'||"/>
66
+
67
+ <Section actionName="OpenUpcomingPage_OmnitureDebugger_WebDriver"
68
+ numberOfEventsTriggered="1"
69
+ tagList="pageName=upcoming:index||
70
+ cc=USD||
71
+ ch=upcoming||
72
+ events=event2||"/>
73
+
74
+ <Section actionName="OpenUpcomingPage_HttpSniffer"
75
+ numberOfEventsTriggered="1"
76
+ tagList="pageName=upcoming:index||
77
+ cc=USD||
78
+ ch=upcoming||
79
+ events=event2||"/>
80
+
81
+ <Section actionName="OpenWAATArticleOnBlog_HttpSniffer"
82
+ numberOfEventsTriggered="1"
83
+ tagList="caller=http://essenceoftesting.blogspot.com/2011/01/my-article-on-future-of-test-automation.html||
84
+ container=friendconnect||
85
+ parent=http://essenceoftesting.blogspot.com/||"/>
86
+ </Sections>
@@ -0,0 +1,49 @@
1
+ package com.thoughtworks.webanalyticsautomation.scriptrunner;
2
+
3
+ /**
4
+ * Created by: Anand Bagmar
5
+ * Email: abagmar@gmail.com
6
+ * Date: Dec 29, 2010
7
+ * Time: 9:34:02 AM
8
+ *
9
+ * Copyright 2010 Anand Bagmar (abagmar@gmail.com). Distributed under the Apache 2.0 License
10
+ */
11
+
12
+ import com.thoughtworks.selenium.Selenium;
13
+ import org.apache.log4j.Logger;
14
+
15
+ public class SeleniumScriptRunner implements ScriptRunner {
16
+ private Logger logger = Logger.getLogger(getClass());
17
+ private Selenium selenium;
18
+ private String CLOSE_DEBUGGER = "//input[@name='close2']";
19
+
20
+ public SeleniumScriptRunner(Selenium selenium) {
21
+ this.selenium = selenium;
22
+ }
23
+
24
+ public String getHTMLSourceByExecutingScript(String OMNITURE_DEBUGGER_URL, String OMNITURE_DEBUGGER_WINDOW_TITLE, String OMNITURE_DEBUGGER_URL_DECODE_CHECKBOX) {
25
+ try {
26
+ logger.info ("Running script: " + OMNITURE_DEBUGGER_URL);
27
+ selenium.runScript(OMNITURE_DEBUGGER_URL);
28
+
29
+ Thread.sleep(5000);
30
+ logger.debug("*** Debugger window title: " + selenium.getTitle());
31
+ selenium.selectWindow(OMNITURE_DEBUGGER_WINDOW_TITLE);
32
+ selenium.click(OMNITURE_DEBUGGER_URL_DECODE_CHECKBOX);
33
+ logger.debug("*** SeleniumScriptDebugger \n HTML source\n" + selenium.getHtmlSource());
34
+
35
+ } catch(Exception e)
36
+ {
37
+ logger.info ("NOT able to open " + OMNITURE_DEBUGGER_WINDOW_TITLE);
38
+ }
39
+ closeDebugger();
40
+ return selenium.getHtmlSource();
41
+ }
42
+
43
+ private void closeDebugger() {
44
+ logger.info ("Close Omniture Debugger.");
45
+ selenium.click(CLOSE_DEBUGGER);
46
+ logger.info ("Select parent window.");
47
+ selenium.selectWindow("");
48
+ }
49
+ }
@@ -0,0 +1,67 @@
1
+ package com.thoughtworks.webanalyticsautomation.scriptrunner;
2
+
3
+ import org.apache.log4j.Logger;
4
+ import org.openqa.selenium.By;
5
+ import org.openqa.selenium.JavascriptExecutor;
6
+ import org.openqa.selenium.WebDriver;
7
+ import org.openqa.selenium.WebElement;
8
+
9
+ import java.util.Set;
10
+
11
+ /**
12
+ * Created by: Anand Bagmar
13
+ * Email: abagmar@gmail.com
14
+ * Date: Jan 4, 2011
15
+ * Time: 10:38:37 AM
16
+ *
17
+ * Copyright 2010 Anand Bagmar (abagmar@gmail.com). Distributed under the Apache 2.0 License
18
+ */
19
+
20
+ public class WebDriverScriptRunner implements ScriptRunner {
21
+ private WebDriver webDriverInstance;
22
+ private Logger logger = Logger.getLogger(getClass());
23
+
24
+ public WebDriverScriptRunner(WebDriver webDriverInstance) {
25
+ this.webDriverInstance = webDriverInstance;
26
+ }
27
+
28
+ public String getHTMLSourceByExecutingScript(final String OMNITURE_DEBUGGER_URL, String OMNITURE_DEBUGGER_WINDOW_TITLE, String OMNITURE_DEBUGGER_URL_DECODE_CHECKBOX) {
29
+ String htmlSource = null;
30
+ String parentWindowHandle = webDriverInstance.getWindowHandle();
31
+ logger.debug("parentWindowHandle = " + parentWindowHandle);
32
+ logger.info ("Opening Omniture Debugger: " + OMNITURE_DEBUGGER_URL);
33
+ ((JavascriptExecutor) webDriverInstance).executeScript(OMNITURE_DEBUGGER_URL);
34
+ try{
35
+ boolean windowFound = false;
36
+ while(!windowFound){
37
+ Set<String> windowHandles = webDriverInstance.getWindowHandles();
38
+ for (String windowHandle: windowHandles){
39
+ logger.debug("windowHandle = " + windowHandle);
40
+ if (!windowHandle.equalsIgnoreCase(parentWindowHandle)) {
41
+ webDriverInstance = webDriverInstance.switchTo().window(windowHandle);
42
+ WebElement element = webDriverInstance.findElement(By.name(OMNITURE_DEBUGGER_URL_DECODE_CHECKBOX));
43
+ if (!element.isSelected()) {
44
+ logger.debug("checkbox not selected. clicking on it.");
45
+ element.click();
46
+ while (!element.isSelected()) {
47
+ logger.debug("checkbox status: " + element.isSelected());
48
+ Thread.sleep (3000);
49
+ }
50
+ }
51
+ Thread.sleep (3000);
52
+ htmlSource = webDriverInstance.getPageSource();
53
+ webDriverInstance.close();//child window closing
54
+ windowFound = true;
55
+ break;
56
+ }
57
+ }
58
+ }
59
+ }catch (Exception e){
60
+ e.printStackTrace();
61
+ }
62
+ webDriverInstance.switchTo().window(parentWindowHandle);
63
+ webDriverInstance.close();
64
+ logger.debug("WebDriver omniture debugger page source: \n" + htmlSource);
65
+ return htmlSource;
66
+ }
67
+ }
@@ -0,0 +1,66 @@
1
+ <!--
2
+ Sample Test Specification File
3
+
4
+ * Created by: Anand Bagmar
5
+ * Email: abagmar@gmail.com
6
+ * Date: Dec 29, 2010
7
+ * Time: 4:29:12 PM
8
+ *
9
+ * Copyright 2010 Anand Bagmar (abagmar@gmail.com). Distributed under the Apache 2.0 License
10
+ *
11
+ * http://essenceoftesting.blogspot.com/search/label/waat
12
+ * http://github.com/anandbagmar/WAAT-Ruby
13
+ * http://github.com/anandbagmar/WAAT
14
+ *
15
+ -->
16
+
17
+ <!--
18
+ README for TestData specification
19
+
20
+ Section:
21
+ A set of test data which includes the actionName for which
22
+ the provided list of tags needs to be verified.
23
+
24
+ actionName:
25
+ A (String) name representing the action done in the UI,
26
+ for which we want to do Web Analytics Testing.
27
+
28
+ numberOfEventsTriggered:
29
+ The number of events that "should" be triggered for the
30
+ actionName specified.
31
+ The (numerical) value provided for this attribute indicates
32
+ the number of requests sent to the Web Analytic system for
33
+ the action.
34
+
35
+ tagList:
36
+ A delimited set of tags that you want to verify from any of
37
+ the requests sent to analytics tool on the action performed.
38
+ The tags specified are order independent, and case-SENSITIVE.
39
+
40
+ NOTE: If you are using OmnitureDebugger, the tags are seen
41
+ differently based on the UI Testing Framework being used.
42
+ This is because of the difference in the way JavaScript is
43
+ executed and results being interpreted by the individual
44
+ UI framework.
45
+
46
+ See the examples below for:
47
+ > actionName: OpenUpcomingPage_OmnitureDebugger_Selenium
48
+ > actionName: OpenUpcomingPage_OmnitureDebugger_WebDriver
49
+
50
+ delimiter:
51
+ A separator used to distinguish between tags.
52
+ || is the delimiter used in WAAT.
53
+ -->
54
+
55
+ <Sections>
56
+ <Section actionName="WAAT_Success_Test"
57
+ numberOfEventsTriggered="1"
58
+ tagList="view=profile||
59
+ parent=http://essenceoftesting.blogspot.com||"/>
60
+
61
+ <Section actionName="WAAT_Failure_Test"
62
+ numberOfEventsTriggered="1"
63
+ tagList="caller=http://essenceoftesting.blogspot.com/2011/01/my-article-on-future-of-test-automation.html||
64
+ container=friendconnect||
65
+ parent=http://essenceoftesting.blogspot.com/||"/>
66
+ </Sections>
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: WAAT
3
+ version: !ruby/object:Gem::Version
4
+ hash: 7
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 4
9
+ - 0
10
+ version: 1.4.0
11
+ platform: ruby
12
+ authors:
13
+ - Anand Bagmar
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-07-28 00:00:00 +05:30
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ type: :runtime
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 23
29
+ segments:
30
+ - 1
31
+ - 0
32
+ - 0
33
+ version: 1.0.0
34
+ prerelease: false
35
+ name: bundler
36
+ requirement: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ type: :development
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 15
45
+ segments:
46
+ - 2
47
+ - 0
48
+ - 0
49
+ version: 2.0.0
50
+ prerelease: false
51
+ name: selenium-webdriver
52
+ requirement: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ type: :development
55
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ prerelease: false
65
+ name: cucumber
66
+ requirement: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ type: :development
69
+ version_requirements: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ hash: 7
75
+ segments:
76
+ - 1
77
+ - 6
78
+ - 4
79
+ version: 1.6.4
80
+ prerelease: false
81
+ name: jeweler
82
+ requirement: *id004
83
+ - !ruby/object:Gem::Dependency
84
+ type: :development
85
+ version_requirements: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - "="
89
+ - !ruby/object:Gem::Version
90
+ hash: 25
91
+ segments:
92
+ - 1
93
+ - 0
94
+ - 7
95
+ version: 1.0.7
96
+ prerelease: false
97
+ name: ffi
98
+ requirement: *id005
99
+ description: "An automated way of testing the Web Analytic tags reported to 'n' number of Web Analytic tools by your product. See here for more details: http://essenceoftesting.blogspot.com/search/label/waat"
100
+ email: abagmar@gmail.com
101
+ executables: []
102
+
103
+ extensions: []
104
+
105
+ extra_rdoc_files:
106
+ - LICENSE.txt
107
+ - README
108
+ - README.rdoc
109
+ files:
110
+ - .document
111
+ - Gemfile
112
+ - LICENSE.txt
113
+ - README
114
+ - README.rdoc
115
+ - Rakefile
116
+ - VERSION
117
+ - WAAT.gemspec
118
+ - features/WAAT-ruby.feature
119
+ - features/step_definitions/WAAT-ruby_steps.rb
120
+ - features/support/env.rb
121
+ - features/support/hook.rb
122
+ - lib/WAAT.rb
123
+ - lib/WAAT/LICENSE.txt
124
+ - lib/WAAT/docs/Jpcap_Install.html
125
+ - lib/WAAT/docs/README
126
+ - lib/WAAT/docs/README.rdoc
127
+ - lib/WAAT/docs/WAAT Readme.doc
128
+ - lib/WAAT/docs/WAAT Readme.docx
129
+ - lib/WAAT/docs/WAAT Readme.html
130
+ - lib/WAAT/docs/WAAT Readme.pdf
131
+ - lib/WAAT/lib/WAAT_v1.4.jar
132
+ - lib/WAAT/lib/commons-lang-2.3.jar
133
+ - lib/WAAT/lib/httpSniffer/Linux/jpcap-0.7-1.i386.rpm
134
+ - lib/WAAT/lib/httpSniffer/Linux/jpcap-0.7.deb
135
+ - lib/WAAT/lib/httpSniffer/Linux/libpcap-1.1.1.tar.gz
136
+ - lib/WAAT/lib/httpSniffer/Windows/JpcapSetup-0.7.exe
137
+ - lib/WAAT/lib/httpSniffer/Windows/System32/Jpcap.dll
138
+ - lib/WAAT/lib/httpSniffer/Windows/System32/Packet.dll
139
+ - lib/WAAT/lib/httpSniffer/Windows/System32/drivers/npf.sys
140
+ - lib/WAAT/lib/httpSniffer/Windows/System32/pthreadVC.dll
141
+ - lib/WAAT/lib/httpSniffer/Windows/System32/wpcap.dll
142
+ - lib/WAAT/lib/httpSniffer/Windows/WinPcap_4_1_2.exe
143
+ - lib/WAAT/lib/httpSniffer/jpcap.jar
144
+ - lib/WAAT/lib/jpcap.jar
145
+ - lib/WAAT/lib/log4j-1.2.16.jar
146
+ - lib/WAAT/lib/xstream-1.3.1.jar
147
+ - lib/WAAT/resources/log4j.properties
148
+ - lib/WAAT/sampledata/TestData.xml
149
+ - lib/WAAT/samplescripts/com/thoughtworks/webanalyticsautomation/scriptrunner/SeleniumScriptRunner.java
150
+ - lib/WAAT/samplescripts/com/thoughtworks/webanalyticsautomation/scriptrunner/WebDriverScriptRunner.java
151
+ - sampledata/TestData.xml
152
+ has_rdoc: true
153
+ homepage: http://github.com/anandbagmar/WAAT-ruby
154
+ licenses:
155
+ - Apache 2.0
156
+ post_install_message:
157
+ rdoc_options: []
158
+
159
+ require_paths:
160
+ - lib
161
+ required_ruby_version: !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ hash: 3
167
+ segments:
168
+ - 0
169
+ version: "0"
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ hash: 3
176
+ segments:
177
+ - 0
178
+ version: "0"
179
+ requirements: []
180
+
181
+ rubyforge_project:
182
+ rubygems_version: 1.3.7
183
+ signing_key:
184
+ specification_version: 3
185
+ summary: Web Analytics Automation Testing Framework
186
+ test_files: []
187
+