by admin | Sep 20, 2021 | Automation Testing, Blog, Latest Post |
Programming language for automation testing should never be chosen based on popularity. There are several factors involved in choosing the best programming language for Test Automation. While some may prefer an option based on the testing team’s skillset, some teams go with the programming language which was used to develop the application to be tested. Are these factors alone enough? Let’s find out as we will be exploring the factors to consider when choosing a suitable programming language for your automation testing needs.
What programming language is best fit for test automation?
We, as an automation testing company have faced this question multiple times from our clients during sales calls. But imagine if this same question is asked to a Ruby programmer, the obvious answer will be “Ruby is an excellent programming language that will satisfy all your needs”. We shouldn’t be surprised with this answer as a person who has been using Ruby for a while will seem to feel that way.
But if we take a closer look at the reality, we will understand that the Ruby, Cucumber, and Selenium combination was very popular among automation testers a decade ago. The lack of community support and the emergence of other programming languages have resulted in Ruby losing its popularity. However, if you use Ruby even now, you will still love it as the aspects that made Ruby great are still there. It’s just the popularity that has gone down and that in no way makes a great language bad.
So let’s jump straight to the point and take a look at the factors an automation testing team should consider when choosing a programming language for automation testing:
1. The Automation Tools in use
If the automation testing tool you’re using is the right fit but supports only a few programming languages, then you would be left without much choice as you would have to choose from the languages that are supported.
The Common factor
There could be times where the programming language used during the development stages would also be supported by the test automation tool and have a lot of test automation libraries that you can benefit from. During such scenarios, it is better to opt for that language.
Your Forte
Everybody has their own strengths and weaknesses. So if your company or team has testers with a specific programming background and the tool also has good community support for the language, you can go for that programming language.
Checklist
Performing this action will definitely help you make a more educated choice that fits your needs. You would have to prepare a checklist of the valid reasons that would justify the choice of not just the programming language, but also of the automation tool. So what you would have in your hand is a report of whether you are taking a biased decision or a decision with the mindset that is unwilling to go out of your comfort zone. Be very point-blank with your justifications to get the best results.
Now let’s go over some of the popular programming languages we have used thus far in our automation testing projects. But more importantly, we will also be seeing what made the language popular and thereby help you have a better insight when making that choice for yourself.
Java
When Selenium and Appium emerged in the market, the trend to write automation tests using Java also picked up. If you go to any Selenium tutorial page right now, you will be able to see the examples using Java in the very beginning. Maven and Gradle are two major value-adds for Java as you will be able to develop some unique test automation framework features using Java if you know the design patterns and Maven capabilities. It is also fairly easy to find an automation tester who is knowledgeable in the Java, Selenium, and Appium combinations.
Python
According to a report, in the year 2020, 29% of the tutorials that were searched for was for Python and 19% for Java. Python’s popularity explosion was very quick and the stats are a clear reflection of that fact. But that alone doesn’t make Python one of the best programming languages for test automation. We, as a software testing company, have started recommending Python to our clients as the support for the tool, the libraries for automation testing, and the talents from different regions also grew in tandem with its popularity.
JavaScript
JavaScript was originally introduced for client-side programming. No one even thought about using it for server-side until Node.js came into the picture. To adopt a programming language for automation testing, it should have a package manager which allows to upload & download the test automation libraries and the automation tool should have 100% support for the language. When Node.js and npm were launched, JavaScript got the package manager it needed and gained more popularity.
C#
When Microsoft made the .net framework open-source with (.net core), it enabled the support for Linux & macOS. This is turn resulted in C#’s popularity shooting up drastically. Nowadays C# is used widely for the development of Desktop and Gaming Apps. If your team is using C# for application development, then C# is a great choice for automation testing as well.
Conclusion
You can’t choose a programming language for automation testing by others’ opinion, and that goes for our opinion as well. As a leading QA Automation Services provider, we use Python, C#, Java for multiple automation testing projects. But we do not pick them at random as every project has its own requirement. We never fail to perform the evaluation using the checklist to pick both the automation tool and the programming language.
by admin | Sep 7, 2021 | Exploratory Testing, Blog, Latest Post |
Exploratory testing is so widely used nowadays that almost all agile methodology projects use them to good effect. So if you’re wondering what makes exploratory testing an important component that is needed for a product to be successful, we have a simple answer. Exploratory testing has the potential to not just identify, but to even resolve certain issues that may have gone unnoticed during scripted testing. But what makes it that way? If you give it some thought, you will understand that scripted testing doesn’t capitalize on the tester’s expertise. Though it has its own advantages, scripted testing alone is no longer enough to meet high-quality standards. As a leading QA company, we have employed mind maps for our exploratory testing documentation in various projects. So in this blog, we will be exploring why you should document exploratory testing using mind maps.
Exploratory Testing
Let’s have a brief introduction to exploratory testing before we head over to the exploratory testing documentation part. To put it in simple words, exploratory testing is a software testing method that involves focusing on the requirements, the test design, and the test execution at the same time. It’s a hands-on technique in which testers are involved in as little planning as possible while still performing as many tests as possible. Usually, in testing, the test cases are written in advance along with the expected results. After which, the testers will perform the tests and compare the actual result to the expected result.
What makes exploratory testing different is that the expected results are not defined, as not all results can be predicted. As mentioned earlier, exploratory testing can be used to tap into the potential of a seasoned software tester who has vast experience. Moreover, only an experienced tester will be able to perform effective exploratory testing as a fresher who might be even able to perform automation testing will suffer without experience. But it is a well-known fact that experience alone doesn’t make a person more adept in their field. So it is vital that the tester has the required expertise as well.

Why is Documentation Necessary?
Quality can’t be achieved by just finding the bugs, it can be achieved only if the identified bugs are fixed. That is why good documentation is an integral part of exploratory testing. Just imagine yourself being on any team, be it sports, IT, or any domain, it is of paramount importance that all the players on your team are on the same page as you. If there is a lack of communication within the team then you would no longer function as a team, rather you would be functioning as an individual in a group. Good documentation doesn’t just make it easy for every person on your team to understand your actions, it’s also instrumental in helping you maintain a record of your actions that can be used to reflect upon and create new strategies.
There are multiple ways one can document the test cases, but just like how exploratory testing has its distinct advantages, let’s find out what are the plus points of using mind maps for exploratory testing documentation.
Exploratory Testing Documentation using Mind Maps
Mind maps in general, have a lot of advantages for many use cases. But in this blog, we will be focusing on what makes them apt for documenting exploratory testing. Unlike formal descriptions, the structure of mind maps is very much adaptable to changes. It is a powerful approach that has the capacity to improve learning about the application/product and enable testers to solve the problem in creative and efficient ways. Since the expected results are not defined in exploratory testing, we can add new nodes during or after execution to cover the entire application. You can create as many test cases as you want in your mind map using different nodes, you even can add a node, edit an existing node, or delete a node as per the requirement.
For a better understanding of the exploratory testing documentation, let’s take a look at an example. The mind map we have used below illustrates the exploratory testing flow for the process of ordering a product from Amazon.
Mind Map for Ordering on Amazon

If not for exploratory testing, a tester would generally
→Check for the navigation smoothness
→Cosmetics check on each page
→Check for the timeout session
→Check for the amount deduction, reduction, etc.
But as an exploratory tester, he/she would have to perform the test cases using both mobile and web login. So mind maps are a great option for the high number of combinations that would be required during exploratory testing.
If the tester had to perform the same action, but as an existing user, then the general way to write test cases would be,
Positive test cases:
The primary objective here is to ensure that the login is successful when the correct credentials are given.
Entering correct email id or the phone number → Okay
Entering correct password → Okay
Negative test cases:
The objective here would be to ensure that the login is successful only when the correct credentials are given. So we would have to try out different combinations to make sure that everything works correctly as planned.
Combination 1 :
Entering incorrect email id or phone number → Okay
Entering the correct password → Supposed to throw an error → Okay
Combination 2 :
Entering correct email id or phone number → Okay
Entering incorrect password → Supposed to throw an error → Okay
Combination 3 :
Entering incorrect email id or phone number → Okay
Entering incorrect password → Supposed to throw an error → Okay
Despite using straightforward terms for a very simple scenario, this type of descriptive exploratory testing documentation might still confuse people. But at the same time, if we use a mind map to represent the same information, it will definitely seem simple.
Mind Map for Existing User

On seeing this mind map, even a non-technical person like a Business Analyst will be able to understand the way of testing. The visual representation helps to create an uncluttered outline of the entire process making it far more superior than the regular documenting that can be done on a notepad or similar tools. Apart from that, mind maps will be instrumental in predicting what other errors could be there based on the existing record and save loads of time and effort.
In the future, if there was an additional screen that was added after the login screen, it can be represented as follows,
Mind Map for Additional Feature

The above figure illustrates the concept of an additional screen that has been introduced next to the login screen as a part of security for the application. So according to that, even if the correct credentials are given the user would have to enter the captcha code correctly to successfully log in.
Conclusion
Since exploratory testing is also reliant on the tester’s cognitive skills, mind maps are an excellent choice that can bring the best out of the exploratory testing documentation process. Our highly skilled team has enjoyed using mind maps to provide the best exploratory testing services to all our clients, and we highly recommend you try it as well. We hope you found this blog to be informative. If you have any doubts or strategies you would like to share, make sure to use the comments section.
by admin | Sep 2, 2021 | Mobile App Testing, Blog, Latest Post |
The advent of technology has enabled many businesses to thrive through the power of the internet. There used to be a time when ventures had to rely on their physical shops and traditional means of advertising to establish presence and relevance in the market. Nowadays, it’s all about the eCommerce platform and its ability to showcase different products through an intuitive and user-friendly platform.
If you happen to run your online store, chances are you’re still trying to find ways to make it trend in your market. When promotional materials aren’t cutting it anymore, it may be time to invest in a mobile app to represent your online store.
It may seem trivial at first until you realize the different advantages that it may provide towards your venture:
1. A Wider Reach
Investing in the creation of a mobile application for your online store will attract more people to your products and lengthen your reach amongst the target market in general.
Most people now use their cellphones to accomplish various tasks and transactions, and investing in mobile apps means you wouldn’t be left behind, primarily if your competitors utilize them as well. Strike while the iron is hot and grab the opportunity to have your online store app now! Increase your sales by having more leads and customers upfront.
2. An Ever-Changing Trend in Sales
Mobile apps are customizable. Sure, you may retain its primary function as a storefront for all your products and branding. However, you may still change how they will be represented by utilizing different placements and designs, all of which can be accomplished with the help of your programmers and designers.
Remember that this may require you to look at the data from time to time to determine which designs are trending and how they may best acquire the appropriate reactions towards your brand. Just remember to be in sync with your data and creative team so that the core messaging of your brand will not come in conflict with the app.
3. A Whole List of Options and Preferences
Thanks to a mobile app, your target audience will never have to be limited by the options offered by your online app store. They will all have a specific rundown of products while hiding all the rest that they’re not interested in. For example, if you happen to be looking for a television, chances are you do not have any patience to go through a list of washing machines and vacuum cleaners just to find that 24-inch flatscreen.
If you want to attract more customers to your brand, implement this feature to add convenience to the interface. Just be sure to hire the help of mobile testing services so that this will be executed flawlessly.
Conclusion
There are various reasons an online store may need to invest in mobile application development. So as long as you know the different advantages that it may provide towards your brand, you may be able to make the most out of its functionalities and deliver an app that doesn’t alienate your intended market.
Focus on getting a wider reach, adjust according to ever-changing trends, and offer user-friendly navigation that your target audience will love in the long run. Do this all efficiently and watch your sales grow over time!
If you want to ensure the quality of your mobile app, you may need the help of mobile application testing services. In that case, we at Codoid will be more than happy to help you. We provide a wide range of QA services ranging from analytics and regression testing to mobile apps and game testing. Contact us today!
by admin | Aug 31, 2021 | Automation Testing, Blog, Latest Post |
We live in an era where instant gratification is wanted by each customer that buys a product or service. Knowing this, it is critical that businesses keep up with their customers’ expectations to prevent losing sales and customers to their business rivals. To do this, it is a must that companies administer continuous testing to their software to ensure that it will always be up to par with what customers expect.
However, getting started with continuous testing may not be something that comes naturally to everyone. Plus, even if you do get the ball rolling for your continuous testing for your software development processes, you may still face some significant roadblocks. This blog post will shed some light on what these possible challenges may be and how to deal with them.
Major Roadblocks of Continous Testing: What You Can Do
There are three major roadblocks that may hinder the development of the software that you offer. Overcoming these challenges is the key to ensuring that you keep your clients happy and satisfied in the long run.
1 – Bottlenecks Caused by Time and Resource Restrictions
Many times, the time and resources that are needed to complete sustainable development and test automation are underestimated. This being said, testing may come to a halt if these considerations are not thought of beforehand.
What You Can Do: Before getting started, it is vital to establish a testing agenda that supports reuse and data-driven testing. It is also critical that the testing team keeps individual test results up to date with the improvements being made to the software.
2 – Complexity
It can be extremely easy to get lost in the technical complexity of the test automation process. This task requires a vast amount of technical knowledge to be done correctly.
What You Can Do: To ensure that a team overcomes this roadblock, they need to understand how to automate the testing process and connect the data and results across different technologies. An in-depth understanding of these processes will help weed out critical defects and reduce complexities while undergoing continuous testing.
3 – Addressing the Results
As the continuous testing process goes on, there will come a time where there an immense amount of results will be produced. These results will render an extremely high amount of false positives. Looking into and analyzing these results may become tedious and highly time-consuming for the testing team.
What You Can Do: It may take time, but it pays to look into each result and take each one into consideration when making a release decision about your application or software products.
Conclusion
It is often said that we are now living in the Digital Age. It is getting more and more difficult to please clients. Producing state-of-the-art software that is cutting edge enough to satisfy your clients can only be done when you continually improve your products. Following the tips mentioned above and working with a reliable, tried-and-tested QA team will help you make sure that your software is always at the top of its game.
Should you need help in test automation services for your software, Codoid is an industry leader in QA. We don’t say this just to brag; we say this because it is our passion to help guide and lead the Quality Assurance community. Our brilliant team of engineers love to attend and speak at: software testing meetup groups, forums, Software Quality Assurance events, and Automation testing conferences. Contact us and let us help you test your applications today!
by admin | Aug 30, 2021 | Automation Testing, Blog, Latest Post |
Nowadays Appium is being prominently used for identifying Xpath or locators in both Android and iOS apps. But when it comes to iOS, we would have to spend a lot of time configuring the real device using Xcode for Building the WebDriverAgent. If in case we don’t have the latest iOS Version, iPhone Version, and Xcode version, then we will be facing configuration issues. This is where a cloud testing platform like BrowserStack comes into the picture as an easy solution and alternative to such problems. So if you were looking for the steps to use BrowserStack for inspecting a mobile app’s locators, then you’re in the right place. As a leading automation testing company, we have been using BrowserStack for a long time. So in this BrowserStack Tutorial, we will be showing you how to use BrowserStack as a UI inspector for both Android and iOS apps.
App Live
Make sure to install BrowserStack and keep it ready to do the following steps. If you are still on the fence about purchasing an account, you can still use their trial period to check out how well it fits your needs. So now let’s see how we can test our mobile apps and view the developer logs via DevTools and also identify the mobile elements using the ‘Inspect’ option in DevTools.
Navigate to App Live as shown in the image below,

Let’s a look at the 7 easy steps that have to be followed in this BrowserStack Tutorial now,
i. Click on ‘Test with a Sample app’ as shown in the image.
ii. Upload your App using the given option. If it’s an Android app then upload your apk file here, if it’s iOS, upload your ipa file here.
iii. Select the device you want to test the app in.

iv. Once you have chosen the Real Device that you want to test in, the App will launch.
v. You will get a split-screen view as you see in the below image.

vi. So you will see a pane on the right side that will show the following three options, LOGCAT, INSPECT (BETA), and NETWORK
vii. Now, click on the ‘Inspect’ option, and then click on the ‘Play Button’ that appears to enable Inspector mode.
Inspector Mode
Once we have turned the Inspector mode on by clicking on the Play icon, we will easily be able to identify the locators and objects. All you have to do is hover the mouse over the element that you want to inspect on the mobile screen, and click on it. Once you have clicked, the XML snippet and the element we have selected will be highlighted as shown in the image below.

Right below the code snippers, we will be able to see the ‘Properties Table’ as well.
Highlighted XML code snippet:
>android.widget.ViewGroup
>android.widget.TextView
Properties Table:
The table will show attributes, keys, and values like the Resource-Id, Class name, Package Name, Index, Visible Text, etc…
Example:
Text: Login
Resource-Id: org.package:id/headerLabel
Class: android.widget.TextView
Package: org.package.alpha
Conclusion:
So using BrowserStack as a UI inspector is a very easy process that every tester must know. BrowserStack’s UI inspector has come in handy whenever there was any locator or object issue in the automation suite. We were able to come up with quick fixes and provide the best automation testing services to our clients as we were able to easily identify the locators and objects using BrowserStack. That is why specifically chose to cover that in this BrowserStack Tutorial. If you are looking to learn more about BrowserStack, kindly read our End-to-End guide on it.
by admin | Aug 23, 2021 | Automation Testing, Blog, Latest Post |
Dependency Injection is a design pattern used to create dependent objects outside a class and provide those objects to a class through different ways by implementing Inversion of Control. Using Dependency Injection, we can move the creation and binding of the dependent objects outside of the class that depends on them. JVM-Cucumber supports many different dependency injection frameworks, and one of them is Guice. As a leading QA company, we are always on the watch for new tools and frameworks to improve our testing process and so we tested out Guice as well. So in this blog, we will be showing you how to perform Cucumber Dependency Injection Using Guice.
Cucumber Dependency Injection Using Guice:
If you’re going to work in an automation framework from scratch or use an existing one, there are few aspects that you should keep in your mind. For example, you have to ensure that the framework is maintainable, easy to understand, helpful in avoiding coding duplicates, and quick to adapt to any changes. Though these are very basic aspects of a framework, it does require you to follow a few design principles and techniques in it. First off, let’s see why sharing the state between steps in Cucumber-JVM is a necessity.
Well, a Gherkin scenario is created by steps and each step depends on previous steps. That is why we must be able to share the state between steps. Since the tests are implemented as regular Java methods in regular Java classes. If steps are global, then every step in the same package or subpackage relative to the runner will be found and executed. This allows us to define one step in one class and another step in another class.
If you’re writing your first test, then there are high chances that you have just a few steps that can easily be fit into one class. But the real problem arises when there are a bunch of scenarios as it gets exponentially harder to maintain. So that is why dividing the steps between many classes is a good idea.
How do you share the state between different classes for Cucumber-JVM?
The recommended solution in Java is to use dependency injection. That is, inject a common object in each class with steps, an object that is recreated every time a new scenario is executed.
Note – Object State sharing is only for steps and not for scenarios.
Let’s take a look at an example scenario and find out how to share the state between multiple step definition files with a common object.
Example Scenario:
* David Orders a mobile phone from Amazon.
* He receives a defective product.
* He returns the product and requests a replacement.
* Amazon replaces the defective product.
Now, let’s split this example into the Gherkin format.
Cucumber-Guice\src\test\resources\Demo.feature
Feature: Replace the product
Scenario: Defective product should be replaced if user requests for replacement.
Given David orders the mobile phone from Amazon
When He returns the product for replacement
Then He will get a new product from Amazon
The example scenario we have seen talks about two different actions,
1. Purchasing a product from Amazon.
2. Returning a product.
So when we divide the implementation of the steps into different classes, the only file that gets affected is the steps definition. This is where Dependency Injection comes into play as we can use it to overcome this obstacle. So let’s see how to get it done using Guice.
The first change here would be to add new dependencies in the Maven POM File.
This is the dependency for Cucumber to use Guice:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-guice</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
This dependency to use Google Guice:
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
<scope>test</scope>
</dependency>
Maven POM File:
This is how the Maven POM file will look like:
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>Cucumber-Guice</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<junit.version>4.12</junit.version>
<cucumber.version>1.2.5</cucumber.version>
<selenium.version>3.7.1</selenium.version>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>22.0</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-guice</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>${selenium.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
The next step would be to create two classes for the steps. Let’s call them CustomerSteps and ProductSteps.
The idea here is that these classes will share state between steps that depend on the result of an earlier step in the scenario. It is known that sharing state can be done in different ways, and we have used a new class that holds the common data here.
Example:
src\test\java\DemoGuice\Steps\DemoCotainer.java
package DemoGuice.Steps;
import DemoGuice.Pages.ProductPage;
import DemoGuice.Pages.CustomerPage;
import cucumber.runtime.java.guice.ScenarioScoped;
@ScenarioScoped
public class DemoCotainer {
CustomerPage customerPage ;
ProductPage productPage;
}
In the above code, the democontainer class is annotated with @ScenarioScoped. So Guice will be able to acknowledge it as something that should be created and made available in different classes.
If we want to use this common data in each step definition file, we can add a constructor that takes the democontainer as an argument. This is where the injection occurs and so let’s take a look at an example to understand it better.
Example:
src\test\java\DemoGuice\Steps\ProductSteps.java
public class ProductSteps {
private DemoCotainer demoCotainer;
@Inject
public ProductSteps(DemoCotainer demoCotainer) {
this.demoCotainer = demoCotainer;
}
Now we can use the democontainer to access all of the common fields that are needed across the step definition classes. Here, we have annotated the field democontainer with @Inject. It is worth mentioning that you have the choice to annotate a constructor or a field to allow Guice to set the value. This enables the shared democontainer object to be available for all the steps definition classes.
Implementation of ProductSteps class:
src\test\java\DemoGuice\Steps\ProductSteps.java
package DemoGuice.Steps;
import com.google.inject.Inject;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class ProductSteps {
private DemoCotainer demoCotainer;
@Inject
public ProductSteps(DemoCotainer demoCotainer) {
this.demoCotainer = demoCotainer;
}
@Given("^David orders the mobile phone from Amazon$")
public void davidOrdersTheMobilePhoneFromAmazon() {
demoCotainer.productPage.orderMobilePhone();
}
@When("^He returns the product for replacement$")
public void heReturnsTheProductForReplacement() {
demoCotainer.productPage.requestForReturn();
}
}
Implementation of CustomerSteps class:
src\test\java\DemoGuice\Steps\CustomerSteps.java
package DemoGuice.Steps;
import com.google.inject.Inject;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class CustomerSteps {
@Inject
private DemoCotainer demoCotainer;
@Inject
public CustomerSteps(DemoCotainer demoCotainer) {
this.demoCotainer = demoCotainer;
}
@Then("^He will get new product from Amazon$")
public void heWillGetNewProductFromAmazon() {
demoCotainer.customerPage.receiveNewProduct();
}
}
Conclusion:
We hope you had an enjoyable read while also learning how to use Google Guice for performing cucumber dependency injection. Using Dependency Injection to organize our code better and share state between step definitions has been helpful in streamlining our process to provide the best automation testing services to all our clients. Make sure to stay connected with our blog for more informative blogs.