TestComplete Enters the Dojo – White Belt Edition
If you’ve checked out the API Testing Dojo at SoapUI.Org recently, then chances are you may have taken a swing at the Testing Katas. The testing katas are a great way to become familiar with processes in software testing - some basic and some more defined.
Whether you’re new to software testing or you just want to hone your testing chops, the Testing Dojo is a great place to do just this.Testing at the API level is very important, but what about the other parts of your software?
You certainly can’t be a testing master without touching upon all types of the software. The testing katas are not limited to API testing - you can use the same concepts for functional testing. There's really very little difference.
That being said, since the API level is taken care of, you can also combine forces with TestComplete to test the functional side of things, such as testing a SQL server for proper data construction or setting up automated tests for your GUI. Having the tools to test each section of your software will ultimately result in more testing cycles for the obscure tests that find those tricky edge cases.
So, in light of the success of our API Testing Dojo, I’d like to show how we can do the same on the functional side of software using our Web, desktop, and mobile app testing tool.
As I said before, the concepts are the same, but the setup is a bit different. So, give it a try. Using the same katas that are found in the API Testing Dojo, how would we scrape up functional automated tests of the same caliber?
While the API Testing Dojo itself is completely tool agnostic, I'll be using TestComplete to work through these challenges. If you'd like to get some hands-on practice with these katas, please feel free to install a free trial of the tool so you can follow along.
SmartFashion is a clothing store. It has an API that can be used by their own website or other websites they have partnered with, hence the need for the API.
The API is basically a CRUD (Create, Read, Update, Delete) API.
Basic Clients can:
- Search for items
- Buy items
Admin Clients can also:
- Add items
- Remove items
- Update items
Kata 1: The Sanity Test
Skill Level: White Belt
Based on the first kata in the Testing Dojo, we are asked to create a sanity test. Since we are not working with APIs when doing functional testing, we'll be doing conceptually the same thing, but on the GUI level.
As stated on the What Are Testing Katas? page, there is no absolute way to complete the testing katas - the point is to find your own ways to complete the task at hand in order to learn and become a better software tester.
To start, let’s imagine the same scenario as the SmartFashion one presented in the first kata. How would you go about creating a sanity test in TestComplete? Basically, we want to create a test that will input some data into a field and give us back something relevant.
In this example, create a small table in Excel or a database in MySQL. I would tag certain items for sale with a generic keyword. For example, if I searched for shoes the database should send back all items that have the shoe keyword. Simple enough, right?
If I looked up shoes in the search field and got back jackets, then it’s safe to say something is wrong from the get-go.
Kata 2 : Testing the Happy Path
Skill Level: White Belt
I use to create and manage databases. For some time I really enjoyed that line of work, until I went whacko from staring at data for over eight hours a day.
When I discovered the power of data-driven testing using an automation tool, I realized that testing databases manually was just a cruel joke my former employers were playing on me. In the same way SoapUI can test API databases, TestComplete can test all those other databases, such as MySQL and even the archaic CSV file.
In this kata, the challenge is to create a test suite that allows us to test a known input, which will execute without exception and produce an expected output. If you’d like to learn more about this scenario test, check out the Scenario-Based Testing page in the Dojo.
What you are doing in this kata is basically a simple data-driven test. In TestComplete, using the sample app provided (called the Orders App), you could enter a number into the credit card number field and click "Next." That credit card would be saved into the database without any exception.
For more on how TestComplete can automate data-driven tests:
Become A Data-Driven Ninja
The Complete Guide to Data-Driven Testing
Kata 3: Be Negative!
Skill Level: White Belt
Negative tests are a great way to find out how your app handles erroneous input. Think about how your app handles error conditions. Do you want your app to give an error if a user inputs letters into a field that should only accept numbers? I suppose that will all depend on what you are trying to do with the data, but let’s consider the credit card field. Chances are that you want the app to send back an invalid input error, for instance, “Bad Human! Don’t you know the difference between letters and number?! Please try again.”
Give it a try. Create a simple automated test in TestComplete that tries to input commands or data that break the rules of that process.
Need a little more information on negative and positive tests? Check out this eBook: Your Guide to Negative and Positive Automated Tests.
Kata 4: Setting Boundaries
Skill Level: White Belt
In your final challenge to determine whether you are truly worthy of possessing a white belt is to create some boundary tests. A boundary test is a special case of negative tests except that it's very close to the boundary in which input data should pass. An example of this would be entering "0" into a quantity field in the shopping cart of your app.
Of course the "0" could mean you don’t want to buy that item depending on how you built the app, but that would defeat the whole purpose of it being in the shipping cart in the first place. Let’s say you can only buy greater than 0 amounts of something. This would mean that "0" is not an accepted integer and should return an error—"1" would be the lowest acceptable integer.
Let’s also say no one can buy more than 10 of something due to shipping limitations. You would want to test to see what "10" and "11" return and observe whether or not it sends back the expected result.
You Are Now A White Belt in the Testing Dojo
I won't give all the credit to you because TestComplete does most of the heavy lifting, but these katas are a great way to get started with automated testing from the ground up. Generally, I recommend you start off doing all four of these testing katas as keyword tests and then do it again as script-based tests when you get a bit more comfortable with the tool you're using.
This concludes the White Belt Edition of the TestComplete Enters the Dojo. In the next edition, we will start using TestComplete for some more complicated types of testing.