Few tips to help you get better at building app features through Unit Testing

At MetaSys, we place great importance on writing unit tests, as it leads to faster development and reduces the time it takes for software to get to the production stage.Unit testing is the first step of software testing, where individual units/components of a software are verified. A unit refers to the smallest module of any software, and usually has one or more inputs and often a single output. The purpose of unit testing is to check whether the units are working as expected.

Unit tests help in finding regressions, test error cases and reduces the requirement for manual testing significantly. Unit tests also help in improving the code quality, e.g. if you are not able to write a unit test for a particular scenario, then it typically means that the code needs to be refactored. For a better understanding of the topic, I recommend reading Kent Beck’s book on unit testing ‘Test-Driven Development by Example’.
Having said that, here are my comments on Unit testing –

● Any *newly*developed app feature should not be considered complete until a unit test has been performed. This means, the development estimates should always include the unit testing time. For example, a developer might build a feature without writing a unit test and perform manual testing instead for which he might spend 24 hours plus an additional 24 hours to fix bugs and regressions. Instead, it would be better to spend 48 hours or less for building a feature by writing the unit tests, as it will ensure that the code quality is better. The developer will have more confidence in the code after completing the unit test. Unit testing is particularly useful for identifying regression bugs, as the same tests can be reused to prevent future regressions.

● Some existing applications do not have any unit tests because they have been developed by developers who have not prioritized unit testing, or may not have been aware of its benefits. When new developers who are aware of unit test concepts start working on the application, they should not necessarily interrupt the work to start writing unit tests for all components immediately. Instead, the process can be undertaken gradually. For instance, if they are working on specific components that lack tests, they should take the opportunity to write unit tests, at least to verify the newly added functionality. It is important that the project manager takes care of estimates for development time for writing unit tests for old components. Over time the code coverage for these components will increase and at some point in time, it may become sensible to set a goal specifically to increase test coverage.

Advantages of unit testing –
1. It reduces the level of bugs in the production environment.
2. It builds confidence in the developer.
3. It allows the code to be easily refactored or changed.
4. Regression bugs can be caught easily.

Disadvantages of unit testing –
1. In our experience, writing unit tests requires about 20-30% more time at the beginning of the project. For a complicated project, it may require even more time.
2. If the architecture/design of the project is not correct from the beginning, then tests need to be rewritten when the project is re-architected. This can turn into a major time loss.
3. For big/complex projects, unit testing alone is not enough. Typically, integration tests and e2e tests will be required alongside the unit tests to have proper test coverage.

As developers, we always look to reduce costs whilst still fulfilling all the project requirements. Unit testing can play a big role in achieving this. Unit testing helps any developer to produce bug-free and quality software with confidence.
Over the years, MetaSys has successfully built a robust testing environment to build custom software solutions. Feel free to reach us and do share your feedback in the comments section below.

Device and Browser Testing Strategies

Testing without proper planning can cause major problems for an app release, as it can result in compromised software quality and an increase in total cost. Defining and following a suitable and thorough testing procedure is a very important part of the development process that should be considered from the very beginning. Time should be specifically allocated to the manual testing on devices and browsers, as this is a low cost strategy to significantly improve the quality of the app release.  In this article, I will share some of the strategies we follow at MetaSys for real device and browser testing.

There are four points that we consider when defining our testing strategy.

  1. The first point is determining which devices and browsers will be used for testing. This is entirely dependent on the project requirements, and the development team analyses the application use cases to make the selection based on the following principles:
  • For web applications, we usually test on the three most commonly used browsers (Chrome, Firefox and Safari). If time allows for more extensive testing, we will also test on other browsers like Internet Explorer and Microsoft Edge.
  • For Device testing of web applications, we choose the devices based on the functional requirements and priorities of the applications. In other words, if a web application is supposed to run especially well on any particular device we focus the testing on the corresponding commonly used browsers with the appropriate resolution. For instance, for the Android platform we focus on Chrome and Firefox, whereas for the iOS platform we focus on Safari and Chrome.
  • For Native applications we directly test the application on the devices themselves, rather than using an emulator. This provides the most accurate feedback in terms of functionality and application performance.
  1. There are instances where the project timeline and/or budget limits the amount of testing that we can do. It is very important to identify these situations, and to develop strategies in order to still deliver high quality software to the client. At MetaSys we handle these cases by focusing on high level general testing, which covers most of the UI and the functional part of the applications.
  2. For functional testing of web applications, we utilise automation as much as possible. For repetitive testing of browsers, we usually design automated test cases. Using automation not only helps save the time of the testers, it is also very useful for retesting resolved issues. We use the Selenium WebDriver tool for automation testing and the Microsoft Team Foundation Server 2019 and the Microsoft Test Management tools for bug reporting and test case management.
  3. For web applications, we put a strong emphasis on performance, in addition to the ‘look and feel’., The speed of the app is one of the most important factors that determines the user experience. For performance testing we use the Apache JMeter and New Relic tools which give very accurate results regarding the application performance. The New Relic tool also provides an analysis of database query level problems, and gives many more reports and real time graphs. This helps significantly with troubleshooting, and improving performance.

At MetaSys, We have a team of experienced Dot Net developers who build solutions using Microsoft technologies. We have done web application development using ASP.Net Core, .Net & ASP.Net Framework, Visual Studio, Microsoft SQL Server, MVC, Team Foundation Server, Javascript and JQuery. For more info. https://www.metasyssoftware.com/dot-net

Agile Testing

Agile testing is a software testing process that follows the Agile methodology and the Scrum framework.

Agile methodology is a lightweight and effective development method.  Scrum is a Framework that supports it.  The main focus is on quick response to the customer requests or wish lists and an iterative method for application development and testing. Work is completed and reviewed in a set period of time which is called as ‘Sprint’. All iterations are of the same duration. At the end of each iteration, a working feature of the product is delivered to the customer.
How agile methodology in software development works:

  1. All requirements are in the form of a feature list and are added to the Product Backlog. The feature list is described in the form of a user story.
  2. The backlog list is prioritized and each user story is estimated.
  3. Based on the team size, sprint duration and complexity of the user story, a set of features is selected for each Sprint.
  4. Individual tasks are distributed among developers involved in the sprint.
  5. Development and Testing are carried out for all features selected in the sprint.
  6. A daily scrum meeting is conducted by the scrum master whose job it is to keep the team focused on the goal. Active participation from each individual of the scrum team is required. The meeting agenda is restricted to what was done yesterday and what you plan to do today and whether there are any known obstacles or risks.
  7. At the end of the sprint, a working feature of the product is delivered to the customer and immediate feedback from the customer is captured.

The role of Agile Testing Team:

  • In Agile testing, testing starts as soon as sprint development is done. The customer or product owner is involved with the progress of the software development. The whole team approach is to deliver a set of features which meet the customers’ current needs. The entire team works at the same workplace to allow for active collaboration. Throughout the sprint, the tester closely works with every team member and product owner to ensure better product quality and functioning. Team Interaction and active participation of each individual play an important role in Agile testing.

Why should one follow Agile testing methodology?

  • Testing starts at an early stage in the software development and features are tested within each Sprint improving quality of the product.
  • Defects are identified and either handled within the same sprint or added to the product backlog –to be taken care of by developers in the upcoming iterations while working on similar/relevant features.
  • Since defects are identified early in the development process, it reduces defect cost
  • Regular customer feedback increases the morale of the team and helps in improving the quality of the upcoming sprint work.
  • Priority features can be delivered early so that the customer does not have to wait too long. Low priority tasks can be completed later on. There is a flexibility to change scope/story points of the sprint based on the changes in customer requirements.
  • More focus on working software and Less focus on documentation.

MetaSys Software is a software services company with offices in Mumbai, India and Toronto Canada. Our team has experience in different development methodologies but we mainly prefer the agile approach to delivery. If you are looking for software outsourcing then contact us.