Transcript for:
Automating SOAP Services with Catalan Tool

hi everyone this is ravi welcome back to my youtube channel this is our lesson 11 on catalan automation tool concepts in my previous two sessions i have concentrated on the generic topics of api automation how can we perform api automation by using catalon automation tool and we have taken the sample rest services and we performed automation by using sample res services and also we have performed automating some of the validations by using sample rest services so basically we we are concentrating on automating the rest services as a sample test cases so in this session i'm gonna teach you how can we automate these soap services not the rest services soap services so i'm gonna show you some examples of soap services i'm gonna take an example of soap wisdom and then how can we convert soap wisdom into soap request messages and how can we automate soap request messages and how can we perform validation of soap responses right all these concepts i'm gonna teach you in this lesson it's very important session i'm gonna teach you all basic concepts and advanced concepts of soap request automation please do subscribe to the channel click on bell icon you'll receive notifications whenever i publish more videos thank you okay so in this session i'm going to teach you how can you set up api testing project in general and then how can you add soap web service requests and how to create a soap api test case by using the soap web service request that you added in previous step and also i'm gonna teach you how can you add web service keywords and validations for a given soap request message and how to validate the values in soap response and also how can you use inbuilt snippets option that is provided by catalan which will be writing the groovy language right so i'm going to teach you all these concepts with an example by using catalon automation tool so now without delaying let's jump onto the system and see how can we perform all these actions okay so this is my catalon tool okay so where we'll start automating the soap ui soap services okay so before we start working by using kettle on let me show you sample digital file that i'm gonna use okay so this is my sample digital file which i'm gonna use in automating the soap services so this wisdom file has let me show you how many operations this digital file has if you so if you add an extension call let me go to the extensions i have added an extension called wizzler so if you go to google wizzler chrome extension and then you can add visual chrome extension to your extensions okay as i already added it's showing me remove from chrome but if you don't add it's going to show you add to chrome okay so i already added that wizzler extension if i click on this visual extension it's going to show you how many operations that are present in this digital file so if you see this is my soap one service one 1.3 version and if you see this is 1.2 so i'm gonna use only uh one so one service okay so if you see these are all the operations that we have under this soap digital service so let's go back to our catalog project catalog tool okay and so it's highly recommended to watch my previous two sessions session nine and test session ten to understand the concepts very well okay so as we did earlier as we automated the rest services in my previous videos the process or procedure will be more or less similar but there are some differences okay so first to automate any service you need to add the corresponding service or a soap request into an object repository okay so for that go to object repository right click and then click on new and web service request so here let's name this as country service country service and under country info service under country info info service okay before this let me do one thing let me create a new folder first okay let me create a new folder to organize our object repository i'm going to create a new folder stating that soap services okay i created a folder under this folder now i'm gonna add the soap web service request country info service under country info service i'm gonna take an operation called a country currency okay so let's put co un country currency okay and what is the url so the url wisdom url is this copy this paste it here click ok so as soon as you click ok it's going to add and it's going to create a web service request if you see i already have digital service and what is the method that i'm using i'm using get method because i'm gonna get the country currency information okay and here if you see here you have http body http request oh sorry basically when i am adding this i have not selected soap service okay so if you see here let me delete this again how to delete the service delete here and then again let me add okay because i want to show you any very important concept here right click add web service name this as country info country currency because i am performing the operation of country currency and then use the wisdom here if you see here earlier we selected the request type as rest now you need to select the request type as show so you need to provide you need not you can provide description or you need not to provide description click on ok so now it's going to create your rest request not soap request if you see here i can see visual url and then if you see the request message here request message body and authorization okay and here if you click on this load service function it's going to load all the functions that are available in this wisdom what are all the functions available all these functions okay just click on load service function it's going to load all the operations or all the functions if you see here in the drop down see these are all the functions available okay i'm gonna select country currency and what is the country currency let's go to country currency here as soon as you select country currency i can see the post method here what is the post method url copy that url and paste it here okay done and now what is the request message body so here this is your request message body copy this and paste it here right and what is the string i want to i want to pass an iso code of usa let's say what is the usa currency i want to see what is the usa currency right we provided required message we provided a visual url and we loaded all the services and then we provided service endpoint what is the service endpoint this is my service how how i got the service end point by selecting the whizzler i selected country currency function it loaded the country currency body message and also the end point for the function the same endpoint i have provided here and now i have removed the default value from country iso code i am providing ios book code as usa let me run this request so before run i have to save the changes click on save and then now run the request so if you see here it is giving you what is the currency of usa it's a usd which is dollars u.s dollars is the code and the name is dollars okay so this way you can execute your web service request and then you get the response and also you can see the response status is 200. now how can you verify the response so there are two methods one is you can use your object repositories itself and within the web service itself you can add the verifications as same as the rest services that we did in my previous session go to verification tab and then here if you see the snippets you can use the snippets let's say i want to validate the status code of 200 so you just need to click on this status code so it inserts the code in groovy okay so that means i'm going to validate this one right so let's execute this when you execute this save the changes it's gonna execute and also it's gonna validate whether the status quo is 200 or not okay it's giving the response same response it validates this okay and there is another method where you will be adding the validations within the test case itself okay so let's create a test case for this first okay how can you create test case either you can create a test case by right clicking on the test case click on new and then create new so this method i have already explained you while automating the rest services but this time i'm going to use another method here in the latest catalog you can use this plus symbol to add a new test case so add to new test case that means this service will be automatically added to the new test case let's click here and then name this as soap country currency test okay click ok so as soon as you click ok it's going to create a new test case if you see here it is creating a new test case called if you see under test case folder you can have soap country currency test so it is sending the current c object okay and let's do one thing let me store this into a response the response i'm storing into a variable as same as we did for rest service okay so here let me execute this so whenever i execute this it's gonna send a request and then it's gonna store the response into a variable called response so it's sending a request see the response is successfully executed so basically the request is successfully executed so let's say let's say i want to let's assume the validation point whatever i inserted here let me change it to 201 okay let me change it to 201 response is 201 okay let's execute this test case again okay let's execute the test case again so let me save this let execute the test case now what happens we'll see exude the test case so it should fail actually the test case should fail let's see what happens so the test case is gonna pass why i'll tell you okay see instead of failing the test cases it's passed so why let me tell you one thing whenever you are performing any verification within the service you need to send a keyword called send request send and verify the request so let me add a new keyword here okay if you see here i will have a send request and verify another keyword you need to use that keyword to verify your soap service okay so here let me take my uh sorry let me take the let me add the service here okay country currency is my service okay i'm adding the country currency service here okay if you see when i'm sending send request and verify it's going to perform two actions one is it's going to send the request and it's going to verify the verification points that we added by using snippets okay so now let's go back to test case now let's save this and execute this first step should be passed and second should be failed because we added the response code as 201 instead of 200 okay so let me execute and what happens c the first step should be passed and second should be failed okay so it is executing the first test case the first test case will be passed and the second should be fail if you see here my first test case passed see first test case is passed second is failed why if you see here verification is failed because the expected is 200 but i am getting 200 sorry expect expected is 201 but the actual is 200 so let's go back to the request again now and let me change this to 200 and save this now if i run this both the test cases should be passed let me execute this again now two steps the two test steps should be passed so it started executing first step it is successful and then it should start test exuding second test case the verification should be successful if you see here now both the test cases are passed okay so what if what if i want to validate whether the response is usd the iso kodi but that means the country code the country currency is usd right i want to validate if this usd is correctly validated the response has usd as a currency code again there are two methods either you can perform validation by using verification tab within the service or you can add a new keyword and you can perform the validation within the test case let me first show you the process of adding the verification within the request okay how for that all you need to do is point your cursor in here and then click on control k control key and k what it will do it's going to add a json path json value it's going to add your json value json path okay how if you see here see it is what it is saying verifying the very verify element text of what of verify element text of the json path what is the json path under currency under country currency response under current country currency response so let me just bring this here under country currency response under this i have country currency results country currency response dot country currency results dot iso code is for code is usd or not right i'm validating if that json path has the value of usd or not okay so let me now save this service and now if i execute the test case above test case here it's going to validate both one is currently the response code and also country currency right so let's go back to test case and then let me delete the first case first step because we are we don't want to because i don't i'm not performing the verification here so it's unnecessary i want to delete this i want to execute this only first test i mean the second test case where i am sending the request and i am verifying okay let me execute this now it gonna validate your response status code which is 200 and also it's going to validate the json path where the value has usd as a currency code okay so i'm going i'm getting the response now okay so if you see the verification is successful let's do one thing let's go back here and let me change the verification this json path has let's say uh inr okay save this i'm verifying if the json path whatever the response i am getting whether that value is having usd or inr let's say i am expecting inr now it should fail because in the request i am sending usa as the country and the response i am expecting inr as a currency code which is wrong right so now let's save this and execute it should fail your test case execute this so it's going to send your request and then it's going to capture the response code 200 is going to get the correct value but the further currency is going to get usd but we passed inr see the verification is failed why because expected test is inr but the actual is usd simple right so you understand so let me just go back here and then let me correct the verification as usd okay let me correct the information as usd so that the test case will be passed right done so this is one method of validation what if i want to perform validation by using test case itself instead of service level so go back to your test case let's add a keyword now okay add a new step let me add a new step so before adding a new step i want to store the output of my first test case into a variable variable called response okay and now here i'm adding a new keyword verify element property value verify element property value what is the element property open here so the response is the response object is i am storing in response right so that's why i need to select it as variable and what is the value of variable response is my variable where i am storing now what is the locator what is the locator means i need to enter the json path here okay click ok so how what is the json path if you see here the json path of this usb we already added here see this is my json path i can copy the json path from here simply r you will find so you can file online tools to find the json path of any element of your response okay i'm copying the json path here go back here double click let's provide the json path here okay this is my json path and what is your what is the value that you are expecting in this json path i am expecting the value of usd click ok so what we are doing here from the response that we stored in the variable i am taking that response i am locating the json path and i am expecting the value of usd click ok and now save this now if i run this step my first step should be passed and also my second should be passed second step should be passed okay run this so now the first step is actually performing the same validation but by using the verification method within your object repository and the second step is performing same verification but it is performing the validation by using a different method if you see the second method also successfully passed is work whatever the response i got has usd as a value let's say second step i want to fail okay let me change this to inr in the response i am expecting inr as your currency code let me execute this now your second step should be failed okay so it's sending a request so first step is passed and my second step should be failed see if you see the second step is failed why because i am expecting the response currency code as inr inr but i am getting usd right so let me go back here and then change it to usd and save this so now you understand right so verification of any soap request can be performed within the request message web service itself by using your snippets here i have added a submit snippet of your occurrence sorry status code and also i have added a snippet of your json value path right json path if you see here this is what we used here json value check right either you can either you can click here and then replace your json path by using your this and the value by using this r r you can directly how can you insert your json include json path you can directly place your cursor either you can you can directly place your cursor here and then hit ctrl k what i am doing now i am also validating whether this currency name is displaying us dollar or not so i have added another verification method here right save this now if i run it's going to validate if the response has usd in the isv code and the response has dollars in the currency name right let's go back to your verification here save it and then first step when i run this it's going to validate two verification points total three verification points one is your status code 200 and your json path has usd as the response and another json path has a dollar as a response right and if you want to add the same response code here sorry the same thing you can perform same thing as from the test case itself how go back here copy this json path this time i am going to use this json path the json path is different now copy this now i am going to add another keyboard verify property value this time same thing i am storing the response in variable what is the response value response and what is the json locator this is my json locator what is the value that you are expecting i'm expecting a string and i'm expecting dollars as a value let me go back here and make sure that okay let me copy this paste it here done now save this that means now i'm valid i'm validating all the response values now execute this now it's going to validate all three of them so that means first step itself validating your usd and dollars value and also i'm using another method to validate usd and dollar values sorry usd and dollar values right so this way it's very easy for us to see your test case is passed now all the three steps are passed first step is pass second is part third is passed so this way you can perform soap ui automation soap request automation you can use your currency code sorry your snippets and all okay so if you see here the agent of our session is i've teased you how can you add your soap web service request in the object repository right we added soap service request in the object repository i already also teached you how to create a soap api test case we have created the soap api test case by using this option here itself and also i teach you how to add web service keywords and validations so we have performed validations and web service keywords within the test case itself and also i have teached you how to validate values in the soap response see we performed the we have performed the soap response json path validations by using test case itself and also by using service snippets right and then also i've showed you how to use the snippets in validation right so hope you all understand the concepts very well okay these are all very really very very important concept guys so if you have any queries you can provide your comments in the comment box and i'll try to respond to your queries please do subscribe to the channel click on bell icon you will receive notifications whenever i publish more videos thank you [Music] you