Learn ServiceNow Development and Testing | Create Manual Test Case | Create Automated Test Case
[Music] hello everyone welcome to sas word service now this is a short demo of development and testing in servicenow in this demo you will learn how you can perform the development in servicenow for the requirement you get from your customers and clients how you can create a test case for that particular requirement and how you can convert that test case into automated test case with automated test framework in service now you must be getting requirement from your customers and clients via jira or a story and that story should definitely have acceptance criteria which is also a requirement so similarly we also have a requirement and acceptance criteria for this demo which we will perform the development and we will also perform the testing for this requirement now the requirement is given user navigates to create new under incident when user clicks on module the new incident form is opened with mandatory fields highlighted configuration item and channel overall these two fields should be mandatory while submitting the new incident form second requirement is given user fill the details of new incident form with ci that is configuration item when user submits or save the incident then incident should be created and assignment group should be populated as support group of ci that is configuration item selected on incident so this is the requirement and we are going to perform the development in our personal developer instance so let's perform the development first so that we can create a manual test case and we can also convert that manual test case to automation with automation automated test framework so let's start the development this is my personal developer instance so we will directly go to incident module so i will type incident here we have incident module i will click on create new when i will click on create new it will open up the new form of incident as you can see we only have caller and short description fields as mandatory fields when incident form is loaded as per the requirement we have to make configuration item field and channel field as mandatory so what we will do that so basically we will create a ui policy so i will right click on the header go to configure and i will go to ui policies if i click on ui policies it will give me the list of ui policies i will click on new so that i can create a new ui policy and i will come here i will make make ci and channel mandatory and i want this these fields to be mandatory on load so i will just click on save so i'm just saving this ui policy and then i'm going to create ui policy action so i will click on this new button so that i can create a new ui policy action i will select this i will select that field which is channel and i will select mandatory true and i will click on submit so our first ui policy action is created i will now create second one which is for configuration item i will select here and i will select configuration item which is right here and i will make it true and i will submit it so second ui policy action is also created now here you can see some difference that contact type which is the channel label which is a field you can see there's no red red color on that but it's you have this red color on cmdb ci the reason behind it because there should be some another ui policy action applied to the same field that's the reason it is showing this red color but we are not going to resolve it right now because we are just doing uh this development for demo so let me just click on create new and see if it is working so as a developer after performing the development i will definitely check if the same functionality the same requirement is developed or not so as part of the acceptance criteria channel and configuration item should be mandatory so this is our first requirement first user story now second user story or second requirement we have is basically if i select configuration item here any configuration item maybe i select this one now when i will select that assignment group should automatically populate it on client this is the requirement so if i select here and it it should definitely have some assignment group maybe i will just open that record let me check that it's opening that record so whatever configuration i i select so it has assigned to but what about the support group i think it doesn't have that support group maybe i will go back and i will just check if it is available i will just maybe mention cmdb underscore ci dot list and if i do that and we have that field as ci support group so let's check that support group yes we have this support group if i click on ok so i think a lot of a lot of configuration item does not have these support group but let me just filter uh this out empty one so we do have lot of configuration items those also have this support group available so we will select these cis on our incident form for testing so what i will do now i will just perform the development that's our first task to complete the development for the requirement we have got from our customers and clients as part of this demo so i will go to incident form create new now this is something basically the requirement which has to be populated on client that means if i select that means i get the data from conf server by selecting configuration item that means it will do a query to the server and then it will fetch the support group the field of configuration item and then it will populate that on this assignment group but how can we how can we do this we can do this with client script and script include and with the help of glide ajax so let me do this first so i will just go to client script and i will create a new client script it should be on change client script because we are changing the configuration item on the form so here i will just mention populate dot assignment dot group dot ci and i can just select all here i will select on change field i will select configuration item so we have selected this one and here's our script so i will just zoom so now i will go to the script section where we will write the script because we definitely have to write the script so now how exactly we will do the scripting we will use glide ajax so what i will do there i will make it bigger so here i will basically mention where ga ga group so this is basically the variable name we are taking i will just mention new glide ajax now here we will put basically the script include the name of script include so as of now i don't have that script to include name i can just mention here where uh i can mention j not where i can just ga group dot add param here the first one will be sis perm name and here we will provide the name of the function and maybe i will put get support group this will be the function maybe i will do this um support um i think we can just mention get get ci details get ci details that will be our script include and then we have this function name i'm just putting in this before uh then i can just mention ga dot group add param now we definitely want to send because how how will i fetch the details of that particular ci i need to send some data first and that data would be society of that particular ci which you will select on incident form so for that i will just mention sperm and here i will just mention syspem underscore ci now what that particular id would be how exactly i will fetch that now for that i can do one thing so i will create a variable first variable will be ci id equal to g underscore form dot get value and that will be cm db underscore ci so i will get the society of the configuration item selected and i will just copy this one and i will put it comma here so this will be the society ci id and now i can just mention semicolon and here i will put i will just mention ga dot and we have to do get xml don't do get xml weight because we definitely want asynchronous and here i can basically provide the function so it is uh get group callback i can provide this function and now i can also mention this function here so function and here we have this one and i will just mention response not semicolon and i will just do where answer equal to response dot response xml dot document element dot get a tree butte and then in bracket i can put answer and i will just do semicolon and then now here i definitely have to this answer will definitely have the value of that of that support group so what i will do now i will just i will just now create that script include which will be client callable script include how would i do that i will just go here and i will search for script include and here i have this script include i will create in a new tab here i have this new button and i can just provide the same name so i can just go to here ci details copy i will give this cc tab and i will make it client callable now here i definitely have to provide details so this ci details and i can just mention it is basically client callable and i can just mention like this so here i can provide that and that will be our get support function so i will provide this get support function here and how will i do that i just have to declare like this function and comma now here i will definitely execute the query so that i can get that data that is really more important so how will i do that so in this case i definitely have to do the query on cmdbci table so what i will do ga uh it's gr this time glide record but it's gr get ci or maybe i will just put grci equal to new glide record and here is cm db underscore ci that's a table name and i will mention vr not vr it will be gr ci dot add query and it will be cis underscore id and what is that id so basically i have to i can just mention that first so we have uh ci or i will just mention ci id equal to i will just mention this dot get this is this is how you can get the value which will be sent via client script so it will be great parameter i think smelling is correct and here you have to provide that name which you have used in your client script and that is this one sperm ci so i will go here and i will mention that so semicolon so now here i can definitely provide ci id and i can just mention semicolon and i can just put grci dot query so it will do the query and i can just do if because we will definitely fetch only one record so if grci dot next gr okay it's gr id that's the reason it is not coming it's not it's uh it's gr id gr id and here again grid dot that's okay it's not coming here but that's fine um so we have mentioned if and what we will do i will just align this code so we have this empty now what i will do if we found the record then we will basically mention [Music] ci or i will just mention configuration id equal to and that will be gr id dot and i think we have we will basically go to uh cmdb cmdb underscore ci dot list okay it will take me to the uh different page but what i will do i will just open it in a new tab if i go here and i can just open this in a new tab it's very big and i just opened this one now i will just do oh maybe i will just do config our list is also fine i will get those records and now here basically i will go to configure and i will go to table directly so you can see this so i want to see that support group field i want to see the name of that support group so if i type this here we have that support group and okay so the backend name is support group only so i can just copy this go to my script include and paste it here and you are done it will basically return what exactly it returned society of the support group so we have where configuration item equal to gr id dot support group and i can now return this because this is what you have to return so i can just return this and you are done so i will just save this now so your script include is created and if i go to client script i will just unpin this and i will make a little bit big as well so that you can read the script so we have that value here get group callback and we have this answer and now here we have to set the value so i will just mention gender score form dot set value when you set the value it has to be a field name value and display value as well so field name should be assignment underscore group that's a field name and here i will just put the id now definitely have got the id which will be answer here normally i think you should also populate uh the display value but if you have if you don't have display value that's still fine so we will leave as is for now and i will just yeah but overall as per the recommendation or standards you should definitely put uh the value as well so i will just underscore set value this is done assignment group done and now i'm going to save this i will save this so our new client script is also created so now i will go to incident so maybe i will do it from here but i also need to check that which one has that support group so i will just filter it out we have this apache linux this one so i will make sure that i select this particular record and i will click on create new so it's opening the new form and you can see our channel and this one is mandatory so i will select i will maybe mention test and here i will select this one and i will just mention this and if i select this yes you can see the magic already happened and i can select the channel so you can see then when i selected configuration item it automatically populated assignment group this was not happening before if i will disable my client script so this is my client script let's say i disable this so we are just validating that it is working properly so i will just reload the form if you will reload the form and this time if i will put let's say same configuration item if i select this you can see it is not populating assignment group at all the reason is because our client script is disabled so let me enable this so overall you had two requirements two different requirements one is to make the fields mandatory and another one is to automatically populate assignment group so you are done with the development now now how you can create the test case we are done with the development so now we will create manual test case for the same requirement now how you can create a test case so servicenow provides an application called test management so if you click on here all and you type test you will see this application called test management you will see another application as well with the same name however that's another version that is test management 2.0 so it's up to you which one you want to use test management 2.0 is definitely the latest version of test management but as per your requirement as per your objective if you want to use test management 1.0 that is also totally fine however in this demo i will show you that how you can create a test case in test management 2.0 so i will go to test and here basically out of the box test already created i will click on create new and i will provide the short description so which is validate ions validate new form this is something validation of a new form validation validate incident new form so we are going to validate incident new form and i will just click on save so it will save this particular test now i can just provide the test steps so here i will start with basically login or impersonate impersonate as as an itil user impersonate as an idle user that's our first step then i will just move next next step and here so if this is this is our test step it needs verification no we don't need any kind of verification or maybe you can just mention if you're able to login if you can do that if you're able to impersonate but that's fine i will leave this one so i will just mention test step impersonate as an idle user and the next one is then we have uh you can go to go to incident module and then click on create new and then ci and channel fields or maybe you should put all the four fields so ci or maybe we will start with contact i think that is uh color so we will mention caller ci channel and short description fields should be mandatory now this is definitely a verification so i will check this check box and then i will go to the next one so what you will do i will add another step and here i will mention so you will definitely validate the mandatory fields now next one is selection of the field so i will definitely select the configuration item so i will mention select caller any color you want then you mention uh provide short description as this is a test and the next one i can mention um select the channel as email and now i can just mention configuration item so i will select mention select the configuration item as now what i will do i will definitely select the configuration item which has a support group let's say this one blackberry so i will copy this one and i will mention in my test case so i will mention select the configuration item as blackberry and here i will go to the next step now so i will mention here um assignment group should be auto populated populated with and i can just check this capacity management so i can just mention here that capacity management value should be populated so i will mention here with assignment group should be auto populated with capacity management group and you can just mention maybe like this and that's the name of the group and this definitely a verification so you are done so as per the new requirement you have mentioned the test case and i can just save this so this is saved and i can also make it ready so this is 100 ready because we don't have any other test case or any other requirement now just to make sure that this is matching the acceptance criteria the first acceptance criteria was that when you go to the incident module create new that ci and channel should be mandatory with caller and short description which are already mandatory so we basically met the acceptance criteria second acceptance criteria was that when you fill the details of incident form on a new incident form and when you select the configuration item then support group of that configuration item should be auto populated in assignment group so this is the second so we also so we are basically matching the both the acceptance criteria as per as part of our requirement so now we can definitely run this as well that means which is kind of a confirmation that you have performed the testing so let's say you have written the manual test case so how you can run this you click on this button run and maybe you can just mention demo or testing you can mention the environment this is the environment for maybe a development environment so it is our dev instance and i can just select development and that's it you want to put the url it's totally up to you can do that as well but let me just submit this so i have submitted and i will just click on run and you will see that how you can perform the testing as well so if i go here see it says impersonate as an idol user i can do that go to incident module create new caller this should be mandatory i can fail pass or block so i can pass it and then i go bottom i will select the caller provide short description uh select the channel i will select this blackberry and i will just mention assignment group i will see that if assignment group is populated so i can i can definitely check that and if it is done then i can pass it or fail it if it doesn't pass in that case i can just click on done and i am done with the testing and i can also see the results in this test management 2.0 here it says the results are passed so home server person whomsoever tester developer doing this testing you can track those results in service now itself in test management 2.0 we have also created the manual test case of our demo requirement now we will create automated test case so whatever test case we created manually we will convert the same test case into automation and that is also in automated test framework in service now so let's see how you can automate a test case in servicenow in automated test framework and how you can automatically test any feature you are developing in service now so let's go to automated test framework so i will just close these tabs uh or maybe i will close this one as well let's close this one and here i will go to automated test framework so i will type automated test so here we have automated test framework which is a application in service now to perform automation testing now how we are going to convert this let's see that so for that i will go to tests and i will create a new test so i will click on new and here i will provide basically validate i am new form this is the name i have given i will click on save now we will provide the test steps this is basically for automation so i will basically click on add test step it will provide me a lot of different categories of test step in this case first we will definitely create a user so i will select this create a user i will click on next and i will provide the variables so the first name will be because i have to provide the details of that user which i want to create so i will provide here atf itil atf itel and last name i can just mention user and i think it's basically asking any other user field values so maybe i can just definitely provide user id which is here i will mention atf dot idle e user and i can provide the role as well which will be idle so i will just mention itel and lock this one and i don't need to provide any other group yes i if you want to impersonate the same user then you definitely check this check box as part of atf creation atf step creation so i will just mention this and i will click on submit so our first step is converted into automated test case that means the previous one was in test management 2.0 impersonate it user that is done now i will just add another step i will click here the next step was we have to open the new incident form you can definitely do it by different ways you can directly navigate to the navigator basically module directly so here we have this navigate to module i click on next and i can select the module so i can just mention create new and maybe i will just click on here because i want to see where that create news in in what because create new module is available in a lot of tables so we definitely want on incident so if i type here so we have this one create new so i will select this one and i will submit this so i'm done this is the second test case conversion and then i will just go to yes next step uh well what exactly so it will open the new form automatically and i can directly validate the fields so i will go to form and here we have form field state validation so i will select so basically in order to check mandatory fields read only fields you always need to use this field state validation so i will click on next and i will also show you that how exactly this test will run so it will open the standard ui that's totally fine incident and here i think i don't want to add all these test cases for visibility and all because this is something you can definitely do but it's out of the box form so i'm not touching as of now because this is my just the first development so i'm just focusing what kind of customization i have done i'm just creating test case for that so i will just mention mandatory so here i will mention caller is mandatory and i will mention uh channel is mandatory so where is channel i will just select channel yeah so we have channel here i will mention configuration item is mandatory and short description as well so i will just lock them so these are the fields which should be mandatory so i will submit this so this is done now you can also if you want like if you really want people to understand because lot of people who are maybe not technical they might not understand these test cases in service now so there's a field here called nodes if you want to use that you can also use it so for example i can just mention that impersonate impersonate idle user and even here i'm just navigate to modules so i can just go to go to create new under under incident incident application and even this one validate if ci and ci and channel fields are mandatory other fields are definitely i definitely want to validate it's up to you if you want to write that or not so i have mentioned this now i will basically go for our next requirement so we we have converted the whole test case for our first requirement now i will move to second one so i will click on this add test step and here i will basically select so i will set the field value so i will set field value i will click on next and here i will set the value of configuration item so if i do this let me just cancel this first i will just select configuration item if i do this yes configuration item and i can just directly select blackberry so we have blackberry and i can select short description maybe short description i will mention this is a test i will select caller as maybe able tutor and i will select uh channel as maybe email and that's it so now i will just submit it so once you will it will select the configuration item i will validate that value in assignment group so that is field values validation so i will go next and then i can just mention here assignment group is and that is um if i go to here that's capacity management i can just mention this one so it is selected so it should check that assignment group is capacity management i will just mention timeout for 20 20 seconds and i'll just click on submit now let's see if it fails or pass overall we have converted our both the requirements into automated test case so it will validate field values here it will validate mandatory fields so now i will run this and this will run in a client runner so i will click on run it will open this and i will click on run test let's see what happens so it is running the test so our client runner is opened it will create a new user first so you will keep on saying see it has created the atf item user it is navigating to that module c we have all these fields mandatory yes that is passed and now it's validating the field values now it will try to populate see yes it has populated assignment group so it should definitely pass this test case and if i will go here 100 percent guys it is successfully tested that means we have 100 percent converted the manual test case into automation and i can just click on go to results and it will show me the whole whole flow that it created the user success navigated validated set the feed values and also validated the assignment group that's how you can do automation testing now one thing you have to remember that why exactly we do these kind of testing so let's say you have 100 requirements 100 jira story and after six months or or maybe after multiple releases of service now you definitely want to make sure that your existing features are working properly that is overall considered as a regression so you want to make sure that you run an automated regression by clicking one button which is run test and it basically validates all the features all the customization which you have done in servers now on top of base servicenow system and then you can validate that and it will make sure that after any further development even if you're adding one development you you will just make sure you after running the whole regression all the test cases all the main features of the platform or that particular module to make sure that nothing is broken so that's how you perform development and testing in service now so next time when you perform the development make sure you convert that development requirement into a manual test case or sometime people also just ignore manual test case or directly create automated test gates so you can also try that but overall the goal is you need to have a test case be it manual or automation however i will definitely recommend you should always go for automation because automation should be there in the system it will definitely ease your work because you can validate a lot of development in just one click and basically with the help of automation so thanks for watching this video have a great day [Music]
https://www.youtube.com/watch?v=N_nA8Gm9iVo