Testing is a big, important part of the software development process. In this phase, we make sure that we identify as many bugs as possible, and fix them before we deliver our project. Well-done testing makes sure that you solve problems early and spend less time looking for bugs later on.

This step is usually very time-consuming, and more so if you have no idea how to test efficiently. If that’s the case, you might not be able to make sure that your software does what it’s supposed to, or if it performs the way you really want it to.

Code testing

Object-oriented testing is different from traditional testing methods. While traditional programming consists of various procedures that operate on data, Object-oriented testing deals with objects at various levels: algorithmic, class, cluster, and system.

  • The algorithmic level tests each method of each class in an isolated environment, to make sure they each work on their own.
  • The class level makes sure that once each method is checked on its own, they can now work together inside their respective classes without any problem.
  • In the cluster level, we take various classes that collaborate between each other forming a small subsytem. We then test to make sure that all the classes inside each cluster can collaborate and perform tasks correctly.
  • The system level takes all those clusters and forms a whole system. We then recreate various scenarios to make sure that the different clusters can work together without trouble, allowing our system to work properly.
Test cases

In object-oriented testing, we don’t just start performing different tasks hoping to find some bug magically. We need to take into account which method, class, or cluster we are building a test case for. Once you know which methods you’re going to be using, you then think about the purpose of your test, since each scenario should be created to represent and make sure that a specific requirement or feature works correctly.

We have three main testing methods in order to make sure that our system works as it should.

First is state-based testing. Here, we make sure that individual methods withing a class work properly. With this method, we are constantly checking the object transitions to verify that nothing’s out of place. You create an instance of an object, invoke its methods in order to check its state transitions, and verify that the final state is the correct one.

State testing scenarios

Second, we have fault-based testing. Like the name suggests, instead of finding scenarios where our program works as expected, we are now desperately looking for ways to break our own code. Sure, it sounds painful, but the only way to find faults is to try and break our program. You need to take into account every design and architecture aspect of your program to try and find ways to force your program to fail. This way, you can identify where failure is most likely to appear and design a solution for this.

Last, there’s scenario-based testing. This is most commonly used when we have a whole program we can test. We recreate various scenarios that the program might encounter in the future, and we check the state of our program with each run and each user interaction. You must set a start, a goal, and try to recreate as many ways as possible to get to said goal in order to identify any errors within your code.

Decently-fed student majoring in Computer Science. You probably don’t know me, but you will.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store