Google search engine
Home Blog Page 67

Retesting In Flutter

0

Hi everyone! today we explore Retesting In Flutter. Retesting is used when there is any specific error or bug which needs to be verified. It is used when the bug is rejected by the developers then the testing department tests whether that bug is actual or not. It is also used to check the whole system to verify the final functionality.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents::

What is Retesting?

Characteristics of Retesting

Process of Retesting

When Do We Do Re-testing

Use of Re-testing in Software Testing

An instance of Retesting

Advantages of Retesting

Disadvantages of Retesting

Conclusion


What is Retesting?

Retesting is a procedure where we need to check that particular test cases which are found with some bugs during the execution time. Retesting also occurs when the product is already tested and due to some problems it needs to be tested again. This test is named retesting.

Retesting depends on the developer department whether they are going to accept the bug testing or reject it. Retesting is done when there is a specific bug when the bug is rejected by the developer and the tester department needs to test the issues when the user reports a problem for retesting and fixing an issue for better application and better workflow.

Characteristics of Retesting:

  • It is a copy of testing which are done with the same files and processes in a new build.
  • Retesting can only be implemented when particular test cases are involved which are considered failed tests.
  • It takes the surety of successful tests and working flow as it has to be.
  • During execution time whenever any bug occurs and that test is declined by the developer, in that situation the testers department tests that file and they try to find the actual issue they also do the retesting of that bug to make sure whether that bug is actual or not.
  • Sometimes the whole program needs to be retested to verify its quality of the program.
  • The cases which are being retested cannot be computerized.

Process of Retesting:

As per the Bug Life Cycle, once a tester found a bug, the bug is reported to the Development Team. The status of the Bug should be “New”. The Development Team may accept or reject the bug.

If the development team accepts the bug then they do fix it and release it in the next release. The status of the bug will be “Ready For QA”. Now the tester verifies the bug to find out whether it is resolved or not. This testing is known as retesting. Retesting is planned testing.

We do use the same test cases with the same test data which we used in the earlier build. If the bug is not found then we do change the status of the bug to “Fixed” else we do change the status to “Not Fixed” and send a Defect Retesting Document to the development team.

When Do We Do Re-testing:

  1. When there is a particular bug fix specified in the Release Note:
    Once the development team releases the new build, then the test team has to test the already posted bugs to make sure that the bugs are fixed or not.
  2. When a Bug is rejected:
    At times, the development team refuses a few bugs which were raised by the testers and mentions the status of the bug as Not Reproducible. In this case, the testers need to retest the same issue to let the developers know that the issue is valid and reproducible.
  3. When a Client calls for a retesting:
    At times, the Client may request us to do the test again to gain confidence in the quality of the product. In this case, test teams do test the product again.

Use of Re-testing in Software Testing:

  • Retesting is used when there is any specific error or bug which needs to be verified.
  • It is used when the bug is rejected by the developers then the testing department tests whether that bug is actual or not.
  • It is also used to check the whole system to verify the final functionality.
  • It also checks the quality of a specific part of a system.
  • When some user demands to retest their system.

An instance of Retesting:

Let’s assume that there is an application that maintains the details of all the students in school. This application has four buttons Add, Save, Delete and Refresh. All the other buttons’ functionality is working as expected but clicking on the ‘Save’ button is not saving the details of the student. This is a bug that is caught by the tester and he raised it. This issue is assigned to the developer and he fixes it. Post fixing the issue it’s again assigned to the tester. This time tester tested only the ‘Save’ button functionality. This is called retesting.

Advantages of Retesting:

  • Retesting ensures that the bug is being fixed completely and working successfully according to the user.
  • It enhances the quality of the product or application.
  • The bug can be fixed in a short period as it targets a particular issue.
  • Retesting doesn’t require any specific or other software for testing.
  • It can perform with the same data and the same process with a new build for its execution.

Disadvantages of Retesting:

  • Retesting needs a new build for the qualifying verification process of the bug.
  • If the testing process is started then at that time, the test cases of the retesting can be obtained but not previously.
  • At the time of testing, retesting cannot be computerized.
  • When the retesting results are unsuccessful, it requires more time and effort for fixing all the issues.

Conclusion:

Retesting is an important and required testing type assuring system reliability and flawlessness. It confirms that failed test cases have been solved giving relief to not only testing and development teams but also to the client.

We hope this tutorial was beneficial in understanding the ‘Retesting’ concept. For any queries or suggestions, please let us know in the comments.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.


Difference Between Verification and Validation In Flutter

0

Hi everyone! today we learn about Verification and Validation In Flutter. Verification and validation to assure that a software system meets a user’s needs. Verification: “Are we building the product right?” The software should conform to its specification. Validation: “Are we building the right product?” The software should do what the user requires.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents::

What is Verification in Software Testing?

Advantages of Verification Testing

When to use Verification Testing

What is Validation in Software Testing?

Advantages of Validation Testing

When to use Validation Testing;

KEY DIFFERENCE

Example of Verification and Validation

Conclusion



What is Verification in Software Testing?

Verification in Software Testing is a process of checking documents, design, code, and program to check if the software has been built according to the requirements or not.

The main goal of the verification process is to ensure the quality of software application, design, architecture, etc. The verification process involves activities like reviews, walk-throughs, and inspections.

Advantages of Verification Testing:

  • Early and frequent verification reduces the number of bugs and defects that may show up in later stages.
  • By verifying at each stage, devs, product managers, and stakeholders can get more insight into what the product may need to be developed better in the coming stages.
  • Even if they can’t solve all bugs immediately, verifying helps QAs estimate the kind of issues that might emerge and help them better prepare to handle those when they appear.
  • Verification helps keep software closely aligned with customers and business requirements at every stage. This ensures that devs have to put in less unnecessary work as development continues.

When to use Verification Testing:

Verification tests must be run at every stage of development before any feature is implemented.

For example, let’s consider a button labeled “Add to Cart”. Before starting with creating this button, verification tests would look through all relevant requirements previously decided in the ideation and brainstorming phases.

Let’s say the documentation says the button must be black with the lettering in white. It should be no larger than 10mm X 10mm, and it should be constantly visible in the top right corner of every product page of the website. Another button with the same text, color, and dimensions should be placed under every product on the page.

Before creating the button, design and requirements documents must be reviewed, and all necessary specifications must be listed before work begins. This must be done before working on every feature or element on the page so the devs do not miss any guidelines.

What is Validation in Software Testing?

Validation in Software Engineering is a dynamic mechanism of testing and validating if the software product meets the exact needs of the customer or not.

The process helps to ensure that the software fulfills the desired use in an appropriate environment. The validation process involves activities like unit testing, integration testing, system testing, and user acceptance testing.

Advantages of Validation Testing:

  • Any bugs missed during verification will be detected while running validation tests.
  • If specifications were incorrect and inadequate from the beginning, validation tests would reveal their inefficacy. Teams will have to spend time and effort fixing them, but it will prevent a bad product from hitting the market.
  • Validation tests ensure that the product matches and adheres to customer demands, preferences, and expectations under different conditions (slow connectivity, low battery, etc.)
  • These tests are also required to ensure that the software functions flawlessly across different browser-device-OS combinations. In other words, it authenticates software for cross-browser compatibility.

When to use Validation Testing;

Validation tests must be run after every feature or step in the development process is completed. For example, unit tests, a form of validation tests, are run after every unit of code has been created. Integration tests are run after multiple modules have been completed individually and are ready to be combined.

An important element of validation testing is the running of cross-browser testing. QAs must check that every function, feature, and design element appears and functions as expected on different browser-device-os combinations. For example, does the “Add to Cart” button show up and work perfectly on Chrome-Samsung Galaxy A23 and Safari-iPhone X?

KEY DIFFERENCE:

  • The verification process includes checking documents, design, code, and program whereasthe Validation process includes testing and validation of the actual product.
  • Verification does not involve code execution while Validation involves code execution.
  • Verification uses methods like reviews, walkthroughs, inspections, and desk-checking whereas Validation uses methods like black box testing, white box testing, and non-functional testing.
  • Verification checks whether the software confirms a specification whereas Validation checks whether the software meets the requirements and expectations.
  • Verification finds the bugs early in the development cycle whereas Validation finds the bugs that verification can not catch.
  • Comparing validation and verification in software testing, the Verification process targets on software architecture, design, database, etc. while the Validation process targets the actual software product.
  • Verification is done by the QA team while Validation is done by the involvement of the testing team with the QA team.
  • Comparing Verification vs Validation testing, the Verification process comes before validation whereas the Validation process comes after verification.

Example of Verification and Validation:

Now, let’s take an example to explain verification and validation planning:

  • In Software Engineering, consider the following specification for verification testing and validation testing,

A clickable button with name Submet

  • Verification would check the design doc and correct the spelling mistake.
  • Otherwise, the development team will create a button like

Example of Verification

  • So the new specification is
  • A clickable button with the name Submit
  • Once the code is ready, Validation is done. A Validation test found –

Example of Validation

  • Owing to Validation testing, the development team will make the submit button clickable

Conclusion:

Verification and validation are crucial parts of the development life cycle of an embedded system. Verification starts from the requirements analysis stage where design reviews and checklists are used to the validation stage where functional testing and environmental modeling are done.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.


What is Priority and Severity In Flutter

0

Hi everyone! today we learn about Priority and Severity In Flutter. Priority is defined as a parameter that decides the order in which a defect should be fixed. Defects having a higher priority should be fixed first. Severity is a parameter to denote the implication and the impact of the defect on the functionality of the software.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents::

Bug Severity

What is Priority?

KEY DIFFERENCE

Types of Severity

Priority Types

Tips for determining the Severity of a Defect

Example of Defect Severity and Priority

Defect Triage

Guidelines that every tester should consider before selecting a severity

Conclusion


Bug Severity:

Bug Severity or Defect Severity in testing is the degree of impact a bug or a Defect has on the software application under test. A higher effect of bug/defect on system functionality will lead to a higher severity level. A Quality Assurance engineer usually determines the severity level of a bug/defect.

What is Priority?

Priority is defined as the order in which a defect should be fixed. The higher the priority the sooner the defect should be resolved.

Defects that leave the software system unusable are given higher priority over defects that cause a small functionality of the software to fail.

KEY DIFFERENCE:

  • Priority is the order in which the developer should resolve a defect whereas Severity is the degree of impact that a defect has on the operation of the product.
  • Priority is categorized into three types: low, medium, and high whereas Severity is categorized into five types: critical. major, moderate, minor, and cosmetic.
  • Priority is associated with scheduling while Severity is associated with functionality or standards.
  • Priority indicates how soon the bug should be fixed whereas Severity indicates the seriousness of the defect in the product functionality.
  • Priority of defects is decided in consultation with the manager/client while Severity levels of the defects are determined by the QA engineer.
  • Priority is driven by business value while Severity is driven by functionality.
  • The priority value is subjective and can change over some time depending on the change in the project situation whereas the Severity value is objective and less likely to change.
  • High Priority and low severity status indicate, defect has to be fixed on immediate bases but does not affect the application while High Severity and low priority status indicates the defect has to be fixed but not on immediate bases.
  • Priority status is based on customer requirements whereas Severity status is based on the technical aspect of the product.

Types of Severity:

In Software Testing, Types of Severity of bug/defect can be categorized into four parts :

  • Critical: This defect indicates complete shut-down of the process, nothing can proceed further
  • Major: It is a highly severe defect and collapses the system. However, certain parts of the system remain functional
  • Medium: It causes some undesirable behavior, but the system is still functional
  • Low: It won’t cause any major break-down of the system

Priority Types:

Types of Priority of bug/defect can be categorized into three parts :

  • Low: The Defect is an irritant but a repair can be done once the more serious Defect has been fixed
  • Medium: During the normal course of the development activities defect should be resolved. It can wait until a new version is created
  • High: The defect must be resolved as soon as possible as it affects the system severely and cannot be used until it is fixed

Tips for determining the Severity of a Defect:

  • Decide the frequency of occurrence: In some cases, if the occurrence of a minor defect is frequent in the code, it can be more severe. So from a user’s perspective, it is more serious even though it is a minor defect.
  • Isolate the defect: Isolating the defect can help to find out the severity of the impact.

Example of Defect Severity and Priority:

Let’s see an example of low severity and high priority and vice versa

  • A very low severity with a high priority: A logo error for any shipment website, can be of low severity as it not going to affect the functionality of the website but can be of high priority as you don’t want any further shipment to proceed with the wrong logo.
  • A very high severity with a low priority: Likewise, for a flight operating website, a defect in reservation functionality may be of high severity but can be a low priority as it can be scheduled to release in the next cycle.

Defect Triage:

Defect triage is a process that tries to re-balancing the process where the test team faces the problem of limited availability of resources. So, when there is a large number of defects and limited testers to verify them, defect triage helps to try to get as many defects resolved based on defect parameters like severity and priority.

How to determine Defect Triage:

Most systems use priority as the main criteria to assess the defect. However, a good triage process considers the severity as well.

The triage process includes the following steps

  • Reviewing all the defects including rejected defects by the team
  • Initial assessment of the defects is based on their content and respective priority and severity settings
  • Prioritizing the defect based on the inputs
  • Assign the defect to correct release by the product manager
  • Re-directs the defect to the correct owner/team for further action

Guidelines that every tester should consider before selecting a severity:

The severity parameter is assessed by the tester whereas the priority parameter is assessed by the product manager or by the triage team. For prioritizing the defect, a tester must choose the right severity to avoid confusion with the development team.

  • Understand the concept of priority and severity well
  • Always assign the severity level based on the issue type as this will affect its priority
  • Understand how a particular scenario or Test Case would affect the end-user
  • Need to consider how much time it would take to fix the defect based on its complexity and the time to verify the defect

Conclusion:

In Software Engineering, Assigning the wrong severity to a defect can delay the STLC process and can have some drastic implications on the overall performance of the team. So, the responsible person needs to be precise and accurate in their call for assigning defects.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.


What Is Jenkins In Flutter

0

Hi everyone! today we learn about Jenkins In Flutter. Jenkins is an open-source automation tool written in Java with plugins built for Continuous Integration purposes.

Jenkins is used to building and testing your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


In this tutorial, you will learn

What is Jenkins?

What is Continuous Integration?

How does Jenkins work?

Jenkin History

Why use Continuous Integration with Jenkins?

Real-world case study of Continuous Integration

Advantages of using Jenkins

Disadvantages of using Jenkins

Conclusion


What is Jenkins?

Jenkins is an open-source Continuous Integration server written in Java for orchestrating a chain of actions to achieve the Continuous Integration process in an automated fashion. Jenkins supports the complete development life cycle of software from building, testing, documenting the software, deploying, and other stages of the software development life cycle.

Jenkins is a widely used application around the world that has around 300k installations and growing day by day. By using Jenkins, software companies can accelerate their software development process, as Jenkins can automate build and testing at a rapid rate.

It is a server-based application and requires a web server like Apache Tomcat. The reason Jenkins software became so popular is that it monitors repeated tasks that arise during the development of a project. For example, if your team is developing a project, Jenkins will continuously test your project builds and show you the errors in the early stages of your development.

What is Continuous Integration?

Continuous Integration is a process of integrating code changes from multiple developers in a single project many times. The software is tested immediately after a code commit. With each code commit, code is built and tested. If the test is passed, the build is tested for deployment. If the deployment is successful, the code is pushed to production.

This commit, build, test, and deploy is a continuous process, hence the name continuous integration/deployment.

How does Jenkins work?

Jenkins is a server-based application and requires a web server like Apache Tomcat to run on various platforms like Windows, Linux, macOS, Unix, etc. To use Jenkins, you need to create pipelines which are a series of steps that a Jenkins server will take. Jenkins Continuous Integration Pipeline is a powerful instrument that consists of a set of tools designed to host, monitor, compile and test code, or code changes, like:

  • Continuous Integration Server (Jenkins, Bamboo, CruiseControl, TeamCity, and others)
  • Source Control Tool (e.g., CVS, SVN, GIT, Mercurial, Perforce, ClearCase and others)
  • Build tools (Make, ANT, Maven, Ivy, Gradle, and others)
  • Automation testing framework (Selenium, Appium, TestComplete, UFT, and others)

Jenkin History:

  • Kohsuke Kawaguchi, a Java developer, working at SUN Microsystems, was tired of building the code and fixing errors repetitively. In 2004, created an automation server called Hudson that automates build and test tasks.
  • In 2011, Oracle who owned Sun Microsystems had a dispute with Hudson’s open-source community, so they forked Hudson and renamed it, Jenkins.
  • Both Hudson and Jenkins continued to operate independently. But in a short period, Jenkins acquired a lot of projects and contributors while Hudson remained with only 32 projects. With time, Jenkins became more popular, and Hudson was not maintained anymore.

Why use Continuous Integration with Jenkins?

Some people might think that the old-fashioned way of developing software is the better way. Let’s understand the advantages of CI with Jenkins with the following example

Let us imagine, that there are around 10 developers who are working on a shared repository. Some developer completes their task in 25 days while others take 30 days to complete.

Before Jenkins After Jenkins Once all Developers had completed their assigned coding tasks, they used to commit their code all at the same time. Later, Build is tested and deployed.

Code commit was built, and the test cycle was very infrequent, and a single build was done after many days. The code is built and tested as soon as the Developer commits the code. Jenkin will build and test code many times during the day

If the build is successful, then Jenkins will deploy the source into the test server and notifies the deployment team. If the build fails, then Jenkins will notify the errors to developer team.

Since the code was built all at once, some developers would need to wait until other developers finish coding to check their build The code is built immediately after any of the Developers commits. It is not an easy task to isolate, detect, and fix errors for multiple commits.

Since the code is built after each commit of a single developer, it’s easy to detect whose code caused the build to fail Code build and test process are entirely manual, so there are a lot of chances for failure. Automated build and test process saving timing and reducing defects. ‘

The code is deployed once all the errors are fixed and tested. The code is deployed after every successful build and test. Development Cycle is slow The development cycle is fast. New features are more readily available to users. Increases profits.

Real-world case study of Continuous Integration

I am sure all of you are aware of the old phone Nokia. Nokia used to implement a procedure called nightly build. After multiple commits from diverse developers during the day, the software was built every night. Since the software was built only once a day, it’s a huge pain to isolate, identify, and fix the errors in a large code base.

Later, they adopted the Continuous Integration approach. The software was built and tested as soon as a developer committed code. If any error is detected, the respective developer can quickly fix the defect.

Jenkins Plugins:

By default, Jenkins comes with a limited set of features. If you want to integrate your Jenkins installation with version control tools like Git, then you need to install plugins related to Git. In fact, for integration with tools like Maven, and Amazon EC2, you need to install respective plugins in your Jenkins.

Advantages of using Jenkins:

  • Jenkins is being managed by a very open community. Every month, they hold public meetings and take inputs from the public for the development of the Jenkins project.
  • So far around 280 tickets are closed, and the project publishes stable releases every three months.
  • As technology grows, so does Jenkins. So far Jenkins has around 320 plugins published in its plugins database. With plugins, Jenkins becomes even more powerful and feature-rich.
  • Jenkins tool also supports cloud-based architecture so that you can deploy Jenkins in cloud-based platforms.
  • The reason why Jenkins became popular is that it was created by a developer for developers.

Disadvantages of using Jenkins:

Though Jenkins is a very powerful tool, it has its flaws.

  • Its interface is outdated and not user-friendly compared to current UI trends.
  • Though Jenkins is loved by many developers, it’s not that easy to maintain because Jenkins runs on a server and requires some skills as a server administrator to monitor its activity.
  • One of the reasons why many people don’t implement Jenkins is due to its difficulty in installing and configuring Jenkins.
  • Continuous integrations regularly break due to some small setting changes. Continuous integration will be paused and therefore requires some developer attention.

Conclusion:

  • In Continuous Integration, after a code commit, the software is built and tested immediately. Jenkins is used for orchestrating a chain of actions for Continuous Integration in a software project.
  • Before Jenkins when all Developers had completed their assigned coding tasks, they used to commit their code all at the same time. Later, Build is tested and deployed.
  • After Jenkins, the code is built and tested as soon as the Developer commits the code. Jenkin will build and test code many times during the day
  • By default, Jenkins comes with a limited set of features. If you want to integrate your Jenkins installation with version control tools like Git, then you need to install plugins related to Git
  • The biggest pros of Jenkins are that it is managed by the community which holds public meetings and takes inputs from the public for the development of Jenkins projects. The biggest con of Jenkin is that Its interface is outdated and not user-friendly compared to current UI trends.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

LambdaTest In Flutter

0

Hi everyone! today we learn about Lambda Test In Flutter. LambdaTest is a cloud-based cross-browser testing tool that allows you to perform cross-browser testing for web applications across more than 2000 browsers, operating systems, and devices. You can perform both manual and automated cross-browser testing using LambdaTest.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents::

Introduction To LambdaTest Cross Browser Testing Tool

Key Features of LambdaTest Cross Browser Testing Cloud

Registration — LambdaTest

Integration

Conclusion


Introduction To LambdaTest Cross Browser Testing Tool:

LambdaTest is a Cross Browser Testing Cloud, that allows developers and testers to perform Cross Browser Testing on 2000+ Real Browsers and Operating System Online in varying screen resolutions. LambdaTest allows us to test on the latest mobile and desktop browsers on the cloud.

We can ensure our website is compatible across all browsers and devices by performing Real-time cross cross-browser compatibility testing with LambdaTest. We can choose from a wide range of updated Android and iOS mobile devices from the latest to oldest versions of Chrome, Firefox, Safari, Edge, Internet Explorer, Opera, and Yandex. It also allows us to test for responsiveness and take full-paged automated screenshots. Supported devices are Windows, Android, iPhone/iPad, Mac, and Web-based.

As Software testers, we test applications on different platforms and we all know that it’s not an easy job to set up our test environment based on our requirements. While testing a website, we need to ensure that our website is up to shape. To ensure this we need to have all the devices and browsers. You need to install all the browsers by spending a lot of time, and money. Fortunately, there are some tools to overcome this cumbersome installation process and waste money unwantedly. We have many tools to do Cross Browser Testing. Today we are going to bring another new Cross Browser Testing Tool i.e., LambdaTest. LambdaTest is a CrossBrowserTesting Tool on Cloud.

Key Features of LambdaTest Cross Browser Testing Cloud:

1. Online Browser Compatibility Testing: We can perform browser compatibility testing from a vast choice of desktop and mobile browsers, browser versions, operating systems, and resolutions. We can also record or take screenshots during real-time browser compatibility testing sessions on the go.

2. Test on Latest Desktop Browsers: It has great collections of all the latest browsers (Google Chrome, Mozilla Firefox, Opera, IE, Edge, Safari, and Yandex) and operating systems.

3. Test on a Wide Variety of Mobile Devices: It supports a wide list of iPhones, and iPads on different iOs versions and Android phones like Samsung, Google, Sony, LG, One Plus, HTC, Amazon, Motorola, Xiaomi, Huawei, Gionee, Oppo, Vivo on latest Android versions and different browsers.

4. Faster Automated Screenshots / Screenshot testing: We can get full-paged screenshots within seconds by just selecting the configurations using the LambdaTest automated screenshots feature.

5. Check Responsiveness on All Screen Sizes: We can check the responsiveness of our website with just a single click across different screen sizes. We can also check the responsiveness of our locally hosted websites using LambdaTest Secure Shell Tunnel.

6. Seamless Collaboration and Testing: We can log issues instantly during test sessions. We can share the issues via email, slack or directly log it in different bug tracking tools.

7. Testing Locally Hosted Pages: We can test locally or privately hosted pages on the LambdaTest cloud platform using Lambda Tunnel even before launching on live servers.

8. Smart Visual Regression Testing: We can solve issues related to icon size, padding, color, layout, text, element’s position, etc., by performing smart visual regression testing on our layouts.

9. Resolution Display Testing: Screen resolutions ranging from 800×600 to 2560×1440 are available. We can simply change screen resolution in the mid of a session by just selecting the required resolution and our browser will be resized as per our selected resolution.

10. LambdaTest Inbuilt Issue Tracker: It comes with an inbuilt issue tracker. If you don’t use any third-party project management tool, then there is no need to buy one. You can use LambdaTest’s inbuilt issue tracker to assign, track, export to pdf, and share bugs.

11. Chrome Extension: It can be used to take full-page screenshots of web pages across different desktop and mobile browsers right from your browser with just one click. These screenshots will help in fast-tracking cross-browser compatibility testing of the web pages and websites.

12. 24*7 Support: The best part of LambdaTest is their 24×7 support from their Tech Experts. You can do so through email, live chat, and phone calls. If you don’t wish to use any of those channels, support tickets can also be filed. Just explain what the problem is and LambdaTest’s support team will do their best to resolve it for you.

Registration — LambdaTest:

Step 1: Open this link
Step 2: Click on “Free Sign Up”

Step 3: Provide the required details to Sign Up

You will be redirected to LambdaTest Dashboard.

Overview On LambdaTest Dashboard:

> Real-Time Browser Testing

Step 1: Go to “Real Time Test” from the left navigation menu.
Step 2: Enter the “URL” of the site that you want to test
Step 3: Select either “Desktop” or “Mobile device”
Step 4: Select “Browser version”, “OS”, and “Resolution”
Step 5: Click on “Start”

Click the button with the camera icon (as shown in the below image) to generate a screenshot for the visible part of the screen you are currently on inside the Virtual Machine.

Once the desired Virtual Machine is launched and operable, you can capture screenshots or record a video and report bugs in the bug tracking tool provided by LambdaTest or you can use your favorite third-party bug tracking tool.

> Screenshot Testing

Step 1: Click on the “Screenshot” menu under the “Visual UI Test” menu
Step 2: Enter the “URL” of the site that you want to test
Step 3: Select either “Desktop” or “Mobile device”
Step 4: Select “Browser version” related to the required “OS”
Step 5: Click on “Capture” and you will be taken to the result page where you can view your screenshots.

> Responsive Testing

Step 1: Click on the “Responsive” menu under the “Visual UI Test” menu
Step 2: Enter the “URL” of the site that you want to test
Step 3: Select either “Desktop” or “Mobile device”
Step 4: Select “Browser version” related to the required “OS”
Step 5: Click on “Generate”

Integration:

LambdaTest can seamlessly integrate with the following bug-tracking and communication tools:

> Bug Tracking Tools:

  • Jira
  • Slack
  • Asana
  • Trello
  • Github
  • Gitlab
  • Bitbucket
  • VSTS
  • Meet
  • Paymo
  • Teamwork
  • Hive
  • Clubhouse
  • Mantis

> Plugins & Extensions:

  • Chrome Extension
  • WordPress-Plugin

Conclusion:

If you’re looking for a fully functional and automated web-based software solution to perform live testing, then you should consider LambdaTest as a strong contender. With powerful features that allow users to test their websites and applications, the pros outweigh the cons. You can deploy projects and tasks more efficiently and easily with fewer challenges.

At the end of the day, LambdaTest only seeks to improve the way you do your work. Its features are catered to accelerate the development process and provide web developers with essential tools. Overall, testing projects and assessing software can now be done with relative ease.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Flutter PageView Widget

0

The PageView widget allows the user to transition between different screens in their flutter application. All you need to set it up are a PageViewController and a PageView.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents

Introduction

Properties

Implementation

Conclusion

GitHub Link



Introduction:

A page view is a simple way to swipe the pages in the flutter application. It works in both horizontal and vertical ways. A PageView is a widget that generates the pages of the screen that are scrollable. The pages can be fixed or repeated pages that are built by the builder function. PageView behaves like ListView in constructing the elements.


Properties of PageView:

> allowImplicitScrolling:- This property takes in a boolean value as the object. It controls whether to allocate implicit scrolling to the widget’s page.

Implementationfinal

bool allowImplicitScrolling;

> childrenDelegate:- A delegate that provides the children for the PageView.

Implementation

final SliverChildDelegate childrenDelegate;

> clipBehavior:- The content will be clipped (or not) according to this option.

Implementation

final Clip clipBehavior;

> controller:- An object that can be used to control the position to which this page view is scrolled.

Implementation

final PageController controller;

> dragStartBehavior:- Determines the way that drags start behavior is handled.

Implementation

final DragStartBehavior dragStartBehavior;

> onPageChanged:- Called whenever the page in the center of the viewport changes.

Implementation

final ValueChanged<int>? onPageChanged;

> padEnds:- Whether to add padding to both ends of the list.

Implementation

final bool padEnds;

> physics:- How the page view should respond to user input.

Implementation

final ScrollPhysics? physics;

> restorationId:- Restoration ID to save and restore the scroll offset of the scrollable.

Implementation

final String? restorationId;

> reverse:- It defines the scrolling direction. By default, it is set to false.

Implementation

final bool reverse;

> scrollDirection:- The axis along which the page view scrolls.

Implementation

final Axis scrollDirection;

Implementation:

First, we have to create a new Flutter Project with the name pageview_flutter_demo. Then we start coding to implement the PageView in the flutter application. We use PageController inside the state of a statefulWidget and initialize it inline or in the init() method. And create an integer variable _curr and pass the initial value zero.PageController controller = PageController();
int _curr = 0;

In BuildContext(), we define Scaffold. In the appbar, we define the name and center tile.

AppBar(
centerTitle: true,
title: const Text('PageView'),
backgroundColor: Colors.lightBlueAccent,
),

After this, we pass PageView in the Scaffold body. In PageView Widget, first, we have to pass true at allowImplicitScrolling because It controls whether to allocate implicit scrolling to the widget’s page. and set the scroll direction as horizontal we can also set it as vertical. and pass the controller in the controller. After all this, we have to set the value at onPageChangeso, for page change we use setState in which we pass the _curr equals to num.

PageView(
allowImplicitScrolling: true,
children: _list,
scrollDirection: Axis.horizontal,
controller: controller,
onPageChanged: (num) {
setState(() {
_curr = num;
});
},
),

And at last, we have to pass the children, In children, we pass the _list. We already create a list.

final List<Widget> _list = <Widget>[
Center(
child: Pages(
text: "Page One",
color: Colors.teal,
)),
Center(
child: Pages(
text: "Page Two",
color: Colors.red.shade100,
)),
Center(
child: Pages(
text: "Page Three",
color: Colors.grey,
)),
Center(
child: Pages(
text: "Page Four",
color: Colors.yellow.shade100,
))
];

In this list, we use text and color so for this we create a stateless Widget with the name Pages in this we create two constructor text and color.

class Pages extends StatelessWidget {
final text;
final color;
Pages({this.text, this.color});
@override
Widget build(BuildContext context) {
return Container(
color: color,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
text,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 30,
fontWeight: FontWeight.w400),
),
]),
),
);
}
}

If the properties are:

scrollDirection: Axis.vertical,
reverse: true,
controller: controller,

When we run the application, we ought to get the screen’s output like the underneath screen video.

And If the properties are:

scrollDirection: Axis.horizontal,
controller: controller,

When we run the application, we ought to get the screen’s output like the underneath screen video.


Conclusion:

In this article, we learn how to implement PageView Widget in Flutter Application. In this, we learn many things like the axis of scroll direction, reverse, physics, etc.

❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


GitHub Link:

Find the source code of the PageView Widget In the Flutter Application :

GitHub – flutter-devs/pageView_flutter-
A new Flutter project. This project is a starting point for a Flutter application. A few resources to get you started…github.com


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.


APPIUM For Android & iOS Mobile Apps Testing In Flutter

0

Hi everyone! today we learn about Appium for Android & iOS Mobile Apps Testing In Flutter. Appium is an open-source test automation tool used for testing mobile applications. It allows users to test various types of mobile applications (such as Native, Hybrid, and Mobile Web) using the standard WebDriver library.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents::

What is Appium?

How APPIUM Works?

Prerequisite To Use APPIUM

Install Appium Desktop

APPIUM Inspector

Attach Android Emulator to Appium

APPIUM Test Case for Native Android App(Calculator)

Limitations Using APPIUM

Common Encountered Errors and Troubleshooting Steps in Appium

Conclusion


What is Appium?:

APPIUM is a freely distributed open-source mobile application UI Testing framework. Appium allows native, hybrid, and web application testing and supports automation tests on physical devices as well as an emulator or simulator both. It offers cross-platform application testing, i.e. single API works for both Android and iOS platform test scripts.

It has NO dependency on Mobile device OS. Because APPIUM has a framework or wrapper that translates Selenium Webdriver commands into UIAutomation (iOS) or UIAutomator (Android) commands depending on the device type, not any OS type.

Appium supports all languages that have Selenium client libraries like- Java, Objective-C, JavaScript with node.js, PHP, Ruby, Python, C#, etc.

How APPIUM Works?:

  • Appium is an ‘HTTP Server’ written using a Node.js platform and drives iOS and an Android sessions using Webdriver JSON wire protocol. Hence, before initializing the Appium Server, Node.js must be pre-installed on the system.
  • When Appium is downloaded and installed, then a server is set up on our machine that exposes a REST API.
  • It receives connection and command requests from the client and executes that command on mobile devices (Android / iOS).
  • It responds with HTTP responses. Again, to execute this request, it uses the mobile test automation frameworks to drive the user interface of the apps. A framework like:-
  • Apple Instruments for iOS (Instruments are available only in Xcode 3.0 or later with OS X v10.5 and later)
  • Google UIAutomator for Android API level 16 or higher
  • Selendroid for Android API level 15 or less

Prerequisite To Use APPIUM:

  1. Install ANDROID SDK (Studio)
  2. Install JDK (Java Development Kit)
  3. Install Eclipse
  4. Install TestNG for Eclipse
  5. Install Selenium Server JAR
  6. Appium Client Library
  7. APK App Info on Google Play
  8. js (Not Required — Whenever the Appium server is installed, it by default comes with “Node.exe” & NPM. It’s included in the Current version of Appium.)
  9. Install Appium Desktop

Install Appium Desktop:

Appium Studio is an Open source GUI app to install Appium Server. It comes bundled with all the prerequisites to install and use Appium Server. It also has an Inspector to get basic information on your Apps. It comes with a Recorder to create boilerplate code to automate your mobile apps.

Step 1) Go to http://appium.io/ and click on Download Appium.

Step 2) For Windows, select the exe file and download. The file is around 162MB and will take time to download based on your internet speed.

Step 3) Click on the downloaded exe.

Step 4) On a Windows machine, there is no need to install Appium. It runs directly from the exe. Once you click the exe you will see the following image for a few minutes.

For Mac, you need to install the dmg

Step 5) Next you will see the Server Start Window. It populates the default host and port option which you can change. It also mentions the version of Appium being used.

Step 6) On clicking the Start Server Button, a new server is launched on the specified host and port. Server log output is shown.

Step 7) Click New Session Window.

Step 8) You can enter the Desired Capabilities and start a session.

APPIUM Inspector:

Similar to the Selenium IDE record and playback tool, Appium has an ‘Inspector’ to record and Playback. It records and plays native application behavior by inspecting DOM and generates the test scripts in any desired language. However, currently, there is no support for Appium Inspector for Microsoft Windows. In Windows, it launches the Appium Server but fails to inspect elements. However, the UI Automator viewer can be used as an option for Inspecting elements.

Steps to start with Appium Inspector on a Mac machine:-

Step 1) Download and start your Appium server with the default IP Address 0.0.0.0 and port 4725.

  1. Select the source file or .app files from local to test.
  2. Check the ‘App Path’ Checkbox to enable the ‘Choose’ button.

Step 2)Now, clicking on the ‘Choose’ button will give the option to browse and select the test file from the local drive.

Step 3) Start Simulator on a Mac machine.

Step 4) Click the ‘Launch’ button from the top right corner, which enables a blue color icon. Again, click on this blue color icon, it will open the Appium inspector and Simulator with a pre-selected application.

Step 5)– Launching your Appium Inspector will show the element hierarchy in a column-wise structure. Also, a user can apply actions using buttons like Tap, Swipe, etc.

Step 6) Click on the ‘Stop’ button to stop recording.

Attach Android Emulator to Appium:

Step 1) Install Android SDK in your system.

Go to Control panel >> System and Security >> System and from the left panel click on ‘Advanced System Settings. From the ‘System Properties’ pop-up, click on the ‘Advanced’ tab and then click on the “Environment Variables” button.

Step 2) Now, from the ‘Environment variables’ pop-up, ‘double-click on ‘Path’ and set the ANDROID_HOME variable that points to your SDK directory. In the path append the whole SDK folder path.

e.g. –C:\User\ABC\Desktop\adt-bundled-windows-x86_64-20140321\sdk

Step 3) Start your Android emulator or attach any Android device to your system (Make sure you have the Android Debugging option enabled in your Android device. To check Debugging Option. Go to Device Settings >> Developer Options >> Check “Debugging Option”).

Step 4) Open Command Prompt and navigate to your Android SDK’s \platform-tools\ directory (E.g. D:\adt-bundle-windows-x86_64–20130514\sdk\platform-tools).

Step 5)– Run the ADB devices’ command. You can see your connected device listed in Command Prompt window. (In CMD write ‘>adb devices’- This command will list the connected emulator instances. E.g.: ADB –s emulator-5554 install <Location of .apk file>)

Step 6)– Run the ADB start-server command. It will start the ADB server that will be used by Appium to send commands to your Android device.

Step 7) Now, navigate to the Appium directory in your system and start Appium by clicking an Appium.exe file.

Step 8) Do not alter the IP address or port number and click the ‘Launch’ button. Your Appium console starts at 127.0.0.1:4723 as shown below.

Step 9) Click on the ‘Start’ button, Appium server started running on your system.

APPIUM Test Case for Native Android App(Calculator):

Step 1) Download the ADT eclipse plugin or download ADT bundled separately here

Step 2) Open Eclipse and Create a new Project >> Package >> Class

Step 3) Import the Selenium library and Test-inside that new project.

Step 4) Now Create a small test Program for ‘Calculator. app’ to sum two numbers.

package src_Appium;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
//import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.*;

public class Calculator {
WebDriver driver;@BeforeClass
public void setUp() throws MalformedURLException{
//Set up desired capabilities and pass the Android app-activity and app-package to Appium
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("BROWSER_NAME", "Android");
capabilities.setCapability("VERSION", "4.4.2");
capabilities.setCapability("deviceName","Emulator");
capabilities.setCapability("platformName","Android");


capabilities.setCapability("appPackage", "com.android.calculator2");
// This package name of your app (you can get it from apk info app)
capabilities.setCapability("appActivity","com.android.calculator2.Calculator"); // This is Launcher activity of your app (you can get it from apk info app)
//Create RemoteWebDriver instance and connect to the Appium server
//It will launch the Calculator App in Android Device using the configurations specified in Desired Capabilities
driver = new RemoteWebDriver(new URL("https://127.0.0.1:4723/wd/hub"), capabilities);
}@Test
public void testCal() throws Exception {
//locate the Text on the calculator by using By.name()
WebElement two=driver.findElement(By.name("2"));
two.click();
WebElement plus=driver.findElement(By.name("+"));
plus.click();
WebElement four=driver.findElement(By.name("4"));
four.click();
WebElement equalTo=driver.findElement(By.name("="));
equalTo.click();
//locate the edit box of the calculator by using By.tagName()
WebElement results=driver.findElement(By.tagName("EditText"));
//Check the calculated value on the edit box
assert results.getText().equals("6"):"Actual value is : "+results.getText()+" did not match with expected value: 6";}@AfterClass
public void teardown(){
//close the app
driver.quit();
}
}

Appium Server and Android Emulator from ‘AVD Manager’ and Click Run >> TestNG. The above program will run the ‘Calculator. app’ on the selected emulator and the Result is displayed under the Eclipse console using a TestNG framework.

Limitations Using APPIUM:

  1. Appium does not support testing of Android Version lower than 4.2
  2. Limited support for hybrid app testing. e.g.: not possible to test the switching action of the application from the web app to native and vice-versa.
  3. No support for running Appium Inspector on Microsoft Windows.

Common Encountered Errors and Troubleshooting Steps in Appium:

Conclusion:

With emerging trends and more demand for Mobile Apps, all major companies are migrating to get their business on mobile apps. Thus to release quality mobile apps, automation testing of mobile apps is the latest trend in the industry.

Appium, because of its simplicity and ease of use, is one of the leaders and most widely used tools all over the globe for the automation testing of mobile apps for iOS or Android.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

What is TestNG In Flutter

0

Hi everyone! today we learn about What is TestNG In Flutter. TestNG is a testing framework for the java programming language created by Cédric Beust and inspired by JUnit and NUnit.

The design goal of TestNG is to cover a wider range of test categories: unit, functional, end-to-end, integration, etc., with more powerful and easy-to-use functionalities.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents::

What is TestNG?

Why Use TestNG with Selenium?

Advantages of TestNG over JUnit

What is Annotation in TestNG?

How to Write Test Cases in TestNG?

Create Test Case Using TestNG Annotations

Setting up a new TestNG Project

How to Create a New TestNG Test File

Coding of our First TestNG Test Case Example

Running the Test

Checking reports created by TestNG

Generating HTML Reports

Annotations used in TestNG

Multiple Test Cases

Parameters

Multiple Parameters

Summary of TestNG Annotations

Conclusion


What is TestNG?

TestNG is an automation testing framework in which NG stands for “Next Generation”. TestNG is inspired by JUnit which uses the annotations (@). TestNG overcomes the disadvantages of JUnit and is designed to make end-to-end testing easy.

Using TestNG, you can generate a proper report, and you can easily come to know how many test cases are passed, failed, and skipped. You can execute the failed test cases separately.

For example:

  • Suppose, you have five test cases, and one method is written for each test case (Assume that the program is written using the main method without using TestNG). When you run this program first, three methods are executed successfully, and the fourth method is failed. Then correct the errors present in the fourth method, now you want to run only the fourth method because the first three methods are anyway executed successfully. This is not possible without using TestNG.
  • The TestNG in Selenium provides an option, i.e., the TestNG-failed.xml file in the test-output folder. If you want to run only failed test cases means you run this XML file. It will execute only failed test cases.

Besides the above concept, you will learn more about TestNG, like what are the Advantages of TestNG, how to create test methods using @test annotations, and how to convert these classes into testing suite files and execute them through the eclipse as well as from the command line.

Why Use TestNG with Selenium?

Default Selenium tests do not generate a proper format for the test results. Using TestNG in Selenium, we can generate test results.

Most Selenium users use this more than JUnit because of its advantages. There are so many features of TestNG, but we will only focus on the most important ones that we can use in Selenium. The following are the key features of Selenium TestNG:

  • Generate the report in a proper format including the number of test case runs, the number of test cases passed, the number of test cases failed, and the number of test cases skipped.
  • Multiple test cases can be grouped more easily by converting them into testng.xml files. In which you can make priorities on which test case should be executed first.
  • The same test case can be executed multiple times without loops just by using a keyword called ‘invocation count.’
  • Using TestNG, you can execute multiple test cases on multiple browsers, i.e., cross-browser testing.
  • The TestNG framework can be easily integrated with tools like TestNG Maven, Jenkins, etc.
  • Annotations used in the testing are very easy to understand ex: @BeforeMethod, @AfterMethod, @BeforeTest, @AfterTest
  • WebDriver has no native mechanism for generating reports. TestNG can generate the report in a readable format like the one shown below.
  • TestNG simplifies the way the tests are coded. There is no more need for a static main method in our tests. The sequence of actions is regulated by easy-to-understand annotations that do not require methods to be static.
  • Uncaught exceptions are automatically handled by TestNG without terminating the test prematurely. These exceptions are reported as failed steps in the report.

Advantages of TestNG over JUnit:

There are three major advantages of TestNG over JUnit:

  • Annotations are easier to understand
  • Test cases can be grouped more easily
  • Parallel testing is possible

What is Annotation in TestNG?

Annotations in TestNG are lines of code that can control how the method below them will be executed. They are always preceded by the @ symbol. A very early and quick TestNG Example is the one shown below.

Annotations will be discussed later in the section named “Annotations used in TestNG,” so it is perfectly ok if you do not understand the above TestNG Example just yet. It is just important to note for now that annotations in TestNG are easier to code and understand than in JUnit.

The ability to run tests in parallel is available in TestNG but not in JUnit, so the TestNG framework is preferred for testers using Selenium Grid.

How to Write Test Cases in TestNG?

Step 1) Write your business logic and insert the TestNG annotations in your code.
Step 2) Add more information like class name, groups name, package name, etc
Step 3) Run the TestNG.

Create Test Case Using TestNG Annotations:

Now, we will learn how to create our first test case using TestNG Annotations in Selenium:

Before we create a test case, we should first set up a new TestNG Project in Eclipse and name it “FirstTestNGProject”.

Setting up a new TestNG Project:

Step 1: Click File > New > Java Project

Step 2: Type “FirstTestNGProject” as the Project Name then click Next.

Step 3: We will now start to import the TestNG Libraries onto our project. Click on the “Libraries” tab, and then “Add Library…”

Step 4: On the Add Library dialog, choose “TestNG” and click Next.

Step 5: Click Finish.

You should notice that TestNG is included on the Libraries list.

Step 6: We will now add the JAR files that contain the Selenium API. These files are found in the Java client driver that we downloaded from https://www.selenium.dev/downloads/ when we were installing Selenium and Eclipse in the previous chapters.

Then, navigate to where you have placed the Selenium JAR files.

After adding the external JARs, your screen should look like this.

Step 7: Click Finish and verify that our FirstTestNGProject is visible on Eclipse’s Package Explorer window.

How to Create a New TestNG Test File:

Now that we are done setting up our project in this TestNG tutorial, let us create a new TestNG file.

Step 1: Click on ‘src’ and Choose other.
Right-click on the “src” package folder then choose New > Other…

Step 2: Select the TestNG class.
Click on the TestNG folder and select the “TestNG class” option. Click Next.

Step 3: Type the values.
Type the values indicated below on the appropriate input boxes and click Finish. Notice that we have named our Java file “FirstTestNGFile”.

Step 4: Template Created.
Eclipse should automatically create the template for our TestNG file shown below.

Coding of our First TestNG Test Case Example:

Let us now create our first Test Case that will check if Mercury Tours’ homepage is correct. Type your code as shown in the below TestNG Example:

package firsttestngpackage;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.*;public class firsttestngfile {
public String baseUrl = "http://demo.guru99.com/test/newtours/";
String driverPath = "C:\\geckodriver.exe";
public WebDriver driver ;

@Test
public void verifyHomepageTitle() {

System.out.println("launching firefox browser");
System.setProperty("webdriver.gecko.driver", driverPath);
driver = new FirefoxDriver();
driver.get(baseUrl);
String expectedTitle = "Welcome: Mercury Tours";
String actualTitle = driver.getTitle();
Assert.assertEquals(actualTitle, expectedTitle);
driver.close();
}
}

Notice the following.

  • TestNG does not require you to have a main() method.
  • Methods need not be static.
  • We used the @Test annotation. @Test is used to tell that the method under it is a test case. In this case, we have set the verifyHomepageTitle() method to be our test case, so we placed an ‘@Test’ annotation above it.
  • Since we use annotations in TestNG, we needed to import the package org.testng.annotations.*.
  • We used the Assert class. The Assert class is used to conduct verification operations in TestNG. To use it, we need to import the org. testng.Assert package.

You may have multiple test cases (therefore, multiple @Test annotations) in a single TestNG file. This will be tackled in more detail later in the section “Annotations used in TestNG.”

Running the Test:

To run the test, simply run the file in Eclipse as you normally do. The eclipse will provide two outputs — one in the Console window and the other in the TestNG Results window.

Checking reports created by TestNG:

The Console window in Eclipse gives a text-based report of our test case results while the TestNG Results window gives us a graphical one.

Generating HTML Reports:

TestNG can generate reports in HTML format.

Step 1: After running our FirstTestNGFile that we created in the previous section, right-click the project name (FirstTestNGProject) in the Project Explorer window then click on the “Refresh” option.

Step 2: Notice that a “test-output” folder was created. Expand it and look for an index.html file. This HTML file is a report of the results of the most recent test run.

Step 3: Double-click on that index.html file to open it within Eclipse’s built-in web browser. You can refresh this page any time after you rerun your test by simply pressing F5 just like in ordinary web browsers.

Annotations used in TestNG:

In the previous section, you have been introduced to the @Test annotation. Now, we shall be studying more advanced annotations and their usage.

Multiple Test Cases:

We can use multiple @Test annotations in a single TestNG file. By default, methods annotated by @Test are executed alphabetically. See the code below. Though the methods c_test, a_test, and b_test are not arranged alphabetically in the code, they will be executed as such.

Run this code and on the generated index.html page, click “Chronological view.”

Parameters:

If you want the methods to be executed in a different order, use the parameter “priority”. Parameters are keywords that modify the annotation’s function.

  • Parameters require you to assign a value to them. You do. this by placing a “=” next to them, and then followed by the value.
  • Parameters are enclosed in a pair of parentheses which are placed right after the annotation like the code snippet shown below.

TestNG will execute the @Test annotation with the lowest priority value up to the largest. There is no need for your priority values to be consecutive.

The TestNG HTML report will confirm that the methods were executed based on the ascending value of priority.

Multiple Parameters:

Aside from “priority,” @Test has another parameter called “alwaysRun” which can only be set to either “true” or “false.” To use two or more parameters in a single annotation, separate them with a comma such as the one shown below.@Test(priority = 0, alwaysRun = true)

@BeforeTest and @AfterTest:

@BeforeTestmethods under this annotation will be executed before the first test case in the TestNG file.@AfterTestmethods under this annotation will be executed after all test cases in the TestNG file are executed.

Consider the code below.

package firsttestngpackage;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.*;
public class firsttestngfile {
public String baseUrl = "http://demo.guru99.com/test/newtours/";
String driverPath = "C:\\geckodriver.exe";
public WebDriver driver ;

@BeforeTest
public void launchBrowser() {
System.out.println("launching firefox browser");
System.setProperty("webdriver.gecko.driver", driverPath);
driver = new FirefoxDriver();
driver.get(baseUrl);
}
@Test
public void verifyHomepageTitle() {
String expectedTitle = "Welcome: Mercury Tours";
String actualTitle = driver.getTitle();
Assert.assertEquals(actualTitle, expectedTitle);
}
@AfterTest
public void terminateBrowser(){
driver.close();
}
}

Applying the logic presented by the table and the code above, we can predict that the sequence by which methods will be executed is:

  • 1st — launchBrowser()
  • 2nd — verifyHomepageTitle()
  • 3rd — terminateBrowser()

The placement of the annotation blocks can be interchanged without affecting the chronological order by which they will be executed. Let’s understand with a TestNG Example and try to rearrange the annotation blocks such that your code would look similar to the one below.

package firsttestngpackage;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.*;
public class firsttestngfile {
public String baseUrl = "http://demo.guru99.com/test/newtours/";
String driverPath = "C:\\geckodriver.exe";
public WebDriver driver ;
@AfterTest //Jumbled
public void terminateBrowser(){
driver.close();
}
@BeforeTest //Jumbled
public void launchBrowser() {
System.out.println("launching firefox browser");
System.setProperty("webdriver.gecko.driver", driverPath);
driver = new FirefoxDriver();
driver.get(baseUrl);
}
@Test //Jumbled
public void verifyHomepageTitle() {
String expectedTitle = "Welcome: Mercury Tours";
String actualTitle = driver.getTitle();
Assert.assertEquals(actualTitle, expectedTitle);
}

}

Run the code above and notice that

@BeforeMethod and @AfterMethod:

@BeforeMethodmethods under this annotation will be executed before each method in each test case.@AfterMethodmethods under this annotation will be executed after each method in each test case.

In Mercury Tours, suppose we like to verify the titles of the target pages of the two links below.

The flow of our test would be:

  • Go to the homepage and verify its title.
  • Click REGISTER and verify the title of its target page.
  • Go back to the homepage and verify if it still has the correct title.
  • Click SUPPORT and verify the title of its target page.
  • Go back to the homepage and verify if it still has the correct title.

The code below illustrates how @BeforeMethod and @AfterMethod are used to efficiently execute the scenario mentioned above.

package firsttestngpackage;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.*;
@Test
public class firsttestngfile {
public String baseUrl = "http://demo.guru99.com/test/newtours/";
String driverPath = "C:\\geckodriver.exe";
public WebDriver driver;
public String expected = null;
public String actual = null;
@BeforeTest
public void launchBrowser() {
System.out.println("launching firefox browser");
System.setProperty("webdriver.gecko.driver", driverPath);
driver= new FirefoxDriver();
driver.get(baseUrl);
}

@BeforeMethod
public void verifyHomepageTitle() {
String expectedTitle = "Welcome: Mercury Tours";
String actualTitle = driver.getTitle();
Assert.assertEquals(actualTitle, expectedTitle);
}
@Test(priority = 0)
public void register(){
driver.findElement(By.linkText("REGISTER")).click() ;
expected = "Register: Mercury Tours";
actual = driver.getTitle();
Assert.assertEquals(actual, expected);
}
@Test(priority = 1)
public void support() {
driver.findElement(By.linkText("SUPPORT")).click() ;
expected = "Under Construction: Mercury Tours";
actual = driver.getTitle();
Assert.assertEquals(actual, expected);
}
@AfterMethod
public void goBackToHomepage ( ) {
driver.findElement(By.linkText("Home")).click() ;
}

@AfterTest
public void terminateBrowser(){
driver.close();
}
}

After executing this test, your TestNG should report the following sequence.

Simply put, @BeforeMethod should contain methods that you need to run before each test case while @AfterMethod should contain methods that you need to run after each test case.

Summary of TestNG Annotations:

@BeforeSuite: The annotated method will be run before all tests in this suite have run.

@AfterSuite: The annotated method will be run after all tests in this suite have run.

@BeforeTest: The annotated method will be run before any test method belonging to the classes inside the tag is run.

@AfterTest: The annotated method will be run after all the test methods belonging to the classes inside the tag have run.

@BeforeGroups: The list of groups that this configuration method will run before. This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked.

@AfterGroups: The list of groups that this configuration method will run after. This method is guaranteed to run shortly after the last test method that belongs to any of these groups is invoked.

@BeforeClass: The annotated method will be run before the first test method in the current class is invoked.

@AfterClass: The annotated method will be run after all the test methods in the current class have been run.

@BeforeMethod: The annotated method will be run before each test method.

@AfterMethod: The annotated method will be run after each test method.

@Test: The annotated method is a part of a test case

Conclusion:

  • TestNG is a testing framework that is capable of making Selenium tests easier to understand and of generating reports that are easy to understand.
  • The main advantages of TestNG over JUnit are the following.
  • Annotations are easier to use and understand.
  • Test cases can be grouped more easily.
  • TestNG allows us to create parallel tests.
  • The Console window in Eclipse generates a text-based result while the TestNG window is more useful because it gives us a graphical output of the test result plus other meaningful details such as:
  • Runtimes of each method.
  • The chronological order by which methods were executed
  • TestNG is capable of generating HTML-based reports.
  • Annotations can use parameters just like the usual Java TestNG methods.
  • TestNG Data provider is a way to pass parameters into the test function which passes different values in test cases in a single execution.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Email Verification with Flutter Firebase

0

Hello!! Flutter Devs, In this article we will learn how to verify a user’s email address using an email verification link with the help of firebase authentication.

If you have used firebase authentication, you must have noticed that you can Sign in with any anonymous email address that is not yours. So you must be finding a way to verify that email address for the authenticity of that user’s email address.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.



Firebase Project Setup:

First, we will set up our Project with Firebase, skip this part if you have already done this.

Open the Firebase console and click the “Add project” option.

Enter your project name here!

Now by clicking continue you will be redirected to the next steps, where you can enable Google Analytics for your Firebase project.

Android Setup:

Click on Android Icon on the dashboard of the firebase project console.

Now Register your android app by filling in the required details.

Now Download the google-services.json file from here and put it in your android/app folder.

IOS Configuration:

Register the IOS app to Firebase, and the iOS bundle Id must be the same in the Xcode project and on the firebase console.

Download configuration files for your app and adds them to your project folder.

Implementation:

Enable Email/Password authentication on the firebase console

Add dependencies to pubspec — yaml file.

dependencies:firebase_core: ^2.1.1
firebase_auth: ^4.1.0

We will now initialize Firebase in our project

Let’s create a new file called firebase_constants.dart, where we are going to make a global auth instance for our app and initialize that in main. dart file.

firebase_constants.dart

import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
final Future<FirebaseApp> firebaseInitialization = Firebase.initializeApp();
FirebaseAuth auth = FirebaseAuth.instance;

main.dart

void main()async {
WidgetsFlutterBinding.ensureInitialized();
await firebaseInitialization;
runApp(const MyApp());
}

Let’s create a function for the Sign-Up button to handle email authentication. This function will register a user in firebase.

static Future<User?> signUp(
{required String userEmail,
required String password,
required BuildContext context}) async {
try {
UserCredential userCredential = await FirebaseAuth.instance
.createUserWithEmailAndPassword(email: userEmail, password: password);
return userCredential.user;
} on FirebaseAuthException catch (e) {
if (e.code == 'weak-password') {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('The password provided is too weak.')));
} else if (e.code == 'email-already-in-use') {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('The account already exists for that email.')));
}
return null;
} catch (e) {
debugPrint(e.toString());
return null;
}
}

auth_page.dart

import 'package:email_auth/utils/constants/firebase_constants.dart';
import 'package:email_auth/views/auth/email_verification_page.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';

class AuthPage extends StatefulWidget {
const AuthPage({Key? key}) : super(key: key);

@override
State<AuthPage> createState() => _AuthPageState();
}

class _AuthPageState extends State<AuthPage> {

final TextEditingController _emailController = TextEditingController();
final TextEditingController _passwordController = TextEditingController();
bool _isLoading = false;

static Future<User?> signUp(
{required String userEmail,
required String password,
required BuildContext context}) async {
try {
UserCredential userCredential = await FirebaseAuth.instance
.createUserWithEmailAndPassword(email: userEmail, password: password);
return userCredential.user;
} on FirebaseAuthException catch (e) {
if (e.code == 'weak-password') {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('The password provided is too weak.')));
} else if (e.code == 'email-already-in-use') {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('The account already exists for that email.')));
}
return null;
} catch (e) {
debugPrint(e.toString());
return null;
}
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 18),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextFormField(
controller: _emailController,
// validator: (val) => widget.onValidate(val),
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide:
const BorderSide(color: Colors.grey, width: 1),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide:
const BorderSide(color: Colors.grey, width: 1),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide:
const BorderSide(color: Colors.grey, width: 1),
),
filled: true,
fillColor: Colors.white,
hintText: 'Enter Email',
// hintStyle: AppTextStyle.lightGreyText,
isDense: true,
contentPadding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 15),
),
),
const SizedBox(height: 20,),
TextFormField(
controller: _passwordController,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide:
const BorderSide(color: Colors.grey, width: 1),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide:
const BorderSide(color: Colors.grey, width: 1),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide:
const BorderSide(color: Colors.grey, width: 1),
),
filled: true,
fillColor: Colors.white,
hintText: 'Enter Password',
// hintStyle: AppTextStyle.lightGreyText,
isDense: true,
contentPadding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 15),
),
obscureText: true,
),
const SizedBox(height: 20,),
_isLoading ? const CircularProgressIndicator() : ElevatedButton(onPressed: ()async{
setState(() {
_isLoading = true;
});
await signUp(userEmail: _emailController.text, password: _passwordController.text, context: context);
if(auth.currentUser != null){
Navigator.push(context, MaterialPageRoute(builder: (ctx)=>const EmailVerificationScreen()));
}
setState(() {
_isLoading = false;
});
}, child: const Text('Sign Up'))
],
),
),
),
);
}
}

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Output

Also, let’s create a page where we will check the status of email verification.

Here we will set a periodic timer in the initState() state that will check the status of the email if it is verified or not.

email_verification_page.dart

import 'dart:async';
import 'package:email_auth/utils/constants/firebase_constants.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
class EmailVerificationScreen extends StatefulWidget {
const EmailVerificationScreen({Key? key}) : super(key: key);

@override
State<EmailVerificationScreen> createState() =>
_EmailVerificationScreenState();
}

class _EmailVerificationScreenState extends State<EmailVerificationScreen> {
bool isEmailVerified = false;
Timer? timer;
@override
void initState() {
// TODO: implement initState
super.initState();
FirebaseAuth.instance.currentUser?.sendEmailVerification();
timer =
Timer.periodic(const Duration(seconds: 3), (_) => checkEmailVerified());
}

checkEmailVerified() async {
await FirebaseAuth.instance.currentUser?.reload();

setState(() {
isEmailVerified = FirebaseAuth.instance.currentUser!.emailVerified;
});

if (isEmailVerified) {
// TODO: implement your code after email verification
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text("Email Successfully Verified")));

timer?.cancel();
}
}

@override
void dispose() {
// TODO: implement dispose
timer?.cancel();
super.dispose();
}

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 35),
const SizedBox(height: 30),
const Center(
child: Text(
'Check your \n Email',
textAlign: TextAlign.center,
),
),
const SizedBox(height: 8),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0),
child: Center(
child: Text(
'We have sent you a Email on ${auth.currentUser?.email}',
textAlign: TextAlign.center,
),
),
),
const SizedBox(height: 16),
const Center(child: CircularProgressIndicator()),
const SizedBox(height: 8),
const Padding(
padding: EdgeInsets
.symmetric(horizontal: 32.0),
child: Center(
child: Text(
'Verifying email....',
textAlign: TextAlign.center,
),
),
),
const SizedBox(height: 57),
Padding(
padding: const EdgeInsets
.symmetric(horizontal: 32.0),
child: ElevatedButton(
child: const Text('Resend'),
onPressed: () {
try {
FirebaseAuth.instance.currentUser
?.sendEmailVerification();
} catch (e) {
debugPrint('$e');
}
},
),
),
],
),
),
),
);
}
}

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Output

Now if your email address is correct then you are going to receive an email from your firebase project and now by clicking on the link you can verify your email address.

Yay!! Your email is now verified successfully.

Email Verified Screen

When we run the application, we ought to get the screen’s output like the underneath screen video.

Final Output Video

Conclusion:

In this article, we learned how easily we can do email verification with the help of Firebase.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


GitHub Link:

find the source code of the Email Verification using Firebase:

GitHub – flutter-devs/email_verification_using_firebase
A new Flutter project. This project is a starting point for a Flutter application. A few resources to get you started…github.com


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.


Email Authentication Using Firebase In Flutter

0

Firebase is one of the recommended Back-End for Flutter applications since it gives many accessible functionalities and extraordinary integration with Flutter. One of the highlights offered by Firebase is Authentication. This way we can integrate Email, Phone, Google, Apple, and a lot more authentications in our applications!

In this article, we will use the firebase_auth package for Firebase Authentication.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents::

Introduction

Implementation

Code Implement

Conclusion

GitHub Link


Introduction:

The demo video below shows how to implement Email Authentication using Firebase in Flutter, and also how we can sign-up or login using email, we have made a demo app similar to the famous social media app Instagram, this provides users the option to both sign-up and log-in using email and password, and this can be achieved all because of Firebase.

The user can also interact with the posts on the home page but more on that later, let’s start with the integration of Email Authentication using Firebase.

Demo Modules::

Sign Up Method
Log In Method

Implementation:

Step 1: Enabling Email/Password Authentication from Firebase Console

Once you have added your project and app to Firebase Console, the first step is to enable Authentication and enable Email/Password from it.

When you click on Authentication, you will get a welcome screen from where you can click on Get Started.

When you click on the button, you will be redirected to the Sign In Method list. From there you can enable Email/Password.

Now that the first step is done, let’s dive deep into the coding part.

Step 2: Adding the dependencies

Add dependencies to pubspec — yaml file.

dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
firebase_core: ^1.Conclusion:0.0
cloud_firestore: ^1.0.0
firebase_auth: ^1.0.0
firebase_storage: ^8.0.0
provider: ^5.0.0

Step 3: Run flutter packages get in the root directory of your app.

How to implement code in dart file :

We will create sign-up and log-in screens, You need to implement them in your code respectively:

Create a new dart file called signup_screen.dart inside the lib folder.

We will create a sign-up form page which will be a stateful widget, which will be responsible for signing up users.

import 'package:flutter/material.dart';
import '../services/auth_methods.dart';
import '../utils/utils.dart';

class SignupScreen extends StatefulWidget {
static final String id = 'signup_screen';

@override
_SignupScreenState createState() => _SignupScreenState();
}

class _SignupScreenState extends State<SignupScreen> {
final _formKey = GlobalKey<FormState>();
String? _name;
String? _email;
String? _password;
String? _userName;
bool _isLoading = false;

@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
'Instagram',
style: TextStyle(
fontFamily: 'Billabong',
fontSize: 50.0,
),
),
Form(
key: _formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(
horizontal: 30.0,
vertical: 10.0,
),
child: TextFormField(
decoration: InputDecoration(labelText: 'Name'),
validator: (input) => input!.trim().isEmpty
? 'Please enter a valid name'
: null,
onSaved: (input) => _name = input!,
),
),Padding(
padding: EdgeInsets.symmetric(
horizontal: 30.0,
vertical: 10.0,
),
child: TextFormField(
decoration: InputDecoration(labelText: 'Username'),
validator: (input) => input!.trim().isEmpty
? 'Please enter a valid username'
: null,
onSaved: (input) => _userName = input!,
),
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 30.0,
vertical: 10.0,
),
child: TextFormField(
decoration: InputDecoration(labelText: 'Email'),
validator: (input) => !input!.contains('@')
? 'Please enter a valid email'
: null,
onSaved: (input) => _email = input!,
),
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 30.0,
vertical: 10.0,
),
child: TextFormField(
decoration: InputDecoration(labelText: 'Password'),
validator: (input) => input!.length < 6
? 'Must be at least 6 characters'
: null,
onSaved: (input) => _password = input!,
obscureText: true,
),
),
SizedBox(height: 20.0),
Padding(
padding: EdgeInsets.only(
left: 40,
right: 40,
),
child: Container(
width: double.infinity,
color: Colors.blue,
child: _isLoading
? Center(
child: CircularProgressIndicator(
color: Colors.white,
),
)
: TextButton(
onPressed: () => _signUp(),
child: Text(
'Sign Up',
style: TextStyle(
color: Colors.white,
fontSize: 18.0,
),
),
),
),
),
SizedBox(height: 20.0),
Container(
color: Colors.blue,
padding: EdgeInsets.symmetric(horizontal: 50),
child: TextButton(
onPressed: () => Navigator.pop(context),
child: Text(
'Back to Login',
style: TextStyle(
color: Colors.white,
fontSize: 18.0,
),
),
),
),
],
),
),
],
),
),
),
);
}
}

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Create a new dart file called login_screen.dart inside the lib folder.

We will create a login page where users that signed up using email and password can directly log in.

import 'package:demo_email_authentication/screens/signup_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'dart:io';

import '../services/auth_methods.dart';
import '../utils/utils.dart';

class LoginScreen extends StatefulWidget {
static final String id = 'login_screen';

@override
_LoginScreenState createState() => new _LoginScreenState();
}

class _LoginScreenState extends State<LoginScreen> {
final TextEditingController _emailIdController = new TextEditingController();
final TextEditingController _passwordController = new TextEditingController();
bool _isLoading = false;

var _textStyleBlack = new TextStyle(fontSize: 12.0, color: Colors.black);
var _textStyleGrey = new TextStyle(fontSize: 12.0, color: Colors.grey);
var _textStyleBlueGrey =
new TextStyle(fontSize: 12.0, color: Colors.blueGrey);

@override
void dispose() {
super.dispose();
_emailIdController.dispose();
_passwordController.dispose();
}

@override
Widget build(BuildContext context) {
return new Scaffold(
bottomNavigationBar: _bottomBar(),
body: _body(),
);
}

Widget _userIDEditContainer() {
return new Container(
child: new TextField(
controller: _emailIdController,
decoration: new InputDecoration(
hintText: 'Phone number, email or username',
border: new OutlineInputBorder(
borderSide: new BorderSide(color: Colors.black),
),
isDense: true),
style: _textStyleBlack,
),
);
}

Widget _passwordEditContainer() {
return Container(
padding: EdgeInsets.only(top: 5.0),
child: TextField(
controller: _passwordController,
obscureText: true,
decoration: InputDecoration(
hintText: 'Password',
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
isDense: true),
style: _textStyleBlack,
),
);
}

Widget _loginContainer() {
return GestureDetector(
onTap: _logInUser,
child: Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 10.0),
width: 500.0,
height: 40.0,
child: _isLoading
? Center(
child: CircularProgressIndicator(
color: Colors.white,
),
)
: Text(
"Log In",
style: TextStyle(color: Colors.white),
),
color: Colors.blue,
),
);
}

Widget _facebookContainer() {
return Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 10.0),
width: 500.0,
height: 40.0,
color: Colors.blue,
child: GestureDetector(
onTap: null,
child: Text(
"Log in with facebook",
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
),
);
}

Widget _bottomBar() {
return Container(
alignment: Alignment.center,
height: 49.5,
child: Column(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: 1.0,
color: Colors.grey.withOpacity(0.7),
),
Padding(
padding: EdgeInsets.only(bottom: 0.5),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Don\'t have an account?', style: _textStyleGrey),
Container(
child: TextButton(
onPressed: () =>
Navigator.pushNamed(context, SignupScreen.id),
child: Text('Sign Up.', style: _textStyleGrey),
),
),
],
)),
],
),
],
),
);
}

Widget _body() {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.all(25.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 25.0, bottom: 15.0),
child: Text(
'Instagram',
style: TextStyle(fontFamily: 'Billabong', fontSize: 50.0),
),
),
_userIDEditContainer(),
_passwordEditContainer(),
_loginContainer(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Forgot your login details?',
style: _textStyleGrey,
),
TextButton(
onPressed: () {},
child: Text(
'Get help logging in.',
style: _textStyleBlueGrey,
),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: 1.0,
width: MediaQuery.of(context).size.width / 2.7,
color: Colors.grey,
child: ListTile(),
),
Text(
' OR ',
style: TextStyle(color: Colors.blueGrey),
),
Container(
height: 1.0,
width: MediaQuery.of(context).size.width / 2.7,
color: Colors.grey,
),
],
),
_facebookContainer()
],
),
);
}

_showEmptyDialog(String title) {
if (Platform.isAndroid) {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) => AlertDialog(
content: Text("$title can't be empty"),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text("OK"))
],
),
);
} else if (Platform.isIOS) {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) => CupertinoAlertDialog(
content: Text("$title can't be empty"),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text("OK"))
],
),
);
}
}
}

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Now let’s initialize firebase in our app, inmain.dartinside thelibfolder.

void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}

The WidgetsFlutterBinding.ensureInitialized(); ensures that the UI is not rendered until our initialization is not done.

Next, we will create a new dart file calledauth_methods.dart

This will contain the two most required functions for email authentication using firebase, i.e. sign-up and log-in.

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';

import '../models/user_model.dart';

class AuthMethods {
final FirebaseAuth _auth = FirebaseAuth.instance;
final FirebaseFirestore _firestore = FirebaseFirestore.instance;

Future<String> signUpUser({
required String? name,
required String? email,
required String? password,
required String? username,
}) async {
String result = 'Some error occurred';
try {
if (email!.isNotEmpty || name!.isNotEmpty || password!.isNotEmpty) {
UserCredential user = await _auth.createUserWithEmailAndPassword(
email: email, password: password!);
print(user.user!.uid);

UserModel userModel = UserModel(
email: email,
name: name!,
uid: user.user!.uid,
username: username!,
followers: [],
following: [],
);

await _firestore.collection('users').doc(user.user!.uid).set(
userModel.toJson(),
);
result = 'success';
}
} catch (err) {
result = err.toString();
}
return result;
}

Future<String> logInUser({
required String email,
required String password,
}) async {
String result = 'Some error occurred';
try {
if (email.isNotEmpty || password.isNotEmpty) {
await _auth.signInWithEmailAndPassword(
email: email, password: password);
result = 'success';
}
} catch (err) {
result = err.toString();
}
return result;
}
}

Along these lines, as we are involving Firebase for Authentication, we have pre-constructed methods for log-in and sign-up. For sign-up, we can implement createUserWithEmailAndPassword which takes 2 parameters i.e. email and password, and some parameters like name and email for our app. Likewise, we can utilize signInWithEmailAndPassword which similarly takes 2 parameters i.e. email and password. Here, we made two user-defined methods to deal with our Firebase calls. These methods accept email and password as parameters and pass them to the Firebase functions.

Here, if you notice, we are using UserModel. We have just created a simple model class that looks like this:

import 'package:cloud_firestore/cloud_firestore.dart';

class UserModel{
final String email;
final String name;
final String uid;
final String username;
final List followers;
final List following;

UserModel(
{required this.email,
required this.name,
required this.username,
required this.uid,
required this.followers,
required this.following});

Map<String, dynamic> toJson() => {
"email": email,
"uid": uid,
"name": name,
"username": username,
"followers": followers,
"following": following,
};

static UserModel? fromSnap (DocumentSnapshot snap) {
var snapshot = snap.data() as Map<String, dynamic>;
return UserModel(
username: snapshot['username'],
uid: snapshot['uid'],
name: snapshot['name'],
following: snapshot['following'],
followers: snapshot['followers'],
email: snapshot['email'],
);
}
}

Finally we create a new dart file called home_screen.dart inside the lib folder.

This screen will reflect if the user successfully signs up or logs in using Email Authentication. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Now that all the methods are ready in our auth_methods.dart file,

Let’s implement these methods in our UI,

void _signUp() async {
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
setState(() {
_isLoading = true;
});
// Logging in the user w/ Firebase
String result = await AuthMethods()
.signUpUser(name: _name, email: _email, password: _password, username: _userName);
if (result != 'success') {
showSnackBar(result, context);
} else {
Navigator.pop(context);
}
setState(() {
_isLoading = false;
});
}
}

We can call the above function in the onPressed method of the sign-up button.

You can check out the sign-up method demo in the demo modules above.

Let’s do the same for the log-in button,

void _logInUser() async {
if (_emailIdController.text.isEmpty) {
_showEmptyDialog("Type something");
} else if (_passwordController.text.isEmpty) {
_showEmptyDialog("Type something");
}
setState(() {
_isLoading = true;
});
String result = await AuthMethods().logInUser(
email: _emailIdController.text,
password: _passwordController.text,
);
if (result == 'successs') {

} else {
showSnackBar(result, context);
}
setState(() {
_isLoading = false;
});
}

You can check out the log-in method demo in the demo modules above.

Conclusion:

In the article, I have shed some light on the fundamental construction of Email Authentication using Firebase in a flutter program, you can modify this code as per your need. This was a little prologue to Email Authentication using Firebase from my side, and its functioning using Flutter.

I trust this blog will give you adequate data on trying up Email Authentication using Firebase in your flutter projects. We showed you what Email Authentication using Firebase is. its implementations, and how to utilize Email Authentication using Firebase. Made a demo app to work in your flutter applications. So if it’s not too much trouble, try it.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


GitHub Link:

find the source code of the Flutter Email Authentication using Firebase Demo:

GitHub – flutter-devs/email_authentication_using_firebase
A new Flutter project. This project is a starting point for a Flutter application. A few resources to get you started…github.com


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.