validateMatch in the HTTP request

After click on certain DOM element my page sents click events an Google Analytics. Click events are sent like GET HTTP requests / URLs like

https://stats.g.doubleclick.net/r/collect?v=1&aip=1&t=dc&_r=3&tid=UA-1234567-1&cid=297722160.1523959944&jid=2028321276&_gid=1320758195.1530624077&gjid=12698493&_v=j68&z=1135539045

How is this URL to inspect? I want to test some things with it:

  • whether it is indeed sent?
  • what status code was as an answer to request?
  • whether the URL contains certain values?

As first there should be a defining of the testObject as DOM element, and click on it. But what next?

1 Like

Take a look at Web Services keywords:

https://docs.katalon.com/display/KD/Web+Service

Mate Mrse said:

Take a look at Web Services keywords:

i see only the possibility to send request, not to inspect an already sent one:( Where am i wrong?

You can use WS.verifyResponseStatusCode() for your second question, and WS.verifyElementText() for third (I guess).

My WS testing skills are still pretty raw so that’s all I got for now.

hmmm, i thought, both keywords are regarding HTTP response, not request…

You can save the response in a variable and then examine it:

def response = WS.sendRequest(findTestObject('Your object'))

Evgeniy,

I have an acquaintance with you in another post : http://forum.katalon.com/discussion/7728/finding-any-portion-of-script-content

In the post I learned that you are working on your web pages which employ Google Tag Manager (https://www.google.com/analytics/tag-manager/ ) and Google Analytics (https://analytics.google.com/analytics/web/provision/?authuser=0#provision/SignUp/ )

I believe your intension is NOT to test if the Google Tag Manager service and the Google Analytics serivce are functioning.

However, you said you want to test

  • whether it is indeed sent?

  • what status code was as an answer to request?

  • whether the URL contains certain values?

I think that these concerns are for Google people, not you as a user. I wonder why you are concerned about quality of the Google products.

Mate,

You effectively suggested how to test the Google products using Katalon Studio’s Web Services keywords. Well, … who want to do the job?

Evgeniy,

Going back to your question,

I want to test some things with it:

  • whether it is indeed sent?

No.

What you can do using Katalon Studio WebUI keywords is to get access to the HTML Document of your Web pages exposed by a browser through the WebDriver protocol. The W3C Web Driver specification does not support API through which Browsers send log events (such as a HTTP Request sent, a HTTP Response received, etc) to the WebDriver clients such as Katalon Studio. Therefore the Katalon does not support feature with which you can inspect how a browser talk to backend servers with HTTP request/response.

kazurayam said:

these concerns are for Google people

Sorry, i missed to explain my test needs at first…

  • There is (anywhere, not reachable by me) a digital analyst, who implements web analytic (GA+GTM)
  • There are (anywhere, not reachable by me) developers, who make code commits, which (often) make implemented web analytics corrupt by change or disappear of DOM elements or the like.
  • There is me, who should establish a test prozedure, where digital analyst is notified, if any code commit maked his analytics code corrupted.

web analytics corrupted by change of DOM elements

Could you describe a bit more with example code snippet?

Just a simplest thing: there was a button like click - to this element, located as id=“666” was tied a click event with certain content. After code commit id=“666” was changed to class=“666” - click event is no longer fired.
In this setup i would like to inspect whether click event is still sent and what it contains. If i can’t recognize the click event content or the click event isn’t fired at all - i notify digital analyst: dude, your button click tracking is gone.

If I were you, I will try the following approach.

(1) The target web app uses Google Analytics. All the access to the web app is recorded and analyzed by GA.

(2) I will develop a Test Suite in Katalon Studio for the target web app. The test will traverse the web site while clicking all of buttons which send requests to various URLs. I will try to make the test as comprehensive as possible for clicking ALL the buttons. The test cases just do clicking; will do no verifications.

(3) I will setup 2 more hosts, apart from the production, for the target web app: for example “develop.kazurayam.com” and “staging.kazurayam.com”. Both hosts are exposed to the internet and can communicate with GA so that I can obtain the analytics results of both hosts. I will deploy the latest development version of the target web app to the “develop” host. I will deploy the current production version to the “staging” host.

(4) I will run the Test Suite (just to click all the buttons) against both hosts.

(5) I will compare the 2 sets of GA analytics results somehow. Theoretically the two should be identical as long as you run the same Katalon test suite. If any difference found and whatever the difference is, I will talk to developers to let them look at the insident.

1 Like

NIce idea:) @4280-kazurayam - i’m already a little bit further: the current setup is:
there is a developer mirror of the site, like stage.site.com. On the production.site.com i run Google Analytics with analytic.js, on the stage i run it with analytic_debug.js. Further i run tests with Katalon on stage and… now it is the most important part, which isn’t ready… i want to record console.log of the testing browser - analytic_debug.js writes into console.log everything about the health of tracking. The console.log output is enough for me to say definitely “there is tracking wrong, here is it ok”.

Any idea about recording of console.log with Katalon? Or anyhow on other way? I want to have an output into a file, like one url - one file.

Have a look at this post:

But you should be aware , as Russ pointed out:

It should be noted this does not and will not work in Firefox.

According to the post https://github.com/mozilla/geckodriver/issues/330

This won’t be fixed in a future release until the (W3C WebDriver )working group decides to add it to the specification.

1 Like

Thanks @4280-kazurayam - it looks indeed very promising! However to test it i need to run tests in Chrome with installed own extension (i need to install analytics_debug.js as an extension).

Do you have an idea how to run Katalon test on Chrome with extension installed by my own?
(Its a kind of standalone question, which deserves its own thread, but it is in context of this thread. If we are ready with it, i would write a step-by-step walkthru - it could be interessant for somebody)

Vinh Nguyen wrote something at 12/27/2017:


It looks like what you need to know.

1 Like

Oha, thanks - lets make hands dirty

If we are ready with it, i would write a step-by-step walkthru

You should create a new post in the Tips & Tricks category.