Using ATFs to Test Playbooks

AshishNova
Tera Expert

I need to use the ATFs to test Playbooks. Initially, I had create an ATF test that was an end-to-end process for the playbook however with test being more 50 steps and having constant errors which weren't fixable but simply changing or adding steps. 

I decided to create tests use scripting to split the playbook lane stages per test. My intention to use the script to force the playbook at different stage and run its activities. The playbook stages goes as per "Draft -> Identification -> Contain -> Eradicate -> Recover -> Review. 

function(outputs, steps, params, stepResult, assertEqual) {
	var stepThreeRec = 'eb28eb4f345192100db2029f964bf74e';
	var dynamicSysID = steps(stepThreeRec).sys_id;

	var parentRecord = new GlideRecord('sn_si_incident');
	parentRecord.get(dynamicSysID);
	var scopedName = 'sn_si.dhac_malware_playbook';

	var hasPlaybooks = sn_playbook.PlaybookExperience.triggerPlaybook(scopedName, parentRecord);
	gs.info(hasPlaybooks);
	
})(outputs, steps, params, stepResult, assertEqual);

This is what I have done so far with server side scripts. I hard coded the sys_id of step 3 (a Record Insert Step) then created dynamicSysId to get record inserted sys_id that changes everytime the test runs. Using the GlideRecord to find the record to parentRecord variable. I tried to PlaybookExperience to find whether a record is running a playbook but I am receiving a error.

How do I check if a record is running a playbook and how to force said playbook to start from different lane?

 

0 REPLIES 0