by admin | Nov 2, 2021 | Automation Testing, Blog, Latest Post |
Jenkins has risen to become an expert in Continuous Integration, Continuous Testing, & Continuous Delivery, and assumes a critical role in conveying great applications or items. It utilizes a component called the Jenkins pipeline for achieving Continuous Delivery (i.e.) the capacity to deliver applications routinely for a long stretch. This Jenkins pipeline guarantees that the product is consistently prepared for creation. As a leading QA Company, we have been using the Jenkins Pipeline and found it to be very effective. So if you are looking for a Jenkins Pipeline Tutorial that covers everything from the basics of the pipeline to learning how to perform parallel execution, you’ve found it.
What is a Jenkins Pipeline?
A pipeline in the Jenkins CI/CD can be defined as a series of events or even tasks that are interconnected to each other in a specific order. To put it in simpler terms, the Jenkins pipeline can also be characterized as a set of modules or plugins that enable the implementation & integration of the Continuous Delivery pipelines within Jenkins. It has an expandable automation system that can be used to build basic or complicated ‘template’ distribution pipelines via the Domain-specific language (DSL) used in the pipeline. Continuous Delivery in the Jenkins pipeline comprises 4 major states,
- Build
- Deploy
- Test
- Release
We will be taking a closer look at these states later on in the Jenkins Pipeline Tutorial, but first, let’s take a peek at the many advantages that the Jenkins pipeline CI/CD has to offer.
Advantages of the Pipeline:
- It can divide the jobs into parts (build /test /deploy) and each part can run in each agent.
- Parallel execution of stages is easy to configure and so it can be instrumental in saving time.
- Each stage can execute the different versions of JDK/MVN versions.
- It can be retriggered even from a failed stage.
- Visualizing the build flow becomes possible.
- The build can hold until the user gives the input.
- Version control and code reviews are made easier.
- We can pause and restart the build as and when we wish.
- It will automatically be created as sub-branches in a multi-branch pipeline script.
Pipeline’s Basic Keywords:
Knowing the basic keywords that will be used in the pipeline is the first step that we will be taking in our Jenkins Pipeline Tutorial. So let’s see what these keywords are and how you can use them in the pipeline. We’ll start with ‘Steps’.
Steps
- Steps have to be written inside the stage directive.
- Steps contains the command or scripts that we’ve used in the build.
-
- One step’s directive should be there in the stage directive.
Stage
- Stage defines a particular stage (build/test/deploy/..) of our job.
- There has to be a minimum of at least one stage.
- The name of the stage will be displayed on the Jenkins dashboard.
Stages
Stage and Stages are two different keywords that you shouldn’t confuse yourself with.
- It contains a sequence of the stages we saw earlier.
- There has to be at least one stage.
Agent
- It defines where we need to run our pipeline script. (Master/Slave/Container)
Stage color
So using color, we will be able to find out the current status of the stage.
- White – The stage hasn’t yet been executed.
- Green – The stage is a success.
- Blue Lines – The stage is being executed.
- Red Line or Red Lines – The stage has failed.
- Red (If in case few stages were a success and one failed, it will show red even if the few have been successful)
Types of Pipeline
1. Declarative pipeline
2. Scripted pipeline
So as seen above, there are two types of the pipeline, and the declarative pipeline is the recent addition that has the more simplified and opinionated syntax when compared to the scripted pipeline. Now let’s take a look at the syntax for these types.
Declarative Pipeline syntax:
Pipeline {
agent any
stages {
stage(‘Build’) {
Steps {
}
}
stage(‘Test’){
steps {
}
}
stage(‘Deploy’){
steps {
}
}
}
}
Scripted Pipeline Syntax:
node {
stage(‘Build’) {
}
stage(Test’) {
}
stage(‘Deploy’) {
}
}
Variables in the pipeline:
What is a variable?
A variable is used to store values. There are two types of variables, and they are predefined and user-defined variables.
<variable name> = <variable value>
Predefined Variable:
pipeline{
agent any
stages{
stage('pre'){
steps{
echo " predefined variable $BUILD_NUMBER $WORKSPACE "
}
}
}
}
Output:
User-defined Variable:
User-defined Variable we can define in root level or stage level
pipeline {
agent any
environment{
MYHOME="Chennai"
}
stages{
stage('User'){
steps{
echo " userdefined variable $MYHOME "
}
}
}
}
Output:
Parameters in Pipeline:
Parameters are used to pass the following types of data dynamically.
- String
- Text
- Boolean
- Choice
- Password
- File
Implementation of Parameters in Pipeline:
pipeline{
agent any
parameters {
string(name: 'DEPLOY_ENV', defaultValue: 'staging', description: '')
text(name: 'DEPLOY_TEXT', defaultValue: 'RnD\nJenkins\nPipeline\n', description: '')
booleanParam(name: 'Are You Have Permission to Deploy', defaultValue: true, description: 'Toggle this value')
choice(name: 'CHOICE', choices: ['One', 'Two', 'Three'], description: 'Pick something')
file(name: 'FILE', description: 'Some file to upload')
password(name: 'PASSWORD', defaultValue: 'SECRET', description: 'A secret password')
}
stages{
stage('string'){
steps{
echo " string $DEPLOY_ENV"
}
}
stage('text'){
steps{
echo " text $DEPLOY_TEXT"
}
}
stage('booleanParam'){
steps{
script{
if(TOGGLE){
echo " now execute, booleann is true"
}else{
echo " Dont execute, boolean is true"
}
}
}
}
stage('choice'){
steps{
script{
if(DEPLOY_ENV=='staging'){
echo " choice $CHOICE"
}
}
}
}
stage('file'){
steps{
echo " file $FILE"
}
}
stage('password'){
steps{
echo " password $PASSWORD"
}
}
}
}
Output:
Parallel Execution in Jenkins pipeline:
We will be focusing on the parallel build using the Jenkins declarative pipeline in our Jenkins Pipeline Tutorial now. So you can trigger your build system by Jenkins if there are some steps that could possibly run at the same time since they have no dependencies. By following this method, you will speed up your build process and save time for other sequential steps. As one of the best automation testing service providers, we don’t just stop with using the best tools, we also focus on using them in the best way possible.
Parallel Execution:
pipeline {
agent any
stages {
stage ('My Java Project Test Scenarios'){
parallel {
stage('Unite Test'){
steps {
echo 'Unit test Completed'
sleep 5
}
}
stage('Integration Test'){
steps {
echo 'Integration Completed'
sleep 5
}
}
stage('Security Test'){
steps {
echo 'Security Completed'
sleep 5
}
}
stage('Selenium UI Test'){
steps {
echo 'Selenium UI Test Completed'
sleep 5
}
}
}
}
}
}
Output:
Conclusion
We hope you enjoyed reading our Jenkins Pipeline Tutorial and found it to be informative at the same time. As promised we have covered everything including the basics of the Jenkins pipeline, seen its advantages, explored all the perquisites like variables and parameters that you will need to know to use it effectively. So make sure you don’t just try the Jenkins pipeline, make sure you use it effectively.
by admin | Nov 1, 2021 | Mobile App Testing, Blog, Latest Post |
Automation tests are a crucial part of the process that makes sure your iOS app is up-to-par with the required standards. We can say without any doubt that the bar has been raised to new heights because of the standards set by Apple. Automation testing on their end is highly standardized. The apps must go through rigorous checks before they can be approved for the App Store. The parameters include numerous guidelines set by Apple that are followed up with strict implementation rules. The XCUITest framework not only allows you to execute automated functional and performance checks but also shares information across devices in order to identify any inconsistencies between them before it’s too late! So in this blog, we will discuss how the XCUITest framework will be instrumental in helping you meet the high standards set by Apple.
Though the XCUITest framework is a popular tool from Apple, it’s still an independent module with many features that can be harnessed by any developer in the industry – even beginners! We know that XCUITest provides a framework that can be used for testing your iOS app. Since it supports Swift and Objective-C languages, it allows you to write tests in either of these programming languages instead of coding directly with Xcode or using another tool like StoryTest. These interactions are more realistic since they reflect how users will interact with your mobile application on their own devices rather than just simulating this behavior through code while being tethered by wires during development – it makes integration easy!
As one of the best mobile app testing companies, we have been able to use XCUITest in our projects to reap the wonderful benefits it has to offer. So let’s explore the tool’s potential by understanding the need.
UI Automation Testing
UI Automation Testing is a relatively new practice and has only recently started becoming popular among software engineers who want more control over how their work gets tested before it goes live. Frameworks like XCUITest allows testers to develop clean automation test suites for an app’s UI. These tests can run on different devices to check if the apps work properly regardless of the type or size of the screen you use them on. This makes it very convenient when testing apps that have international versions available but aren’t yet localized. Now let’s take a look at a few benefits UI automation testing has to offer.
Preserving Time and Money
Automation will pay off your investment with far greater returns as time goes on. The primary reason is that UI has such an important role to play in helping the customer feel satisfied with any application. A poorly designed UI has the potential to single-handedly derail your app’s success.
Automating Code isn’t Sufficient
UI testing shouldn’t be seen as something that has to be ticked off in your checklist. It is one of the best methods to ensure that your application works perfectly. Many developers use third-party frameworks like Appium to automate repetitive tasks to save time and to be more thorough. Developers must also perform code test cases to check the behavior and interactivity with the other modules. But the issue here is that they do not have any metrics that show how development sprint cycles or new builds affect UI functionality.
For example, if it takes more than the expected time to load or if some change has rendered any component from the previous release to become non-functional now. There are so many more similar scenarios that could happen. So the developers will be at risk when automating manual tasks using Test Automation Frameworks like Appium. These tools are only useful to automate parts of an automated assessment, whereas, the entire context needs attention. That is why tools like XCUITest and XCTest are very crucial.
Basics of the XCUITest Framework
With XCUITest, testers can write test cases to check how an application behaves when user actions are performed and compare the results they get with the expected outcomes. Using the two fundamental concepts behind XCUITest, they will be able to precisely monitor what a person would experience while using your app by utilizing their input device or system. They would also be able to validate the current state at any given time based on the documented interactions from the earlier tests to simulate real-life use conditions before the release.
XCTest
XCTest is the base testing framework for both iOS and OSX apps. It provides testers with various tools to write test cases in either Objective-C or Swift, to create UI tests classes (e.g., methods), and to assert the behavior validation when running them through Xcode. So all of this would be seamlessly integrated at your fingertips with XCTest!
Accessibility Features
QAs can also add accessibility features to the apps for people with disabilities. Accessibility technology has given QAs a new way of testing the app’s functionality when it is being used by someone who may not be able to use conventional input methods or have full access to all the components on the screen. So the UI test cases are created using functions provided within the Accessibility Core library that executes and validates tests against various parameters including size changes in width/height values. Changing these values will paint us a clear picture of how our program behaves differently depending on the user’s perspective.
XCUIApplication
Every time testers need to automate a test for an app, they have to ensure that it’s launched by specifying the XCUIApplication instance and calling the launch method on this object before the testing even begins. It should also terminate once all of its tasks have been completed so that no lingering processes are left behind after the tests have finished running. It will help to avoid any problems with sensitive data being leaked or tampered with during the analysis stage.
XCUIElement
The XCUITest framework provides a suite of components to help UI testers with their tests. These elements can be used in different ways, such as navigating & interacting within the view or performing actions like tapping & swiping on the screen. The class is responsible for handling these interactions between the user input devices (such as touchscreens) and the app logic. It also grants you access to look into how an element hierarchy unfolds — this way; we know which parts will respond when interacted with by our users!
XCUIElementQuery
The XCUIElementQuery is one of the most important classes in the UI framework. This class will allow testers to search for a particular element on that user interface, perform some action, and then move on to another task!
Conclusion
Xcode has many built-in features which allow developers of all levels to quickly explore potential bugs in their software before releasing them on the App Store. Plus, getting started is fairly easy for any iOS developer as it can be done without having to learn a new framework or language. As one of the best software testing companies in India, we always make sure to use the best tools and wrote this blog to help others understand the importance of XCUITest.
XCUITest is a powerful tool to help you find issues in your app’s code and pinpoint the root cause. With XCUITest, we can fiddle with our apps’ UI elements and ensure that end-users do not encounter unexpected results or have poor experiences. It provides an excellent way to test mobile apps, but it will only work if the tests are running on real devices or in emulated environments with XCUI Automation Platform integration enabled – which gives us total control over the computing resources during our automated testing sessions.
by admin | Oct 29, 2021 | Selenium Testing, Blog, Latest Post |
When you are testing a web-based application, it is pivotal to ensure that they work without any issues in the browsers that are predominantly used by the world. Selenium WebDriver is a great tool that allows QA professionals to automate their test cases in their desired browser by using its library and a language-specific framework. As a leading QA company, we believe the ability to run Selenium WebDriver in different browsers is a basic skill every automation tester must possess. So we have written this blog to provide a comprehensive guide to the ones looking to learn how to run Selenium WebDriver in browsers like Chrome, Firefox, Safari, Opera, and Edge. So let’s get started with a few basics of Selenium and move forward from there.
Selenium
Selenium is a popular test automation tool that was developed by Jason Huggins in 2004 at Thought Works. It is an open-source automated testing framework for web applications that works with different languages such as JavaScript (Node.js), Python, Ruby, Java, or C#.
Different Types of Selenium:
- Selenium IDE
- Selenium RC
- Selenium WebDriver
- Selenium Grid
Selenium WebDriver:
We have already established how Selenium WebDriver can be instrumental in testing a web application across different browsers. But before you can get started with your browser automation, you should make sure to download the browser-specific drivers. Also ensure that the driver is compatible with your OS (Windows, Mac, or Linux).
Though we will be guiding you to run Selenium WebDriver in Safari that runs only on macOS, we will be focusing on how you can run Selenium WebDriver in the other browsers on Windows.
Different types of WebDriver:
1. Firefox
2. Opera
3. Chrome
4. Edge
5. Safari
Both developers and QAs have the liberty to choose the programming language of their choice all thanks to the wide range of language bindings that the Selenium developers have developed.
Now, let’s see a list of software that you will have to download onto your system to successfully automate your browsers. Make sure you download the most recent and stable releases.
1. Selenium Java Stable 4.0.0
2. JDK
3. IntelliJ IDEA
Environment setup:
Setting up an environment for testing is one of the very first actions we would be doing. So let’s see how to do that in Java.
- Open ‘Edit the System Environment Variables’ options by searching for it in the Search Box.
- Click on ‘Environment Variables’ -> Click the ‘New’ Button
- Enter the variable name as ‘CLASSPATH’, and enter the following variable value ‘C:\ProgramFiles\Java\jdk-17.0.1\lib\*.jar’.
- Click the ‘New’ button again.
- Enter Variable name ‘JAVA_HOME’ and Variable value ‘C:\Program Files\Java\jdk-17.0.1’.
Once it has been downloaded, verify it in your system without fail. You can do that by opening command prompt and typing java–version and clicking Enter. If there are no issues, you will see the details of the Java & JDK versions.
IntelliJ IDEA
- Open IntelliJ. Click File -> New -> Project -> Click Java -> Select Project SDK -> Next -> Select the “Checkbox” to Create project from template, Click ‘Next’ -> Give a name for the Project, and click on Finish.
- Click on ‘File’ -> Project Structure -> Platform Settings ->SDKs to Add Classpath ‘+’.
- Open the Selenium file and navigate to the Lib folder, select ‘All Jar Files’ and click on ‘Apply’.
- Make you sure downloading Selenium Webdriver in any compatible browser on your windows . Click the URL and go to navigate the Platforms Supported by Selenium and click the browser then you can the webdriver then download the documentation.
- Must you verify the browser version of the webdriver is here , then you can download and use it .
The syntax for the WebDriver
//System.setProperty ("webdriver.chrome.driver"," Enter the driver path with driver name.exe "); //
Keywords for Selenium:
In order to understand the sample codes that we have written, you have to know a few basic keywords that are used to perform certain actions in the automation process. We have just mentioned a few basic keywords, if you are looking to get a better understanding, make sure to check out our blog that will help you with it.
Action:
We can use these keywords to open a particular website, reload it, close it, and such other actions.
driver.get ("URL");
driver.navigate ().to ("URL");
driver.navigate ().refresh ();
driver.navigate ().forward ();
driver.navigate ().back ();
driver. Close ();
Locators:
These keywords are used to locate the elements using Selenium. Each keyword uses a different method and it can be easily understood by their names.
driver.findElement(By.id(""));
driver.findElement(By.name(""));
driver.findElement(By.xpath(""));
driver.findElement(By.cssSelector(""));
driver.findElement(By.linkText(""));
driver.findElement(By.partialLinkText(""));
Code to Run Selenium WebDriver in Multiple Browsers:
We have written sample programs that will help you understand the changes you’ll have to make when using each browser. So let’s take a look at each of them one by one.
Sample Program for Chrome:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class Main {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","D:\\Webdriver\\chromedriver_win32 (2)\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("https://www.snapdeal.com/");
driver.manage().window().maximize();
WebElement element =driver.findElement(By.cssSelector("ul[class='nav smallNav']>li[navindex='4']"));
Actions action = new Actions(driver);
action.click(element).perform();
WebElement element2 =driver.findElement(By.xpath("//span[text()='Keyboards']"));
Actions actions = new Actions(driver);
actions.doubleClick(element2).perform();
driver.findElement(By.id("searchWithinSearch")).sendKeys("logitech");
driver.findElement(By.id("swsIco")).click();
driver.navigate().to("https://www.snapdeal.com/product/logitech-k120-black-usb-wired/636481286288");
driver.findElement(By.id("buy-button-id")).click();
driver.close();
}
}
Sample Program for Firefox:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","D:\\Webdriver\\geckodriver-v0.29.1-win64\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.MICROSECONDS);
driver.manage().window().maximize();
driver.get("http://www.leafground.com/pages/Dropdown.html");
Select Select_training_program_using_Index1 = new Select( driver.findElement(By.xpath("//select[@id='dropdown1']")));
Select_training_program_using_Index1.selectByIndex(1);
Select Select_training_program_using_Index2 = new Select( driver.findElement(By.xpath("//select[@name='dropdown2']")));
Select_training_program_using_Index2.selectByValue("2");
Select Select_training_program_using_Index3 = new Select( driver.findElement(By.xpath("//select[@id='dropdown3']")));
Select_training_program_using_Index3.selectByVisibleText("UFT/QTP");
Select Get_the_number_of_dropdown_options = new Select( driver.findElement(By.xpath("//select[@class='dropdown']")));
Get_the_number_of_dropdown_options.getWrappedElement().sendKeys("Loadrunner");
}
}
Sample Program for Microsoft Edge:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
public class Main{
public static void main(String[] args) {
System.setProperty("webdriver.edge.driver","C:\\Users\\Admin\\Downloads\\edgedriver_win32\\msedgedriver.exe");
WebDriver driver= new EdgeDriver();
driver.manage ().window().maximize();
driver.manage().deleteAllCookies();
driver.get("https://facebook.com ");
driver.findElement(By.id("email")).sendKeys("7418894451");
driver.findElement(By.name("pass")).sendKeys("99664475");
driver.findElement(By.xpath("//button[@name='login']")).click();
driver.close();
}
}
Sample Program for Opera:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.opera.OperaDriver;
import java.util.concurrent.TimeUnit;
class Main{
public static void main(String[] args) {
System.setProperty("webdriver.opera.driver","C:\\Users\\Admin\\Downloads\\operadriver_win64 (1)\\operadriver_win64\\operadriver.exe");
WebDriver driver=new OperaDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.get("https://www.google.co.in");
driver.manage().deleteAllCookies();
driver.navigate().to("https://codoid.com");
driver.manage().window().fullscreen();
driver.navigate().back();
driver.navigate().refresh();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.MICROSECONDS);
driver.navigate().forward();
driver.manage().window().fullscreen();
driver.close();
}}
Run the WebDriver in the Safari browser
So as promised, now we are going to explore the two processes you’ll need to do to run Selenium WebDriver in Safari. Following this, we have a test script for the Safari driver to run. It is worth noting that we’d have to run an automation test in the Safari browser to enable this option.
Process 1
Step 1: Open the Safari browser and navigate to the Preferences.
Step 2: Enable the ‘Show Develop Menu’ on the Menu bar.
Step 3: Now you’ll see the new Develop option popup on your safari menu bar.
Step 4: Click on ‘Allow remote automation’.
Step 5: Once that is done, you’ll be able to run the web driver successfully.
Syntax:
Webdriver driver = new Safari Webdriver ();
//Since this Safari WebDriver there is no need to set the path of the driver for the respective browser, instead you would have to do it for the system.
For example,
System.setProperty("webdriver.safari.driver","C:\\Admin\\safaridriver(1)\\safaridriver.exe");
//Apple developed a Safari WebDriver that is compatible with all the safari browsers.
//If you can’t run a Safari WebDriver, you can activate the WebDriver by following Process 1.
Sample program for Safari:
package com.company;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.safari.SafariDriver;
public class Main{
public static void main(String[] args) {
WebDriver driver=new SafariDriver();
driver.get("https://codoid.com/ ");
driver.close();
}}
Conclusion
We hope you found this blog informative as a majority of software testers use Selenium WebDriver to automate their tests in different browsers. As one of the prominent automation testing service providers in the arena, we ourselves have been ardent users of Selenium WebDriver to automate our tests.
by admin | Oct 28, 2021 | Web Service Testing, Blog, Latest Post |
Long gone are the days where websites were predominantly accessed from desktops as people have started accessing websites from laptops, tablets, smartphones, and even smartwatches. There are countless models that have different screen resolutions and sizes under these categories as well. So you will be in deep trouble if you’re website doesn’t have a responsive design, as you will be driving away a massive chunk of your audience due to the poor design. It is not just about the aesthetic feel your design has to offer, functionality is also a crucial part of being responsive. Though bounce rate is an aspect to worry about, your website will not even be able to rank and reach people if your website isn’t mobile-friendly. Now that we have established why we need to test your website at different screen resolutions, let’s find out how.
There are various solutions that will enable you to test your website at different screen resolutions. As a leading QA company, we have shortlisted the best options for this blog.
Dev Tools
Understanding the growing need for websites to be responsive, many prominent browsers have made it easier for testers or developers to check it using Dev Tools. According to reports, the 4 most popular browsers are Google Chrome, Safari, Microsoft Edge, and Mozilla Firefox.
- In most cases, a regular right-click on any part of the website you want to test will show an option called ‘Inspect’ in the dropdown list. You can click on it to launch the Dev tools and the emulator along with it.
- Once Dev tools has been launched you can define the screen resolution as you choose or even choose from the list of predefined screen resolutions that come along with it.
- If you are testing a new device, then you can even add the custom resolution and save it by giving a name to reuse it whenever needed. You can refer to the below visual to see how it can be done in a few easy steps.
Unlike Google Chrome and Microsoft Edge Mozilla Firefox will not launch the emulator directly. Once the Dev tools window has been launched, you have to look for an icon that denotes a mobile and a tablet together and click it, or press ctrl+shift+M to launch the emulator.
When it comes to Safari, you first have to follow this series of actions.
- Click on ‘Preferences’ -> Advanced.
- In the menu that appears, you have to enable the ‘Show Develop menu in menu bar’ checkbox.
- Now, you will be able to view the ‘Develop’ menu in the menu bar. Click on that and select the ‘Enter Responsive Design Mode’ option.
The conventional way to launch Dev Tools for the other 3 browsers would be opening the ‘Menu’, navigating to ‘More Tools’, and then opening Developer tools.
BrowserStack
The first option we saw makes use of emulators to help test your website at different screen resolutions. But if you are looking to take it a notch higher and perform the test on real devices, then definitely buying all the devices in the market will not be a viable option. Here is where a tool like BrowserStack will come in handy as it is a cloud-based platform that will let us use real devices to test. Apart from using real devices for better assurance, BrowserStack will be instrumental in testing cross-browser functionalities. As one of the best mobile testing companies, we have used BrowserStack to great success in many of our projects. Though there are other similar tools, we believe BrowserStack to be the best.
Testing on Foldable Devices
Foldable devices introduce innovative screen configurations that require a thorough testing strategy to ensure your website remains responsive and user-friendly. Here’s a detailed guide:
1. Dual-Screen and Single-Screen Modes
- Scenario Testing: Test how your website appears in both folded (single screen) and unfolded (dual screen) states. For example:
- A gallery might span across two screens when unfolded but compress into a single scrollable column when folded.
- Content Flow: Check if content flows seamlessly between screens without truncation or misalignment.
2. Viewport and Screen Ratios
- Foldable devices often have non-standard aspect ratios, like square or ultra-tall screens. Ensure your website:
- Adapts dynamically to screen size changes.
3. Multi-Window and App Continuity
- Test how your website behaves in multi-window setups:
- Split-screen: Ensure UI components resize correctly when your site shares the screen with another app.
- Drag-and-drop interactions: Test any cross-window functionalities for seamless operation.
- App continuity testing ensures the site state persists during transitions between folded and unfolded modes.
4. Interaction Zones
- Foldable hinges may introduce non-interactive zones:
- Verify that essential buttons or links aren’t placed over these areas.
- Test gestures like swiping across the hinge or tapping near it.
5. Testing Tools
- Browser DevTools:
- Chrome DevTools: Offers presets for foldable devices like Samsung Galaxy Fold.
- Microsoft Edge: Includes dual-screen testing tools for Surface Duo.
- Real Devices:
- Physical testing on devices like Galaxy Z Fold or Surface Duo helps uncover hardware-specific quirks.
- Emulators and Simulators:
- Tools like Android Studio can emulate foldable scenarios for testing without physical devices.
Look beyond the norm
The conventional screen sizes we can see on a laptop or desktop are 1920×1080 and 1366×768. But many users are beginning to transition to desktop monitors and laptop displays with 2K & 4K resolutions. Also keep in mind that beyond the 16:9 aspect ratios that we are used with, there is also a rise in the usage of 16:10 aspect ratio displays that have different screen resolutions. These kinds of screen resolutions are mainly used by creators and it is sure to catch on as Apple has also been using this aspect ratio with their new range of laptops. The mobile devices we use nowadays are all touch screens, and many laptop displays are also getting touch displays. So make sure to design your websites for touch input to stay future-proof.
by admin | Oct 27, 2021 | API Testing, Blog, Latest Post |
Postman is one of the most popular software testing tools which is used for API testing. Postman is widely used by both software testers and developers for testing as it is easy to integrate with Continuous Integration (CI) & Continuous Development Pipelines. Postman sends an API request to the webserver and receives the response. As one of the leading QA companies, we have been doing our manual Rest API testing using Postman whenever it was deemed necessary. So if you are someone who is looking for a complete guide that explains everything from what is REST API to how it works to how it can be manually tested using Postman, you will definitely find this blog useful.
API (Application Programming Interface)
An API is a set of defined rules that enables computers or applications to communicate with one another. APIs sit between an application and the webserver and acts as an intermediary that processes data transfer between systems.
What is REST API?
- REST API (Representational State Transfer Application Program Interface) is an architectural style that allows the software to communicate with other software on the same device or over a network.
- REST APIs communicate via HTTP requests to perform standard database functions like creating, reading, updating, and even deleting records (also known as CRUD) within a resource.
Why REST API?
These are the major reasons as to why we choose REST API over the other options. REST API is
1. Easy to Learn & Implement
2. Easy to Build & Maintain
3. Scalable
4. Cacheable
5. Flexible and Portable
How does REST APIs work?
As stated earlier, REST APIs use HTTP requests for their communication. HTTP works as a request-response protocol between a client and server and enables client-to-server communication. For example, your web browser can be considered as the client, and the application on the computer that hosts the website can be termed as the server. So if your browser (client) submits an HTTP request to the server, the server will return a response that contains the status information of the request and the requested content if any were requested.
Common HTTP methods (CRUD commands) used in REST API:
Most of these commands have very straightforward names that make them self-explanatory. So once you have been introduced to them, it will be very easy for you to remember.
- GET – The GET method can be used to extract information from the given server using a given URI. It is worth noting that when you use the GET request, it should only extract the data and not have any other effect on the data. So no Payload/Body is required.
- POST – As the name suggests, a POST request is used to send data to the server. Data like customer information, files, and so on can be sent using HTML forms.
- PUT – Using PUT, you will be able to replace all the current representations of the target resource with the uploaded content.
- DELETE – It can be used to remove all the current representations of the target resource given by a URI.
There are other CRUD commands like patch, copy, and so on as well. So once you are thorough with these basics, you can explore them.
API Contract
We have seen the basics of REST API that you will need to know. There are also a few basics of Postman that you should be familiar with. But before we can move forward, we have to explore a few aspects of the API contract as you’d have to know the following information to perform manual REST API testing using Postman.
Endpoint:
It is the address where the API is hosted on the Server. An End Point Request URL can be constructed as below
Base URL/resource/(Query/Path)Parameters
Resources:
They represent the API/Collection that can be accessed from the Server. We have listed a few common examples below to help you understand better.
- Google.com/maps
- google.com/search
- google.com/images
Here maps, search and images are the resources of Google.com which is the Base URL.
Path Parameters:
Path parameters are the variable parts of a URL path. They are generally used to point to a specific resource within a collection in the same way how a user is identified by ID.
Example for Path Parameters:
- https://www.google.com/Images/1123343
- https://www.google.com/docs/1123343
- https://amazon.com/orders/112
Here 1123343, and 112 are the parameters
Query Parameters:
Query Parameters are primarily used to sort or filter the resources. They can be identified with ”?” (A Question Mark). You’ll be able to identify them once you see a few examples.
- https://amazon.com/orders?sort_by=07/09/2021
- https://www.google.com/search?q=newyork&oq=newyork&aqs=chrome..69i57j0l7.2501j0j7&sourceid=chrome&ie=UTF-8
Here orders and search are your resources and they are sorted and filtered by the query parameter that is followed by the “?”.
Headers/Cookies:
Headers represent the meta-data associated with the API request and its response. In layman’s terms, it will be used to send additional details to the API for processing our request. An example of it would be the authorization details.
Sample API Contract for Basic CRUD commands:
Apart from these values, we would also have to know about the HTTP method in use, the body, content types of the parameter and response (either Application or JSON), and also the response value. You will get a clear idea of these aspects when we see a few examples.
1. Request to Log in – Successful
Parameters
Base URL: https://reqres.in
Request : /api/login
Request Type: POST
Body :
Parameter Content Type: application/json
Responses:
Response Content Type: application/json
Response Code : 200
Description : OK
Response Value :
{
"token": "QpwL5tke4Pnpja7X4"
}
2. Request to Get a List of Users
Parameters
Base URL: https://reqres.in
Request: /api/users
Request Type: GET
Responses:
Response Content Type: application/json
Response Code : 200
Description : OK
Response Value :
{
"page": 1,
"per_page": 6,
"total": 12,
"total_pages": 2,
"data": [
{
"id": 1,
"email": "[email protected]",
"first_name": "George",
"last_name": "Bluth",
"avatar": "https://reqres.in/img/faces/1-image.jpg"
},
{
"id": 2,
"email": "[email protected]",
"first_name": "Janet",
"last_name": "Weaver",
"avatar": "https://reqres.in/img/faces/2-image.jpg"
},
{
"id": 3,
"email": "[email protected]",
"first_name": "Emma",
"last_name": "Wong",
"avatar": "https://reqres.in/img/faces/3-image.jpg"
},
{
"id": 4,
"email": "[email protected]",
"first_name": "Eve",
"last_name": "Holt",
"avatar": "https://reqres.in/img/faces/4-image.jpg"
},
{
"id": 5,
"email": "[email protected]",
"first_name": "Charles",
"last_name": "Morris",
"avatar": "https://reqres.in/img/faces/5-image.jpg"
},
{
"id": 6,
"email": "[email protected]",
"first_name": "Tracey",
"last_name": "Ramos",
"avatar": "https://reqres.in/img/faces/6-image.jpg"
}
],
"support": {
"url": "https://reqres.in/#support-heading",
"text": "To keep ReqRes free, contributions towards server costs are appreciated!"
}
}
3. Request to update user Information
Parameters
Base URL: https://reqres.in
Request : /api/users/{{User_ID}}
User_ID=2
Request Type: PUT
Body :
{
"name": "morpheus",
"job": "zion resident"
}
Parameter Content Type: application/json
Responses:
Response Content Type: application/json
Response Code : 200
Description : OK
Response Value :
{
"name": "morpheus",
"job": "zion resident",
"updatedAt": "2021-10-05T19:20:33.979Z"
}
4. Request to Get a List of Users
Parameters
Base URL: https://reqres.in
Request : /api/users/{{User_ID}}
User_ID=2
Request Type: DELETE
Responses:
Response Content Type: application/json
Response Code : 204
Description : OK
Response Value :[]
Now that we have fully covered all the prerequisites when it comes to REST API, let’s see why we use test REST APIs and explore a few other prerequisites that will be required to perform Rest API testing using Postman.
Why Postman tool?
Postman is a simple GUI for sending HTTP requests and viewing its responses. It is built upon an extensive set of power tools, which are incredibly easy to use. Postman helps you perform a variety of functions and has a lot of useful functionalities as well.
- Since Postman is accessible from anywhere, you have to just install it into the device and access it by logging into the account.
- Your test suites will be more organized as Postman allows users to build collections for their API calls. Every set can create multiple requests and subfolders.
- Using Postman, you’ll be able to test checkpoints with the verification of the successful HTTP response status that will be added to every API call.
- Automation Testing becomes easier as several iterations of the tests can be performed by using the Collection Runner or Newman. So you can save a lot of time when performing repetitive tests.
- As Postman makes it easy to create environments, you can design multiple environments and reduce the replication of tests as you’ll be able to use the same collection for a different setting.
- The postman console helps to track what data is being retrieved makes it possible to effectively debug the tests.
- The scope for collaboration is also high as you can import or export your collections & environments and share those files. You can also use a direct connection to share the collections.
- Postman supports continuous integration as well.
- You can use Postman by either downloading & installing their application or use their web version. It is a good option to have as both offer great performance.
How to create API requests in Postman
Learning how to create API requests is an integral part of learning how to perform manual REST API Testing using Postman. You will need to know more about the following 2 features to create an API request.
Workspace in Postman:
Postman Workspaces acts as a common working area where you can group your API projects together and use API builder to define APIs or generate API elements. So they are helpful in organizing your API work better and collaborating with your teammates as well. Now let’s see how to create one.
Creating a Workspace in Postman:
Click on the Workspace dropdown in the header -> New Workspace -> WorkSpaceName (Type any workspace name you wish) -> Create Workspace.
Collections in Postman:
- Postman Collections are Executable API Descriptions Postman’s collection folders make it easy to keep your API requests and elements organized.
- Generate Collections from API schemas Generate a collection from an API schema to view and edit each request.
Creating Collections in Postman:
Click on File -> New -> Collection -> CollectionName (Assign a Collection Name as you wish)
OR
Click Collection -> Create Collection Icon (+) -> CollectionName (Enter a Collection Name of your wish)
For testing the CRUD commands, we are going to use the information which is present in the above mention API contract.
Testing POST Request to Log in – Successful:
To make a POST request, click on the More option icon (…) -> Add Request -> Login User
1. From the Dropdown select POST
2. In the “Enter request URL” text box, type the following (URL): https://reqres.in/api/login
3. Click on Body Tab, select the ‘Raw’ radio button, and then the JSON format from the dropdown list.
4. In the text box, paste the Login Credentials:
5. Click on the Send button
6. You should be able to see the below response:
7. Also, make sure to check for the correct status code here. In this case, you should get: ‘Status: 200’ as shown in the image below.
Testing GET Request to Get the List of Users:
To make a GET request, you have to click on the More options icon (…) -> Add Request -> Request to Get List of Users (Assign any requested name you wish)
1. From the Dropdown list, select GET
2. Type the mentioned URL (https://reqres.in/api/users) in the “Enter request URL” text box.
3. Click on the Send button.
4. You’ll be able to see the below response:
5. Once again, check for the status code and see if it is ‘Status: 200’.
Testing PUT Request to update user Information:
Same as above, you have to click on the More option Icon(…) ->Add Request -> Request to Update user Information (Enter any request name of your choice)
1. Click on ‘PUT’ from the dropdown list.
2. In the “Enter request URL” text box that appears, type this URL: https://reqres.in/api/users/2
3. Click on the ‘Body’ Tab, select the ‘Raw’ radio button, and then choose the JSON format from the dropdown.
4. Paste the Login Credentials in the text box:
{
"name": "morpheus",
"job": "zion resident"
}
5. Click on the ‘Send’ button
6. You will see the below response:
7. Check if the status is shown as ‘200 OK’.
Testing DELETE Request to Remove Users from Database
Click on the More option Icon (…) -> Add Request -> Request to Get the list of Users (Enter any request name you wish)
1. From the Dropdown list of options, select ‘DELETE’.
2. Type this URL https://reqres.in/api/users in the “Enter request URL” text box.
3. Click on the ‘Send’ button
4. Check is you see the below response:
5. Check if ‘Status: 200 OK’ is visible as shown in the image below.
Conclusion:
It is evident that the steps we saw for each request were almost identical to each other. So by now, you should have no trouble in performing Rest API testing using Postman in an effective way to ensure high quality. As a leading manual testing services provider, we have often used Postman for our manual testing projects. But Postman can also be used for automation testing with the help of Test scripts.
by admin | Oct 26, 2021 | Automation Testing, Blog, Latest Post |
Releasing software multiple times into production in a day to deploy the new features/fixes with high quality will need an automation testing setup in all the stages of your delivery pipeline. In DevOps, you have to automate as much as possible to enable continuous testing. So when a product is getting deployed into production more frequently, you have to test the product continuously. For you to proactively search for quality issues, continuous testing has to be enabled across all stages of your delivery pipeline. Since software Test Automation is the key enabler of Continuous Testing, we will be taking a look at the 6 steps that can help you achieve Continuous Testing.
Treating Test Code as Production Code
Whenever a change happens in the product, you have to update your test code to accommodate the change. Let’s say you have to make a change on a common page/screen, your test automation framework should enable you to update the change in that one place instead of updating all the scripts.
Implementing the best practices and design patterns in test automation ease script maintenance. So you have to design your framework in such a way that any script change can be added to the test suite quickly without any hassle.
Kick-off Test Execution for Every Code Commit
Every code commit to version control should kick off automated unit & acceptance tests. When you deliver fast, you will also be in need of quick feedback for the changes or fixes that you have made. Lack of code commit validations will lead to eventual quality issues and regression defects.
Test Automation Framework
You can’t just build the entire framework and immediately start the script creation for Continuous Testing. We have to use the Acceptance Test-Driven Automation (ATDA) approach to develop an automation testing framework. ATDA enables you to write automated test scripts from the very first day instead of waiting for the framework development phase to be completed.
In the past, automation testers used to spend at least two weeks, or even a month in certain cases to develop the test automation framework. The script development itself would begin only after that. So in order to achieve Continuous Testing, you have to start the script development from day one, and then go forward with the product development.
How can we develop scripts without a framework?
Let’s say your team is comfortable with Java. You can use JVM-Cucumber, Selenium, Maven, Appium, and IntelliJ Community edition to start writing automated test scripts from day one. If a script needs a new framework feature, you first have to develop the feature and complete the script. That is how you can evolve the framework and not hold up the script development during the framework development.
Avoid & remove Flaky Tests from CI
If an issue messes with the DevOps pipeline, the entire team should focus on the issue and fix it immediately. Similarly, if a script is flaky, it will make the pipeline unstable. Automation Testing Services is our core service, and we know for a fact that you’ll need a highly skilled team that follows the best practices and uses proper object locators to avoid flaky tests and achieve Continuous Testing.
So if some of your tests are flaky, you must quarantine, schedule, and run them separately, and bring them into the delivery pipeline only when it is fixed and stable.
Test Data Generation
Test data plays an important role in UI, Functional, Non-functional, and Integration Testing. So you have to park adequate test data for test execution. Make sure to avoid failures that can be caused by invalid or missing test data. You should also have an automated system that allocates the required test data and cleans up the consumed data during execution.
Setup the Tests for all the phases
Continuous Testing should be set up in all phases of your delivery pipeline starting from development to production. For example, if a feature is being actively used by the end-users on a daily basis for a particular period of time. You can write an automated test script to check the feature’s usage from the production monitoring data to proactively check for any quality issues. So make sure you don’t just focus on smoke and regression testing as you have to set up tests for different stages in the pipeline.
Conclusion
Being one of the best automation testing service providers, we, at Codoid, follow strict scripting practices and design patterns to avoid flaky tests and have helped many clients to enable Continuous Testing in their DevOps pipeline. Fast feedback is critical for DevOps. You also shouldn’t delay test code development. You have to add the test code as and when new features are deployed into the pipeline.