ATF Jasmine "Hello World" Test fails with message Testing Incomplete (check that all asynchronous functions made their callbacks)

treycarroll
Giga Guru

I tried the simplest test that I could conceive by uncommenting the provided code for a "Run Server Side Script" activity.   It failed.   What am I missing?

find_real_file.pngfind_real_file.png

2 REPLIES 2

Ankush Agrawal
ServiceNow Employee
ServiceNow Employee

Hi

Jasmine executions require Jasmine tests to be present. You can refer some examples in the official document: https://jasmine.github.io/2.0/introduction.html

Here is a quick list:

  1. The tests are written in a callback function. The tests are written as "expect"
  2. The test callback needs to be passed to a function named 'it'. Its first parameter is the name of the test, e.g. "Test Assertion" and second is the callback
  3. All the IT's in your test can be wrapped in a test suite function called "describe"
  4. All of this have to be inside the IIFE block: 
    (function(outsputs, steps, stepResult, assertEqual) {
     describe('hello world', function(){
      it('should match string', function() {
     var expectedValue = "a";
      expect(a).toBe("a");
    });
    });
    }(outpus, steps, stepResult, assertEqual)​

--
Best Regards
Ankush

P.S. Please mark helpful/correct as appropriate to help the fellow community member in identifying the relevant answers.

Chaitanya Redd5
Tera Guru

Hi,

I see that your code lies outside of the function. You need to write your codes within the function. Please find the code below:

(function(outputs, steps, stepResult, assertEqual) {
    // add test script here
    var testAssertion = {
        name: "my test assertion",
        shouldbe: "2019-12-17 12:00:00",
		value: "2019-12-17 12:00:00",
    };
    assertEqual(testAssertion);
})(outputs, steps, stepResult, assertEqual);
// uncomment the next line to execute this script as a jasmine test
jasmine.getEnv().execute();

Please find a link below for reference:

https://developer.servicenow.com/app.do#!/event/creatorcon18/CCW0604/creatorcon_18_CCW0604_exercise_...

Kindly mark my answer as Correct and Helpful based on the Impact.