{"id":33364,"date":"2016-04-26T15:57:34","date_gmt":"2016-04-26T10:27:34","guid":{"rendered":"https:\/\/2thenew.online\/blog\/?p=33364"},"modified":"2016-04-27T10:01:06","modified_gmt":"2016-04-27T04:31:06","slug":"how-to-test-google-apps-script-using-qunit","status":"publish","type":"post","link":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/","title":{"rendered":"How to test Google Apps Script using Qunit"},"content":{"rendered":"<p>In my <a href=\"https:\/\/2thenew.online\/blog\/introduction-to-google-apps-script-with-google-spreadsheet\/\" target=\"_blank\">previous blog<\/a>, we learnt how to use Google Apps Script in spreadsheets. Now we will take a look at\u00a0how we can test the code which we have\u00a0written in apps script.\u00a0For this purpose, we&#8217;ll use a tool called \u201c<em><strong>Qunit<\/strong><\/em>\u201d which helps us in writing and testing our apps script test cases.<\/p>\n<p><em><strong>QUnit<\/strong><\/em> is a powerful, easy-to-use, JavaScript unit testing framework. It&#8217;s used by the jQuery project to test its code and plugins but is capable of testing any generic JavaScript code.It is made available as a script library for Google Apps Script.<\/p>\n<p><strong>Key Points QUnit for Google Apps Script :<\/strong><\/p>\n<ol>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important;\">Tests are run on Google&#8217;s servers, not in your browser. The browser only displays test results.<\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important;\">Configuration is required by calling <code>QUnit.config(myConfig)<\/code>, where <code>myConfig<\/code> is an object with your configuration settings.<\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important;\">The Google Apps Script service running the tests needs to implement a <code>doGet(e)<\/code> function that.<\/li>\n<\/ol>\n<ul>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important; margin-left: 50px;\">Calls <code>QUnit.urlParams(e.parameter)<\/code>, which ensures that QUnit-specific HTTP parameters are handled when you interact with the QUnit GUI;<\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important; margin-left: 50px;\">Optionally, configures QUnit with the <code>Qunit.config()<\/code> function;<\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important; margin-left: 50px;\">Loads tests with <code>QUnit.load(myTests)<\/code>, where <code>myTests<\/code> is a function containing your tests;<\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important; margin-left: 50px;\">Returns the result of <code>Qunit.getHtml();<\/code><\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important; margin-left: 50px;\">Some helper functions can be imported from QUnit to the test suite by calling <code>QUnit.helpers(this).<\/code><\/li>\n<\/ul>\n<p><strong>Steps for adding &#8216;<em>Qunit<\/em>&#8216; in project :<\/strong><\/p>\n<ol>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important;\">Go to script editor.<\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important;\">Select &#8220;Resources&#8221; &gt; &#8220;Libraries&#8230;&#8221; in the Google Apps Script editor.<\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important;\">Enter this project key (MxL38OxqIK-B73jyDTvCe-OBao7QLBR4j) in the &#8220;Find a Library&#8221; field, and choose &#8220;Select&#8221;.<\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important;\">Select version number <code>4<\/code>, and choose QUnit as the identifier. (Do not turn on Development Mode)<\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important;\">Press Save.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-33517\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/04\/Add-Qunit-in-Google-Apps-Script.png\" alt=\"Add Qunit in Google Apps Script\" width=\"506\" height=\"288\" \/><\/p>\n<p><strong>Here is the sample code:<\/strong><\/p>\n<p>[js]<br \/>\nfunction calculateAmountAndQty(quantity,amount){<br \/>\n if(typeof (quantity) == &#8216;undefined&#8217; || quantity == &#8216;null&#8217; || isNaN(quantity)) {<br \/>\n       quantity=0;<br \/>\n }<\/p>\n<p> if(typeof (amount) == &#8216;undefined&#8217; || amount == &#8216;null&#8217; || isNaN(amount)) {<br \/>\n       amount=0;<br \/>\n }<\/p>\n<p> return (quantity*amount);<br \/>\n}<br \/>\n[\/js]<\/p>\n<p>We&#8217;ll be writing test cases for the above code. Open up the scripts editor and paste the code given below and save the script afterwards.<\/p>\n<p>[js]<br \/>\n QUnit.helpers( this );<br \/>\n function testFunctions() {<br \/>\n    testingCalculateAmountAndQty();<br \/>\n }<\/p>\n<p> function doGet( e ) {<br \/>\n      QUnit.urlParams( e.parameter );<br \/>\n      QUnit.config({<br \/>\n           title: &quot;QUnit for Google Apps Script &#8211; Test suite&quot; \/\/ Sets the title of the test page.<br \/>\n      });<br \/>\n      QUnit.load( testFunctions );<\/p>\n<p>      return QUnit.getHtml();<br \/>\n };<\/p>\n<p> function testingCalculateAmountAndQty(){<br \/>\n    QUnit.test( &quot;calculateAmountAndQty testing&quot;, function() {<br \/>\n       expect(7);<br \/>\n       equal( calculateAmountAndQty(10,2000), 20000, &quot;Test for quantity : 10 and amount : 2000 sp output is 20000&quot; );<br \/>\n       equal( calculateAmountAndQty(&quot;printer&quot;,2000), 0, &quot;Test for quantity : printer and amount : 2000 so output is 0&quot; );<br \/>\n       equal( calculateAmountAndQty(10,&quot;mouse&quot;), 0, &quot;Test for quantity : 10 and amount : mouse so output is 0&quot; );<br \/>\n       equal( calculateAmountAndQty(10,null), 0, &quot;Test for quantity : 10 and amount : null so output is 0&quot; );<br \/>\n       equal( calculateAmountAndQty(null,2000), 0, &quot;Test for quantity : null and amount : 2000 so output is 0&quot; );<br \/>\n       equal( calculateAmountAndQty(undefined,2000), 0, &quot;Test for quantity : undefined and amount : 2000 so output is 0&quot; );<br \/>\n       equal( calculateAmountAndQty(10,undefined), 0, &quot;Test for quantity : 10 and amount : undefined so output is 0&quot; );<br \/>\n    });<br \/>\n }<br \/>\n[\/js]<\/p>\n<p><strong>Steps to Run Qunit Test Case :<\/strong><\/p>\n<ol>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important;\">Click on Publish&gt; Deploy as web app.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-33520\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/04\/Deploy-as-web-app.png\" alt=\"Deploy as web app\" width=\"430\" height=\"260\" \/><\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important;\">Click on Deploy.<\/li>\n<li style=\"font-family: 'open_sansregular'; font-size: 14px !important;\">Click on latest code. It redirects to Qunit page where all test case report is displayed .<\/li>\n<\/ol>\n<p><strong>Output<\/strong> :<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-33521\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/04\/Qunit-Test-Cases-Executed.png\" alt=\"Qunit Test Cases Executed\" width=\"554\" height=\"382\" \/><\/p>\n<p><strong>Note: <\/strong>Qunit configuration is mandatory.<\/p>\n<p>For more reference :<br \/>\n1. https:\/\/qunitjs.com<br \/>\n2. https:\/\/github.com\/simula-innovation\/qunit\/tree\/gas\/gas<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my previous blog, we learnt how to use Google Apps Script in spreadsheets. Now we will take a look at\u00a0how we can test the code which we have\u00a0written in apps script.\u00a0For this purpose, we&#8217;ll use a tool called \u201cQunit\u201d which helps us in writing and testing our apps script test cases. QUnit is a [&hellip;]<\/p>\n","protected":false},"author":76,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":62,"footnotes":""},"categories":[1],"tags":[3173,3179],"class_list":["post-33364","post","type-post","status-publish","format-standard","hentry","category-technology","tag-google-apps-script","tag-qunit"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"In my previous blog, we learnt how to use Google Apps Script in spreadsheets. Now we will take a look at how we can test the code which we have written in apps script. For this purpose, we&#039;ll use a tool called \u201cQunit\u201d which helps us in writing and testing our apps script test cases. QUnit is a\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Heena Dhamija\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"How to test Google Apps Script using Qunit | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"In my previous blog, we learnt how to use Google Apps Script in spreadsheets. Now we will take a look at how we can test the code which we have written in apps script. For this purpose, we&#039;ll use a tool called \u201cQunit\u201d which helps us in writing and testing our apps script test cases. QUnit is a\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How to test Google Apps Script using Qunit | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In my previous blog, we learnt how to use Google Apps Script in spreadsheets. Now we will take a look at how we can test the code which we have written in apps script. For this purpose, we&#039;ll use a tool called \u201cQunit\u201d which helps us in writing and testing our apps script test cases. QUnit is a\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-test-google-apps-script-using-qunit\\\/#article\",\"name\":\"How to test Google Apps Script using Qunit | TO THE NEW Blog\",\"headline\":\"How to test Google Apps Script using Qunit\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/heena\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"\\\/blog\\\/wp-ttn-blog\\\/uploads\\\/2016\\\/04\\\/Add-Qunit-in-Google-Apps-Script.png\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-test-google-apps-script-using-qunit\\\/#articleImage\"},\"datePublished\":\"2016-04-26T15:57:34+05:30\",\"dateModified\":\"2016-04-27T10:01:06+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-test-google-apps-script-using-qunit\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-test-google-apps-script-using-qunit\\\/#webpage\"},\"articleSection\":\"Technology, Google Apps Script, Qunit\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-test-google-apps-script-using-qunit\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-test-google-apps-script-using-qunit\\\/#listItem\",\"name\":\"How to test Google Apps Script using Qunit\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-test-google-apps-script-using-qunit\\\/#listItem\",\"position\":3,\"name\":\"How to test Google Apps Script using Qunit\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/heena\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/heena\\\/\",\"name\":\"Heena Dhamija\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-test-google-apps-script-using-qunit\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0769bddbfb0a2a86d747d40444a48cc704b36582a4a73d0d8e6a3084d128edea?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Heena Dhamija\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-test-google-apps-script-using-qunit\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-test-google-apps-script-using-qunit\\\/\",\"name\":\"How to test Google Apps Script using Qunit | TO THE NEW Blog\",\"description\":\"In my previous blog, we learnt how to use Google Apps Script in spreadsheets. Now we will take a look at how we can test the code which we have written in apps script. For this purpose, we'll use a tool called \\u201cQunit\\u201d which helps us in writing and testing our apps script test cases. QUnit is a\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-test-google-apps-script-using-qunit\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/heena\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/heena\\\/#author\"},\"datePublished\":\"2016-04-26T15:57:34+05:30\",\"dateModified\":\"2016-04-27T10:01:06+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How to test Google Apps Script using Qunit | TO THE NEW Blog","description":"In my previous blog, we learnt how to use Google Apps Script in spreadsheets. Now we will take a look at how we can test the code which we have written in apps script. For this purpose, we'll use a tool called \u201cQunit\u201d which helps us in writing and testing our apps script test cases. QUnit is a","canonical_url":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/#article","name":"How to test Google Apps Script using Qunit | TO THE NEW Blog","headline":"How to test Google Apps Script using Qunit","author":{"@id":"https:\/\/2thenew.online\/blog\/author\/heena\/#author"},"publisher":{"@id":"https:\/\/2thenew.online\/blog\/#organization"},"image":{"@type":"ImageObject","url":"\/blog\/wp-ttn-blog\/uploads\/2016\/04\/Add-Qunit-in-Google-Apps-Script.png","@id":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/#articleImage"},"datePublished":"2016-04-26T15:57:34+05:30","dateModified":"2016-04-27T10:01:06+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/#webpage"},"articleSection":"Technology, Google Apps Script, Qunit"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.online\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/2thenew.online\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/#listItem","name":"How to test Google Apps Script using Qunit"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/#listItem","position":3,"name":"How to test Google Apps Script using Qunit","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.online\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.online\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.online\/blog\/author\/heena\/#author","url":"https:\/\/2thenew.online\/blog\/author\/heena\/","name":"Heena Dhamija","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/0769bddbfb0a2a86d747d40444a48cc704b36582a4a73d0d8e6a3084d128edea?s=96&d=mm&r=g","width":96,"height":96,"caption":"Heena Dhamija"}},{"@type":"WebPage","@id":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/#webpage","url":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/","name":"How to test Google Apps Script using Qunit | TO THE NEW Blog","description":"In my previous blog, we learnt how to use Google Apps Script in spreadsheets. Now we will take a look at how we can test the code which we have written in apps script. For this purpose, we'll use a tool called \u201cQunit\u201d which helps us in writing and testing our apps script test cases. QUnit is a","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.online\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.online\/blog\/author\/heena\/#author"},"creator":{"@id":"https:\/\/2thenew.online\/blog\/author\/heena\/#author"},"datePublished":"2016-04-26T15:57:34+05:30","dateModified":"2016-04-27T10:01:06+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.online\/blog\/#website","url":"https:\/\/2thenew.online\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.online\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"How to test Google Apps Script using Qunit | TO THE NEW Blog","og:description":"In my previous blog, we learnt how to use Google Apps Script in spreadsheets. Now we will take a look at how we can test the code which we have written in apps script. For this purpose, we'll use a tool called \u201cQunit\u201d which helps us in writing and testing our apps script test cases. QUnit is a","og:url":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/","og:image":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"How to test Google Apps Script using Qunit | TO THE NEW Blog","twitter:description":"In my previous blog, we learnt how to use Google Apps Script in spreadsheets. Now we will take a look at how we can test the code which we have written in apps script. For this purpose, we'll use a tool called \u201cQunit\u201d which helps us in writing and testing our apps script test cases. QUnit is a","twitter:image":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"33364","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"blog","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 19:15:42","updated":"2024-02-29 09:30:27","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.online\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.online\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow to test Google Apps Script using Qunit\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.online\/blog"},{"label":"Technology","link":"https:\/\/2thenew.online\/blog\/category\/technology\/"},{"label":"How to test Google Apps Script using Qunit","link":"https:\/\/2thenew.online\/blog\/how-to-test-google-apps-script-using-qunit\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts\/33364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/users\/76"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/comments?post=33364"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts\/33364\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/media?parent=33364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/categories?post=33364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/tags?post=33364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}