How to Automate Web Analytics testing? - google-analytics

Omniture/SiteCatalyst's code is integrated onto the webpage to collect the analytics in our firm.
Current process: SiteCatalyst id deployed by pasting HTML code onto each page of the website. This HTML code contains variables and other identifiers that facilitate the data collection process. These variables may be dynamically populated with server or application variables. The code snippet also calls the JavaScript library file, which contains SiteCatalyst-specific JavaScript functions used during metrics collection.
We use Add-on's like Charlie, HTTP Post, DigitalPulse Debugger to Test if the code inserted has accurate values corresponding to it. This process is time consuming and tedious.
How to Automate this process? Any help would be appreciated!
Example 1:
Click here to send a page view
s.pageName="New Page"
s.prop1="some value"
void(s.t());
Example 2:
s=s_gi('myreportsuiteid');
s.linkTrackVars="prop1,eVar1,events"; s.linkTrackEvents="event1";
s.prop1="some value"; s.eVar1="another value"; s.events="event1";
s.tl(this,'o','My Link Name');

There are a few different ways to automate testing. I've been looking into it lately myself. So far I'm looking into Selenium, Zombiejs and Phantomjs. You can search for "headless testing" which basically let's run code as a browser and test conditions on the page you visit.
Here's a good place to start https://github.com/ariya/phantomjs/wiki/Headless-Testing
Using these platforms, you could easily set pages to automatically validate if the SiteCatalyst code is firing, page names are correct, click events happen etc.
Selenium is an enterprise product whereas the JS frameworks would be more of a development effort.

we usually do this using a more customizable proxy application called Fiddler which we use to capture all the traffic sent from our brower.
Fiddler has an internal scripting language that let you make any type of check on the data passing in the Adobe Analytics call and highlight in the interface any bad call.

Related

Can we checkpoints in VSTS using Visual Studio.

Can we insert checkpoints in the scripts. For example In load tests. we get results for each URL. If site is using same URL for many different pages, that pages lumped together into single URL in the result. In QALoad, it was possible to create "checkpoints" in the script, and that is how we were able to see the performance for each page, regardless of URL. Can we achieve this by VSTS ? Please help.
There are at least two possible mechanisms.
On each request you can set a "reporting name". This can be set and updated via the properties panel of the request; but that can be tedious to use. The "Set request details" panel can be opened with one of the web test icons and that allows reporting names (and also think times and response time goals) to be set for all the requests in the test. The reporting names are used in the various reports from Visual Studio. Some people recommend that reporting names be given to all requests and that they include sequence numbers that make it clear how the various requests relate to the flow through the test.
Another option is to put requests into "transactions". However, transactions are more useful for grouping small numbers of requests that are to be reported as a group as well as individually.

Using JMeter with iframes

I have a test plan for our UAT environment using JMeter and part of the user journey involves hitting a page with an iframe to accept payment using a payment provider.
The payment provider from the iframe has three stages:
Select payment type (VISA, MasterCard etc.)
Enter payment details (Card number, expiry etc.)
Enter status code (Approved or Declined because it is a test environment)
How do I implement these iframe requests using JMeter?
You can try and record it first. Use either JMeter proxy: http://jmeter.apache.org/usermanual/component_reference.html#HTTP(S)_Test_Script_Recorder
Or BlazeMeter's Chrome extension: http://community.blazemeter.com/knowledgebase/articles/231479-chrome-extension
You will then need to clean an parametrize your script. Take a look at CSV data set config: http://jmeter.apache.org/usermanual/component_reference.html#CSV_Data_Set_Config
If you need some video tutorials to do just that, take a look here: http://blazemeter.com/blog/jmeter-tutorial-video-series
You're best bet is probably BlazeMeter's JMeter chrome extension, though you need to change one of the settings.
When you are browsing a site that uses iframes, AJAX calls, JS based requests (etc) you need to into the "Advanced Options" in the extension and uncheck "Record Only Top Level Requests".
The extension will now record EVERY request your browser is making, so be sure to close any other tabs you have open.
The Test Script Recorder might be failing due to security issues on the domain in the iframe. The advantage of using the chrome extension is that it doesn't care if the requests are secure or not.

Scraping ASP.NET with Python and urllib2

I've been trying (unsuccessfully, I might add) to scrape a website created with the Microsoft stack (ASP.NET, C#, IIS) using Python and urllib/urllib2. I'm also using cookielib to manage cookies. After spending a long time profiling the website in Chrome and examining the headers, I've been unable to come up with a working solution to log in. Currently, in an attempt to get it to work at the most basic level, I've hard-coded the encoded URL string with all of the appropriate form data (even View State, etc..). I'm also passing valid headers.
The response that I'm currently receiving reads:
29|pageRedirect||/?aspxerrorpath=/default.aspx|
I'm not sure how to interpret the above. Also, I've looked pretty extensively at the client-side code used in processing the login fields.
Here's how it works: You enter your username/pass and hit a 'Login' button. Pressing the Enter key also simulates this button press. The input fields aren't in a form. Instead, there's a few onClick events on said Login button (most of which are just for aesthetics), but one in question handles validation. It does some rudimentary checks before sending it off to the server-side. Based on the web resources, it definitely appears to be using .NET AJAX.
When logging into this website normally, you request the domian as a POST with form-data of your username and password, among other things. Then, there is some sort of URL rewrite or redirect that takes you to a content page of url.com/twitter. When attempting to access url.com/twitter directly, it redirects you to the main page.
I should note that I've decided to leave the URL in question out. I'm not doing anything malicious, just automating a very monotonous check once every reasonable increment of time (I'm familiar with compassionate screen scraping). However, it would be trivial to associate my StackOverflow account with that account in the event that it didn't make the domain owners happy.
My question is: I've been able to successfully log in and automate services in the past, none of which were .NET-based. Is there anything different that I should be doing, or maybe something I'm leaving out?
For anyone else that might be in a similar predicament in the future:
I'd just like to note that I've had a lot of success with a Greasemonkey user script in Chrome to do all of my scraping and automation. I found it to be a lot easier than Python + urllib2 (at least for this particular case). The user scripts are written in 100% Javascript.
When scraping a web application, I use either:
1) WireShark ... or...
2) A logging proxy server (that logs headers as well as payload)
I then compare what the real application does (in this case, how your browser interacts with the site) with the scraper's logs. Working through the differences will bring you to a working solution.

Any suggestions for good automated web load testing tool?

What are some good automated tools for load testing (stress testing) web applications, that do not use record and replay of HTTP network packets?
I am aware that there are numerous load testing tools on the market that record and replay HTTP network packets. But these are unsuitable for my purpose, because of this:
The HTTP packet format changes very often in our application (e.g. when
we optimize an AJAX call). We do not want to adapt all test scripts just because
there is a slight change in HTTP packet format.
Our test team shall not need to know any internals about our application
to write their test scripts. A tool that replays HTTP packets, however, requires
the team to know the format of HTTP requests and responses, such that they
can adapt details of the replayed HTTP packets (e.g. user name).
The automated load testing tool I am looking for should be able to let the test team write "black box" test scripts such as:
Invoke web page at URL http://... .
First, enter XXX into text field XXX.
Then, press button XXX.
Wait until response has been received from web server.
Verify that text field XXX now contains the text XXX.
The tool should be able to simulate up to several 1000 users, and it should be compatible with web applications using ASP.NET and AJAX.
JMeter I've found to be pretty helpful, it also has a recording functionality to record use cases so you don't have to specify each GET/POST manually but rather "click" the use case once and then let JMeter repeat it.
http://jmeter.apache.org/
A license can be expensive for it (if you dont have MSDN), but Visual Studio 2010 Ultimate edition has a great set of load and stress testing tools that do what you describe. You can try it out for free for 90 days here.
TestMaker by PushToTest.com can run recorded scripts such as Selenium as well as many different languages like HTML, Java, Ruby, Groovy, .Net, VB, PHP, etc. It has a common reporting infrastructure and you can create load in your test lab or using cloud testing environments like EC2 for virtual test labs.
They provide free webinars on using open source testing tools on a monthly basis and there is one next Tuesday.
http://www.pushtotest.com
There are a few approaches; I've been in situations, however, where I've had to roll my own load generating utilities.
As far as your test script is concerned it involves:
sending a GET request to http://form entry page (only checking if a 200 response is given)
sending a POST request to http://form submit page with pre-generated key/value pairs for text XXX and performing a regexp check on the response
Unless your web page is complex AJAX there is no need to "simulate a button press" - this is taken care of by the POST request.
Given that your test consists of just a 2-step process there should be several automated load packages that could do this.
I've previously used httperf for load testing a large website: it can simulate a session consisting of several requests and can simulate a large number of users (i.e. sessions) simultaneously. For example, if your website generated a session cookie from the home page you could make that the first request, httperf would then use that cookie for subsequent requests, until it had finished doing the list of requests supplied.
What about http://watin.sourceforge.net/ ?

How to handle IMAP requests from MSOutlook in ASP.NET page?

Brief: I am tinkering with a personal project that would serve up Task objects to MSOutlook. I would like to create a new HTTP account in MSOutlook which points at my website's *.aspx page. This page would deliver a list of Task items that do not actually reside on a mail server but are instead stored in a XML file or other simple structure.
Question: Are there any guides for handling IMAP requests in ASP.NET? I've found plenty of information on developing a web client but I want something more akin to a server/service though nothing so robust.
Background: My daughter is in high school. She is computer literate but abhors complexity and all nerdiness. She is comfortable with MSOutlook so I would like to run a little website in my house to send homework Tasks to her. If I can set up an HTTP account, the Tasks will be delivered to her without any trouble on her part. Don't get me started on the screen scraping I'm doing to retrieve assignments from her teacher's "websites" (I don't think the term could be applied any more loosely without completely falling off).
I think you'd be better off using/customizing an Open Source IMAP server, there are several out here. But I am not sure if the mail server idea is a good one. You'd be bringing a lot of baggage into this effort.
Why don't you just send your daughter an email, as opposed to putting the assignment on a web page and then trying to get it off of there?
If you must have the pull model (as opposed to a push model), why not put up an asp page with a "Send me the assignment" button. She can go there, click on it, and will receive the content in the email.

Resources