0

In one application I am working on we have some links that will trigger some tracking events:

<a href="/foo" data-track='{type: "navigation"}'>Go to Foo</a>


<script>
$(document).ready(function () {
    $('data-track').click(function (e) {
       var data = $(this).data('track');
       // how to test this on an acceptance test?
       appTracking.track(data);
    });
});
</script>

The question is:

  • Is it possibe to make sure tracking is working on acceptance tests?

Or perhaps acceptance tests are not supposed to test this stuff. I would like to hear your thoughts.

We do have unit tests for that behaviour, but we want to ensure that we wired everything correctly.

I am not sure the answer is testing framework specific, but we are using Codeception for acceptance tests.

Thank you in advance.

Marcelo
  • 1,702
  • 2
  • 24
  • 42
  • Check if event was registered in database. – Naktibalda Apr 18 '16 at 15:24
  • We do not do the tracking ourselves. We delegate the tracking to a 3rd party. Using some kind of testing adapter could work though, but then it would not really be integration/acceptance test, I suppose. – Marcelo Apr 18 '16 at 16:54
  • The only ways I can see possible to get the desired result you want would be routing your traffic through a proxy and then parsing the proxy logs. You could try using Fiddler set up as the proxy and then attempt to parse the HAR files, although that might be overkill. – Declan Carroll Apr 20 '16 at 14:12

0 Answers0