- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
Has anyone incorporated or know how to incorporate unit testing with or without using a framework (such as Mocha.js, Jasmine, QUnit etc.) for utag.js and/or extensions/tags created in Tealium?
Solved! Go to Solution.
09-13-2019
03:56 PM
- last edited on
10-22-2019
10:32 AM
by
TealiumJustin
A few tips for testing tags:
getNetworkResources()
. This will include data passed via query string parameters that can be verified against your data layer.document.cookie = “utagdb=true”;
. utag.db_log
will then contain information whether or not a tag or extension fired. (e.g. 1234: Tag not fired: Required attribute “account_id” not populated)An example of using Mocha.js and Chai.js to test whether your tag library was loaded:
it("Should load library.js", function() {
const urls = getNetworkResources().filter(url => {return url.includes("library.js")});
expect(urls).to.have.lengthOf(1);
});
@ashishgujja Such an interesting topic, we wrote a blog post about it! Enjoy!
Unit Testing Your Tealium Implementation with Mocha and Chai
Copyright All Rights Reserved © 2008-2023