Assertion : Contains & Not Contains

T World
A free video tutorial from T World
Automation expert at theTestingWorld
4.4 instructor rating • 16 courses • 56,393 students

Learn more from the full course

WebServices/API Testing by SoapUI-Groovy|Real-time API|23+hr

Detailed Groovy + Certification Coverage + Soapui tutorial, Rest API Testing, Soap UI Free & Pro

24:30:02 of on-demand video • Updated November 2020

  • ** User can start work on real time Soap & REST API automation project ***
  • ** You can implement SoapUI on your work place or will also get ready for High Paying API Testing Opportunity ***
  • ** Detailed understanding of WebServices/ API and its automation using SoapUI ***
  • ** Detailed understanding of Groovy Scripting and its implementation in SoapUI ***
  • ** Ready to work in SoapUI Free as well as Pro Version ***
  • ** Ready to develop reusable & maintainable framework for API Automation ***
English [Auto] Welcome to the testing world in this session, we are going to cover assertions. We are going to cover two assertions in the session. One is contains address, not contains. First, we need to understand what do you mean by assertion? So whenever we are doing manual testing after running each test case, we are comparing actual results with the expected results if actual result is equal to the expected result. We are setting it pass else fail. Seem like men testing in soapie whenever we want to compare actual results with the expected result, that can be due by using assertions to summarize it with the help of the assertions. We can compare actual results with expected results. We have different type of assertions in this session. We are going to go two assertions. One is contained. There is not contains moving to my soap, a project through here. I have a project inside the project. I have a test read. I'm going to create a new test case. So right. Click on the Street Select Test case. So case one is the name of the test case that I have given here. I don't have any step in the test case. Some adding a step. Right. Click on the test steps added step. So that request I mentioned the name step one here. We have a lot of services. I'm going to select the service, get country by country code. My step one is created. I want to test the particular step is working fine or not, so I have given input in the country code, I'm running it and here we are getting response. From this hour. So now I have a test case in which I have a step to hit service in the step, I'm heading a service by passing country as an input and we are getting some output. So now I want to set some assumptions to make the assertion I'm going to a particular step. And here on the step, we have this. I can click on the assertion icon and first assertion we are going to cover is contains. With of the campaign's assertion, we can validate some text which is coming in the response, so here my response is this and I want to validate this response should contain text. In the. So I'm comparing, like, the response that I'm getting in the response we should have India as a text, you can ignore the case. So I'm ignoring the case. It might be possible that we are getting India in capital letter or in small letter or in mixed case, some ignoring the case. Later on, we are going to learn how to make regular expressions, so if we are writing some regular expressions, we can make this chat on. Click on OK, and here we see section is added, which is the container section, it is getting passed because as of now, we are getting in the end the result. I'm going to execute the same test case with another data and this time I'm passing the data, the US. So I'm running the test case. And here we can see my test cases getting filled. Because my doorstep is getting filled, go to the doorstep and here we can see it shows your assertion is getting fed double click on the content assertion and we are expecting India. But the result, we are not getting India from the south side. With the help of the container solution, we can validate data which is coming from the hour in the form of response before moving to the next assertion, I'm setting this country code to an. Again, it again, and this time it should pass because my country code was again, so in response, we should get India. So that is the one assertion we have convertors contains. Second assertion I want to move on is not contents, so sometimes we want to validate particular text must not come from the server. I'm making one more assertion I'm going to the property contents and here. We have another resolution is not contents so not contained so we can validate the text that should not be coming from the server. So I'm saying in any case, we should not get a text from the server. So I said, Adam, as a content that I don't want to see my response, I ignore the case. And click on OK, so here, as of now, all the solutions are getting fuzzy. I have made two assertions over here is a contained and not contains. If we want to validate some text must be coming from the server we can use contain assertion. And if you want to validate some text should not come from the server. We can go for that, not contents assertion. Thanks for watching this video.