Hello everybody. Today I will show you some tips on using SoapUI to test your software.
I have developed an application based on Web Services, so in order to test that, I use SoapUI which is a nice tool to test the web services by giving the WSDL location or address.
So Lets start.
Then you create a new one or you add it to an existing one.
The Request is then added to the TestCase. You can add multiple ones and fill the parameters then run the test. In order to make sure that you are the desired behavior see step3.
For the first time, running my test Suite, I was happy that everything is all right. Yeeeh I thought that my code is super but I have seen after that it is every time green even if I am waiting an exception. In fact, SoapUI consider that your test is OK when you receive a response independently on the request type.
Hopefully, there is a solution to fix that. It is by adding ASSERTIONS to your requests. Many assertions types are available, but here I use
- Fault SOAP : I know that my response is NOT OK and I would like that my Test Suite don't stops at that levl.
- NOT Fault Soap: Here, I suppose that the response shouldn't be an error or exception, If so my test fails and stops at that step.
- Contains: The returned result should contain some characters.
So here how to add ASSERTIONS:
Clic on the Request. The little botton on top (or The is also "Assertion down the request page") is the one to use in order to add assertions.
Many assertions are available and you can choose what fits to your case. For me I need mostly the NOT SOAP Fault, But SLA is also very good to choose a timeout for your resquest.
You can see down the added assertions :
So once you have added a NOT SOAP FAULT ASSERTION to your test case, if you receive an error and hence a soap:fault, your test you fail (RED) and you will know that something is wrong.
Executing the test Case, sometime we need to have some delay before executing the next step to make sure that the changes are commited in Data Base. So I was searching for how to add Delay before a request in the test Case.
This is possible by adding a special Step which is Delay.
So right clic on the Test Case -> Add Step -> Delay
Deploying my application on a remote server, my logs was not yet working (need to fix it ;) ). So I needed to execute the same testSuite on my Local Server. I was able to re-create the same test case, but SoapUI gives us the possibility to export only a testCase and use it in another project.
So clic on the Second project and import that Test Suite:
Hope that you enjoyed the small tutorial :).
I have developed an application based on Web Services, so in order to test that, I use SoapUI which is a nice tool to test the web services by giving the WSDL location or address.
So Lets start.
Step 1 : Open Project
You need to create your project either by giving the WSDL address or the path to your WSDL located locally in your laptop.
Step2 : Create you testSuite.
You can create a test case by cright clic on the project and create test case.
Or you can clic directly on the desired request and add to TestCase.
Then you create a new one or you add it to an existing one.
The Request is then added to the TestCase. You can add multiple ones and fill the parameters then run the test. In order to make sure that you are the desired behavior see step3.
Step 3: Add Assertions to your Test Suite
For the first time, running my test Suite, I was happy that everything is all right. Yeeeh I thought that my code is super but I have seen after that it is every time green even if I am waiting an exception. In fact, SoapUI consider that your test is OK when you receive a response independently on the request type.
Hopefully, there is a solution to fix that. It is by adding ASSERTIONS to your requests. Many assertions types are available, but here I use
- Fault SOAP : I know that my response is NOT OK and I would like that my Test Suite don't stops at that levl.
- NOT Fault Soap: Here, I suppose that the response shouldn't be an error or exception, If so my test fails and stops at that step.
- Contains: The returned result should contain some characters.
So here how to add ASSERTIONS:
Clic on the Request. The little botton on top (or The is also "Assertion down the request page") is the one to use in order to add assertions.
Many assertions are available and you can choose what fits to your case. For me I need mostly the NOT SOAP Fault, But SLA is also very good to choose a timeout for your resquest.
You can see down the added assertions :
So once you have added a NOT SOAP FAULT ASSERTION to your test case, if you receive an error and hence a soap:fault, your test you fail (RED) and you will know that something is wrong.
Step 4: Add Delay between too Steps
Executing the test Case, sometime we need to have some delay before executing the next step to make sure that the changes are commited in Data Base. So I was searching for how to add Delay before a request in the test Case.
This is possible by adding a special Step which is Delay.
So right clic on the Test Case -> Add Step -> Delay
Once the Delay Step created, change the desired millisecond and put the Delay Step before the request that you need to delay.
Step 5 : Export Test Case and use it in another project.
Deploying my application on a remote server, my logs was not yet working (need to fix it ;) ). So I needed to execute the same testSuite on my Local Server. I was able to re-create the same test case, but SoapUI gives us the possibility to export only a testCase and use it in another project.
So clic on the Second project and import that Test Suite:
Hope that you enjoyed the small tutorial :).
No comments :
Post a Comment