What is TDD (Test-driven development) and its Steps?

TDD has become the most popular over the past few decades. Test-driven development also famous and referred as test-driven design, is a method of implementing software programming that intertwines unit testing, programming & refactoring on the source code. TDD (Test Driven Development) uses a different approach to that used in traditional software development.

Advantages of TDD (Test Driven Development)

Simplification – Writing tests first permits software engineers to mainly consider what they want from the code as well as the functions that it will offer. It also forces expert engineers to only the right code in response to the necessities of the tests they have scripted.

Extensible & Maintainability -Old styles of development were faced with the number of challenges around maintainability as well as extensibility. Because TDD is ingrained into the development procedure at such a granular level, it is guaranteed that every single standalone code can be modified without risking side effects to other pieces of the software.

Improved code quality with Refactoring – Refactoring is a central procedure with TDD. It guarantees that developers are always strengthening their code base which will make sure that the software is modular and updated.

Steps of Test-driven development (TDD)

Test Driven Development Process

TDD has the following different steps:

1. Think and write test cases- In the first step, Developer writes the test case without any piece of code in front of him. This is mundane and time-consuming, but make sure that the developer understands the functionality essential and in accordance with that write the test case. The test case is not biased to showpiece of code works rather test cases are to test the expected functions.

2. Red – Run all tests and check failure of test case- The preceding step that follows is to ensure the correct working and that the new test doesn’t pass by any sort of mistake without any new code. This step also eliminates the possibility that the new test always passes.

3. Green – Writing code: In the next step writing code is done that clears the test. The new code isn’t perfect but is later changed as per the necessities. It’s merely designed to test and doesn’t enclose other functionalities.

4. Green -Run automated tests: If every single test case produced simply passes the test, it implies that the code meets all needed specifications. Hence the next step of the cycle can be Refactor the code to remove duplication and to clean it.

5. Refactor your code- This is exactly the same as removing duplication. A refactoring doesn’t damage any existing functionality and assists to remove duplication between production and test codes. The code is now cleaned as needed.

6. Repeat this cycle-The cycle is repeatable as in the past cases with a new test. The critical requirement is that the size of the steps should be simple and not extended, with around 1 to 10 edits between each test run. If fresh code does not satisfy a new test, the programmer should perform extra debugging. Repeatable integration offers revertible checkpoints.

Implementing Test-driven development can be challenging though because there is always the demand of the right people who have the required skill sets for using distinct unit test frameworks. If you have the expert people, then it is always far better to implement Test-driven development in your projects.

ImpactQA’s Test Automation strategies are designed to cover key business scenarios for your company’s software. We ensure your development process is uninterrupted by changes that can negatively impact the functionality and solution architecture. Our team addresses such changes as rapidly as possible by promptly modifying the testing routine.

The Vagabond of IT -Docker

In a world that relies heavily on the SOA and Micro services based applications, we often end up developing and testing an application in an environment that may or may not be the latest environment, thus causing issues for certain users who may not be using the same hardware/software configuration machines. The solution to that was tedious and required a lot of capital and manpower investment. To overcome this, the concept of Vagrant was developed. But that had its own limitations. Vagrant acts as a simulator of the live production environment and simulates the hardware and software configuration of an actual system. But like they say, no software is a perfect software, it had its own limitations.

Why not Vagrant?
Although Vagrant brought a revolution in the field of IT and was helpful in aiding the cause of continuous development, it limited the user to run their products on a single VM at a time. This meant that if a single VM had been converted to behave like a single deployment environment, to run the same product on a different configuration would require a separate VM. This would lead to over utilization of the system’s resources since each VM would need their own resources to run on a single machine.

How is Docker different?
Utilizing the concept of turning a VM into a deployment server from Vagrant, Docker took it to the next level. Docker is a tool that helps us virtualize the OS, filtering out the unwanted components and drivers and leaving us with a packet that not only contains our code but the entire OS. This process of creating packets is called as containerization and these packets are called as containers.

Using Docker, we can run multiple containers, each holding the same code but different configurations at the same time. Multiple instances/containers can be run on the same machine so long as the machine does not run out of resources.

How does Docker work?
Docker allows segregation of applications and OS in a lightweight package called a container. The container can be customized to reflect the behavior of the production server and with the help of scaling, the exact behavior of the production server can be reflected. This eliminates the issue that is commonly faced by the Developers, testers and Infra team where the code works on one of the environment and not on others or the one where the code works on one dev’s machine but not on others. If the container runs on one of the systems, it is bound to work on other systems that use Docker Engine.

Apart from eliminating the above mentioned issue, docker also helps in increasing the speed of delivery of the code. This is done by Docker’s ability to create a continuous delivery pipeline. This is aided by the fact that Docker isolates the process at the OS level, rather than the conventional VMs that do this on the Hardware level.

Conclusion
In a world where 91%*(*Data collected from https://techbeacon.com/survey-agile-new-norm) organizations either follow or are leaning towards following the Agile methodology, it is the need of the hour that organizations shift away from the conventional Development methods and adopt methods that can aid the quick creation, testing, and deployment of the Applications. These techniques are both applicable for the On-Premise and Cloud-based applications. One has to select the product based on the organization’s needs and the capital that they can spend.

Testing in Agile with Behavior Driven Development

Introduction

In today’s hyper-competitive business environment, organizations are constantly innovating to gain an edge in the market. Towards this objective, most organizations have adopted Agile and DevOps practices for delivering software. A common practice that has evolved much over the last two decades is automation of testing. Various tools and frameworks have evolved in these two decades with an intent to reduce the cost of automation as well as to popularize its use across various persona in the SDLC for enabling better collaboration and effectiveness.
One of the key challenges of test automation remained a lack of common understanding between the business analyst, manual tester, developer and automation engineer of what was being tested and how. Behavior Driven Development was introduced to bridge this gap and bring the domain expertise, business logic, and tests into a common framework comprising of a language based inputs and popular test automation tools.

Behavior Driven Development (BDD) Explained

BDD (Behavior Driven Development) style framework makes use of simple, domain-specific scripting language (DSL). These domain-specific scripting languages convert structured natural language statements into executable tests. The outcome is a closer relationship to the acceptance criteria for a given function and the tests are used to validate that functionality.
high-level structure of the implementation
BDD primarily works with open source tools and technologies like Selenium WebDriver, Appium and other Java-based libraries for test implementation and support. In this approach, Gherkin language is a layer of abstraction which works on an implementation layer which in turn is integrated with the execution layer. Figure 1 depicts the high-level structure of the implementation.

Test scripts developed in BDD framework provides a clear picture of the behavior/flow of the system and applications under test, the input and its expected output.
BDD also supports various types of test data management approaches. The test data can be managed in the feature file with scenario outline and example as well as externally using various forms like JSON, XML, Excel, etc.

BDD Tools

BDD act as a test layer that can be easily integrated with any type of automation framework. Some of the popular tools like Cucumber provide support for both pre-defined steps and customized steps which can be directly used by the testers for scripting. The different BDD implementation tools available in the market support various types of programming languages like Java, C#, Ruby, Python, etc. which increases the potential of framework customization and adaptability.

Selecting a BDD tool:

Every tool and approach have its pros and cons. Careful consideration has to be given in selecting the right tools in order to be successful. Before making any decision on the BDD approach implementation it is always advisable to understand the application flows, features, behavior and the kind of testing that needs to be performed. There should be a thorough research on the fitment of BDD with the framework along with a proper design which makes the BDD implementation more successful.
In order to reap the maximum benefits of a tool or an approach, it is always advisable to follow its best practices.
Caution: BDD may not be the ideal framework in every situation. E.g. in case of scenarios comprising of the very large number of test steps, BDD framework could result in increased test script maintenance. It is always advisable to externalize the test data from the test scripts and the code implementation. Hence the feature file’s test data management feature is not recommended if the test data is huge.
If you have an existing product and you want to automate a large set of regression tests, (re)writing these as feature files using Gherkin syntax and parsing them in your framework would not add much value as the feature is already developed.
If the test case scripting in BDD form is not carried out in a controlled or disciplined way, it might lead to certain problems like duplication of steps which would result in the unmanageable and confusing framework.

Common Features of BDD tools:

Some of the features of Cucumber (commonly used to implement BDD framework) are mentioned as below:

  1. Uses plain English user-friendly language to script.
  2. Open source and easy to understand and implement.
  3. Test data can be managed with feature files in case of small applications and externally for medium and high complex applications.
  4. Supports informative and detailed test execution reporting. There are options available to plug in various different reporting libraries like extent reports, cucumber enhanced reports, etc. with the BDD framework. These reports can be customized as per the requirement of the project.
  5. BDD framework can be easily integrated with Jenkins and other related tools in order to support Continuous Integration and delivery models.
  6. BDD framework implemented using these tools can be easily integrated with 3rdparty tools to support Test Management and Defect Management processes.
  7. BDD style frameworks are supported for all the platforms and applications like Desktop/Mobile Web and Mobile Apps.
  8. Parallel execution, headless browser execution, API based execution are all achievable with BDD. There are a lot of open source tools available in the market supporting these concepts or integrations. To name few of them, Selenium and Appium grids with Cucumber to support parallel execution, Rest Assured to support API based executions, etc.
  9. BDD framework also supports Cloud-based execution with various providers like AWS, SauceLabs, Xamarin, etc.

Best practices for implementing BDD

  • If the automation framework provides pre-defined steps to use, then there should be the proper availability of cheat sheet/document to refer otherwise it would really become a bottleneck for testers to script with the BDD style framework.
  • Actions/methods developed for the steps definitions should be reusable and mapped to unique actions or activities.
  • Features provided by BDD like Background, Hooks should be wisely used.
  • Feature files created should be unique and be mapped to the application features.
  • The detailed narrative should be provided to understand the feature and its scenarios.
  • As mentioned above, test data should be managed externally in order to separate test data management, test cases management, and the framework code.
  • There are a lot of online tutorials available to understand the workflow of BDD and its implementation with the different types of automation frameworks and approaches.

The Benefits of BDD

  • BDD test cases are in the form of plain English language, thereby reducing the need and effort of maintaining additional documentation.
  • With BDD, testers can script test cases in parallel to development, which in turn saves a lot of efforts required later during automation scripting.
  • Another important benefit of BDD is that even a non-technical tester can develop and maintain automation scripts, thereby reducing dependency on technical members who in turn can dedicate their time to software development.
  • High visibility of project’s progress to all the stakeholders is ensured with BDD (HOW?).
  • Cost and effort of testing a product reduce considerably.
  • Requirement traceability matrix can be easily generated with this approach.
  • Finally, the software/ product gets delivered with high quality in a short period of time, providing business agility

At ImpactQA, we have recently implemented BDD for automation in several projects and customers are reaping the benefits listed above. For any questions or comments, please reach out to us at services@impactqa.com

Technology is the new Addiction.

 
Technology is the new Addiction.
Any sufficiently advanced technology is equivalent to magic. – Arthur C. Clarke
 

What is Technology? Is it a helping hand for us? Or is it a substitute meant to replace us in future?
Technology according to us is a very vast term, where even a simple tool/machine like a hand fan is known to be a part of innovation and a big tool like Artificial Intelligence is also studied with equal relevance.
Technology or should we say ease of getting things done has become a part of our DNA. Today, a new born baby within few months, learns to operate an iPad or an iPhone. There used to be a time when young children used to learn how to operate a normal kid’s toy and probably failed at it.
It seems as if today’s generation has some sort of coding embedded in their DNA which enables them to start operating any gadget at an early age.
With advancement in technology, today almost everything is possible. Maximum of the things have been automated and with AI being developed so rigorously, in the future we wouldn’t need Humans to do our work. Everything would be automated.
Cars have become self-aware (Google Self Drive Car), anything you want can be printed in 3D with help of 3D Printers, any color you like can be scanned and picked up to draw or write. Nothing seems impossible in today’s world.

                                                

Despite using science and technology to better our lives, we are the real slaves to technology. We indulge in the need to always have something electronic in our hands – a tool that connects us to the Internet, our games or to our social networks. We’re bypassing the real world to get a digital quick-fix; our work, play and plans for stress release seem to depend on a broadband connection.
Now, fast forward this situation to a decade from now. You see adults sitting around a table in a Wi-Fi-enabled café. Chances are they are not going to be talking to each other, not in the real world at least. At home, fights and arguments will occur a lot more often between spouses due to a lack of communication, and it’s not going to get any better when this generation has kids of their own.
This is the whole point of technology.  It creates an appetite for immortality on the one hand.  It threatens universal extinction on the other. Technology is lust removed from nature. The real danger is not that computers will begin to think like men, but that men will begin to think like computers. Still, we feel that, end of the day human touch or interaction is very important. Future may have 100 different robots for 100 different things but the feeling of a human next to you can never be replaced.

Come to think of it, all of this is already happening right now.
Technology has slowly eased its way into our lives and formed glass walls between individuals who can communicate with each other but instead chose not to.
So, in the end we just hope that computer/robots/gadgets replace humans only for work and gives us more time to be with each other.

To know more visit us at www.impactqa.in
Like us at https://www.facebook.com/Impactqa123/