Automation, Functional Testing, Services Testing, SoapUI, Web Automation, Web Services, Web Testing

Adding ‘Events’ in SoapUI projects

SoapUi provides a wide range of features, and via these capabilities we can not only test our web-services as a whole but also we can implement muliple functions to test an application’s services.
Today I will discuss ‘Events’ in SoapUi so let’s get started.

What are events in SoapUI?
Events as the name suggest comes in SoapUi with a motive. We can leverage on this feature for testing various web services which require some pre-steps for completion. Let us understand this with an example. Let say we have a test case in which we have to test a scenario. This scenario is dependent on various test steps placed in this test case.
For instance, the test is to verify a search web service where-in we have to verify that search is working or not. Now for testing this we need to get into the application. And this web site takes user credentials for logging into the application. So what we can do in SoapUI is we can add event for beforeTestCase which will work for each test case. And that is how we can make reuseable test steps and get rid of writing similar tests again and again.
Another test case would be, if Application under test is such that we have to clear database before every test case, then what we can do is we can make a beforeTestCase which will be responsible for clearing database and setting up system. And we can apply the similar thing to many other test cases.

Do You Know: This is something very similar to what we have in JUnit and TestNG methods. Where-in we have different functions like BeforeTest, BeforeClass, AfterTest, etc apart from Test, which is specifically for writing test case. And we can leverage these in-built functions for further use.

How to make events in SoapUI?

Open SoapUI PRO.
Make new project or just click on an existing project.
You will get multiple options like Overview, TestSuite, JDBC Connections, etc. One of the tabs would be of Events. Click on this tab.
Click on the (+) icon. This icon will help you add new events for the selected project.

Once clicked, you will get a list where-in you can select the type of event you want to add to your project.

What type of events SoapUI PRO provides?
SoapUI provides quite-a-lot long list of the events. This depends on the type of test case you are dealing with. For example if you want to add an event in LoadTest then you can select the events having naming convention as LoadTestRunListener.XXXXX
For simple tests which are made out of rest services, just for verifications, you can use TestSuiteRunListener.beforeTestCase, TestSuiteRunListener.afterTestCase, etc.

Best part is you can loggers to these methods, for example if you want to add a note before/after each test run completion then you can use them. For example, the run of TestCase1 is Completed Successfully, or TestCase1 failed, please check the logs for more info, etc.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s