ATF Steps for Change Risk Assessment [HOWTO]
Many of us have the problem to automate the change process due to the Risk Assessment.
In the process you have to press the "Fill Out Risk Assessment" and "Execute Risk Calculation" UI actions for risk assessment in order to proceed with the test.
As far as I know, is not possible to interact with the popup of the questionnaire and to press it's submit button via the ATF available steps. I found some workarounds in the community (like changing the risk value by server side script) but i wanted the test to be complete and to test also the risk calculation based on the type of answers to the questionnaire and their weight.
First I looked at the record structure of a completed survey to understand needed tables, fields and relations. I noticed that the Instance is named with the "DateTime" of when the Submit of the survey was pressed, and is the same in all DateTime fileds in the records:
- The "Risk Assessment" is the record that the system looks at in first place. It's containing reference to the the change and to the instance which is the link to the question results
- 1. Filed "Assessment" - select "Change Risk Assessment" (or how is nominated the survey)
- Field "Task" - Is the Change number
- Field "Completed By" - The user that took the survey
- Field "Completed Date" - The DateTime when the survey is inserted
- Filed "Instance" - The Instance of the survey. It's name is exactly the DateTime above
- Field "Task" - Is the Change number
- The "Responses" are the records of each question, asnwer and answer weight and they are also related to the instance.
- 1. Filed "Instance" - The Instance of the survey.
- Field "Question" - The Survey Question
- Field "Response" - The response to the specific question
- Field "Answer Integer" - The value of the specific response
- Field "Question" - The Survey Question
- The "Instance" is the link between these records.
- 1. Field "Taken On" - The DateTime as all above and also the name of the record
- Field "Survey" - The survey selected
- Field "Taken By" - the User that took the survey
- Field "Survey" - The survey selected
So i decided to go this way, create a test case with this steps and it works:
- Impersonate a user
- Insert a change
- Insert a record for the Survey Instance (choosing a DateTime and using it wherever needed in all records)
- Insert a record for each Survey Question's Answer (we have 6 of them, i'll put only one in the screenshots)
- Insert a record for the Risk Assessment
- Open the Change form
- Press the "Execute Risk Calculation" UI Action
Of course then i put those steps in a full End to End test case for the change process.
I think this is the best way, so far, to be able to complete a change test including also the risk assessment calculation (selecting different answers in different tests or re performing them in the same test) .
If anyone finds out a way to interact with the Risk Assessment popup please get in contact and tell me because it would of course be better and more simple.
Labels:
https://www.servicenow.com/community/itsm-articles/atf-steps-for-change-risk-assessment-howto/ta-p/2311388
