WAAT 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
File without changes
File without changes
@@ -1,20 +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
-
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
+
@@ -1,86 +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/||"/>
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
86
  </Sections>
@@ -1,49 +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
- }
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
+ }
@@ -1,67 +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
- }
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
+ }