Sunteți pe pagina 1din 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

Introduction
So youve downloaded and installed soapUI. Smart move, youre on your way to testing greatness! soapUI is a very extensive tool though, and sometimes it takes some time to understand it in its entirety. Here are 10 very basic tips on how to use soapUI; following them might not necessary make you a better tester, but it will make you a more proficient user, and thats a good first step.

Please note the following: These tips are very basic. They are based on some common mistakes the absolute beginner tends to do, but might seem a bit simplistic for the sophisticated user.

We'll start of very simple with an important principle on how to interact with soapUI.

1) Right Click your way around

1 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

This soapUI people So, menus. would but so Next much once the first tip like never is simple will tip easier. you very toaddress might interact realize discover deep tip is; seem TestWare how wherever that with all simple, soapUI to the and structure features see you and but iswhat might all as consider your about available such shows be tests there in right it the up, a since in soft clicking, is soapUI. soapUI you so start. soapUI much might working interface, you be isnt surprised. can very with Right do. the lets Unfortunately Click This software call on is it very any Bullish will basic, item most become on you

Tip 2) Place your tests in a TestCase

2 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

There Practices, to tests, turn . TestSteps If is easier only well-structured of How and you Next we've That's you easier; use, the can select contain will do tip called follow amount learned is to most it. you will the just a run you certain Add and address structure a the take TestSuites drag testers them can number of here. test you to TestSuite tests a and structure TestCase clone as request project benefit structure how have drop created of that or steps, you , copy will TestCase, technical so it. to and .contains If should tests how much and make you called put tests soapUI their like already itfrom benefits, navigation name the in as TestStep that a purpose well actual using TestCase? wants have your already. as it that will structure tests, easier refer tests a and you TestCase also structure. Here method Well, to once called as handle them make you well is try you've how TestCases. you . have from right That as testing your it provide want created works: other so clicking structure tests, LoadTests easier much toA tests. add a you based TestCase them more itto for is (remember the have gain. not Its you; in clear on request loadUI. the terribly also a Test Best a can group structure overview much tip1?) in reuse to, hard Not its of

Tip 3) "What's in a name? That which we call a test"

Now when weve learned the importance of using the soapUI Test Structure, lets look at how you can improve the test readability. When you create a new TestCase soapUI offers an easy name for you, this is very helpful and even a very good solution in some cases, but not when you try building a serious industrial TestSuite. Letting soapUI names a test like TestSuite 3 or TestCase 349 will work fine when you have a handful of tests, ,but will you remember in 3 months or years time what TestCase 349 did? Or will your Test Buddy share the soapUI Project understand what TestCase 349 does?

Instead spend some extra time and go for a name that helps you understand what the test does, for example, TestSuite for validating that Customer Data Updates work or TestCase that tests increase of Reseller Discounts .

It makes interacting with the project much easier especially if you work hard at naming the TestSuites well as well, finding TestCase that tests increase of Reseller Discounts is so much easier if it is in a TestSuite named TestSuite for changing Reseller Terms. If you have worked with naming the project will be much easier to relearn after not touching it for a period of time an

3 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

d t also helps you understand what kinds of tests that are missing. So I have a TestCase that tests increase of Reseller Discounts, why isnt there one that tests decrease of them .

Wild tangent: Also, as the quote from Shakespeare in the heading for the tip discusses, doesn't the naming of an item alter the item itself? Isn't a test named "TestCase for adding a customer with too long SSN" in the TestSuite "TestSuite with negative tests for adding Customer" a much stronger and valid test than "TestCase 2" in "TestSuite 45"? Even though it's functionally identical? Doesn't the sign alter the signifier? And we're not talking about how we perceive the signifier, but the actual Signifier itself.

A good advice is also using the same way of naming Items in your project; doing this makes it easier to both name new Items as well as understanding them.

Now that weve looked at how to name your tests, we'll look at some tips about performing tests. Next tip is about the necessity of Assertions.

Tip 4) To assert or not to assert: that should never be a question


Testing in soapUI is all about the assertions, without them you cant properly say that you truly have performed a test. This begs the question: so, what is an assertion then? Simply put, assertions are checks that what you receive is what you expected to. An example; I have a Web Service where I search for a product by product id. In the response i expect the same product id in field named product id. If i do manual testing, I send the request and the look for the matching id in the response. This is what we call asserting. As you can see the assertion is an integral part of testing, yet quite a fair share of testing in testware is done without assertions and we'd like you to get into the habit of performing them in soapUI. An example of an assertion would be to say, If the response contains the company name eviware, the service Im testing seems to work.

4 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

Creating assertions is real simple in soapUI; you create them by going to the Assertion Tab in the soapUI request/response editor.

In the editor you click the button for New Assertion and then chose which type of assertion you would like. At first you can start off with a very simple assertion like the Contains assertion, which checks the entire response for a text, and then quickly move to the more accurate XPath assertion (look at soapUI Pro, the XPath assertions are real simple there), where you check for a text in a certain element in the response. The Contains assertions says "I want the text 'eviware' to be in the response", while XPath says "I want the text 'eviware' to be in the Company Name element response".

So now, go ahead and create an assertion:

5 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

See how Now work. "How request?". it's doI to time Ieasy transfer take It will toit something move all is? the be Don't contents to revealed the stop in next the there; of in response level an the element try next ofthe soapUI. and tip; other in Tip use aA response assertions 5) it question in Learn the next how and we as put Request", well to often Transfer itand in get an figure from or element Properties in new out soapUI-speak, how users in a they are;

Tip 5) Learn how to Transfer Properties

The second most used feature in soapUI after assertions would be the Property Transfer. If it's so widely spread, it's obviously useful, but what is it for? Well, the most common scenario in your soapUI testing is probably that you would like to take a value in a response and move it to a request; for example you get a sessionID in a response after a logging in and must use that sessionID in all subsequent requests. This is a very common scenario and Property Transfers helps you achieve this. Since transferring properties are so important and central there are two ways of doing it; Property Transfer TestSteps or Property Expansions . They both work fine, what you use is a matter of personal taste.

Both are extremely simple to do in soapUI Pro and a little harder in the Open Source version, but it doesnt matter; learn how to do it!

Lets see some screen shots from the soapUI Sample project to show how it works.

6 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

The Property Transfer Step is a TestStep in the TestCase ( see tip 2) that uses XPath expressions to select values and to place them, for example in a request.

The Property Expansion uses soapUIs internal format for referencing to other parts, for example an element in a request in soapUI

7 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

Read more about Property Transfer here http://www.soapui.org/Functional-Testing/transferingproperty-values.html and Property Expansion here h ttp://www.soapui.org/Scripting-Properties/working-with-properties.html

Next Tip; Tip 6) Read the Response

Tip 6) Read the Response

This is a short one, but very useful. When youve done the tests, you can see the results, step by step, by looking in the Test Log. This log is available for both TestSuites and TestCases and will show you every step that the tests run.

8 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

9 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

If you click on the Test Step you will see the actual result.

Of course this is very important when something fails, but also interesting when something is successful. Looking at the actual test run can be used to verify that the test ran correct.

Next tip: Use the log!

Tip 7) Read the Log


soapUI logs quite extensively what happens in the software; a good way to expand your knowledge about whats happening in the tests is learning to use the logs in order to see whats going on. Lets look at a very common example. You send a request, but arent getting any response back in the soapUI Response window.

10 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

There are a number of logs in soapUI telling you what might be wrong. For example, create an HTTP test (that is Testing Web for us deadly people) for the following URL; http://www.ghiklj.com, and send the request. You will not see anything in the soapUI Response window, but were you to look in the soapUI Log, you would see the following:

Fri Jul 30 15:57:08 CEST 2010:ERROR:Exception in request: java.net.UnknownHostException: www.ghiklj.comFri Jul 30 15:57:08 CEST 2010:ERROR:An error occured [www.ghiklj.com], see error log for details Fri Jul 30 15:57:08 CEST 2010:INFO:Error getting response for [HTTP Test Request]; java.net.UnknownHostException: www.ghiklj.com

Looking in the Error Log you see this:

Fri Jul 30 15:57:08 CEST 2010:ERROR:java.net.UnknownHostException: www.ghiklj.com

java.net.UnknownHostException: www.ghiklj.comat java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source)at java.net.Socket.connect(Unknown Source) at java.net.Socket.(Unknown Source)at java.net.Socket.(Unknown Source)at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultPro tocolSocketFactory.java:80) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultPro tocolSocketFactory.java:122)at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) at com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager$Http ConnectionAdapter.open(SoapUIMultiThreadedHttpConnectionManager.java:1666) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java: 387) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:17 1) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)

11 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest( HttpClientRequestTransport.java:187) at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:122) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

Although this is an exception in the error log, it does not mean that there something wrong with soapUI, studying the error message more carefully, youll quickly realize that the URL you entered does not exist. This is what reading the logs can help you with; finding out what's happening in the software.

Tip 8) Do a quick Load Test


Yes! Load Testing is a tip!

Wow, doesn't load testing take loads of time? Doesn't it take weeks of preparation? Nope, Load Testing is not scary or complicated at all. As a matter of fact; in soapUI its even easy and wont take you more than 10 seconds to create. Just right click (Yep, there is that Right Click again, remember tip 1?) a Functional Test, choose New LoadTest and, Hey Presto, youre ready to go!

But what's the value of creating the test? What will it do for me? Since a LoadTest is so easy to create, that means the overhead is slim and any warnings about performance issues you can find early on is very useful. Creating a quick load test can potentially save you a huge potential head ache in the future.

And if you want to take it one step further, download loadUI and run the Load Tests there. It's very easy and intuituitive and works the same way; right click and run. loadUI also gives you the

12 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

ability to scale the tests later. First distibuted to interna machines and later into cloud driven massive distributed monsters!

So don't wait, do you first Load Test. Today.

Following the first 8 tips you now should be a pretty decent soapUI'er. We'll end with two good tips for reaching the next level of soapUI masterdom. Coming up, Tip 9) RTFM!

Tip 9) RTFM!
For all and any record; the heading above is written with the outmost respect and limitless love. We're just trying to be a bit shocking but funny and this is the best we can come up with.

This tip might feel pretty obvious; if youre reading this page you obviously undestand the value of reading the manual. But lets be honest here, nobody likes reading a manual. But reading the manual can be helpful, and we have put a lot of effort and love into it and it will cover a lot of your needs. Wed like to highlight a few features in the documentation; 1. The Sample Project. There is a sample project in the soapUI Installation (In the Tutorials folder in the soapUI Installation Folder). Its great way of figuring out how soapUI works. There even is a tutorial around the sample project which is easy to follow. You can find it in the Getting Started Section. 2. The Getting Started Section Go to the Web Site. Go To the Getting Started Section. Use the tutorials, they are pretty great! 3. Search in soapUI. soapUI has got a great search functionality which lets you search the soapUI Community Forums. There are a lot of smart people hanging out there, so use them to find answers and also to ask questions. 4. Search in soapUI.org. We have spent a lot of time creating a very nifty search in the web site. Use it all the time!

13 / 14

10 Tips for the soapUI Beginner

Tuesday, 17 August 2010 19:48 - Last Updated Wednesday, 02 February 2011 10:00

Now, if you dont like the Forums or dislike the documentation or think the tutorials can be better, what do you do? Go to tip 10! Tip 10) 3, 2, 1, Activate!

Tip 10) 3, 2, 1, Activate!


If you feel like a soapUI Beginner, dont worry, there are thousands of you every week. Instead of hiding in your cubicle ashamed that you dont have a black belt in soapUI, go out there, search for information and be active.

There are a lot of good blogs and articles out there about soapUI, take a look in our In the News Section on the soapUI Web Site. http://www.soapui.org/soapUI-in-the-news/

Also, go to the soapUI Forums, http://www.eviware.com/forums , but dont be a lurker. Talk to the other users, answer questions you know the answer to and ask for answer the question you have.

We also really appreciate any feedback, even you suck! because if you tell us why we suck we can work at sucking less.

That's it!

You're now a fully fledged soapUI Master and ready to investigate what more soapUI can offer. Thanks for reading these tips, we hope they have helped you.

14 / 14

S-ar putea să vă placă și