Friday, February 8, 2019

Create Fake Test Data for Selenium Tests using Java Faker API

Test data is necessary in testing an application, in automation the test data will be either hard-coded or provided from the external sources like Excel, CSV, XML, Database and etc. If its live data that needs to be fetched from sources like Database we have to follow it, there is no other go.

But when we are providing the test data from external files for validating certain functionalities that data needs to be revised after some iterations. It takes lot of manual effort of tester to re-create the test data.

Java Faker API:

In order to reduce the manual effort in creating the test data, we use Java Faker API. Java Faker API is Java library which generates data related to different categories like Company, Internet, Human, Numbers, Food, Finance, Telephone and etc. this covers almost all the type of data that a typical software application would require.

Configure Java Faker API in Selenium Project:

Add Java Faker API maven dependency in the pom.xml (we are using Maven project) as shown below.

Create separate utility class that generates the fake data using Java Faker API library. In the below class we created methods that generate first name, last name, password, email and etc.

In the below Selenium test, we are automating facebook account create form. In this test we need to enter first name, last name, email Id and password.

We created an object to JavaFakerAPI utility class and called the required methods in the selenium tests.

Run this test many times and every time unique values will be generated and we can run this selenium test without changing the test data every time we execute it.

This is how we can reduce the manual effort in creating the new test data every time.

#HappyLearning #HappyTesting

30 comments:

  1. Valuable info.Thanks for sharing.Want to know same package will use selenium C#

    ReplyDelete
  2. Hi Venkat, I don't think its possible to use same for Selenium C#. If I found, will let you know.

    ReplyDelete
  3. You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. where can i buy a fake id

    ReplyDelete
  4. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. best fake id

    ReplyDelete
  5. I have to search sites with relevant information on given topic and provide them to teacher our opinion and the article. Scannable Fake Id

    ReplyDelete
  6. This is a great blog that explains how we can Create Fake Test Data for Selenium Tests. You can buy high quality Fake ID for Sale at great prices.

    ReplyDelete
  7. The frenzy doesn't stop with the IT division. For other organization directors, IT changes implies hours or long stretches of preparing, vacation and loss of profitability that accompanies IT issues, disappointments, or framework redesigns. ExcelR Data Science Courses

    ReplyDelete
  8. Really useful information. Thank you so much for sharing. It will help everyone. Keep Post.

    Best Microsoft Training in Bangalore for Microsoft, we provide the Microsoft training project with trainers having more than 5 Years of Microsoft training experience, we also provide 100% placement support.

    ReplyDelete
  9. Hi there, I read your blogs on a regular basis. Your humoristic style is witty, keep it up! Thank You for Providing Such a Unique and valuable information, If you are looking for the best Google Search Api, then visit SERP House.I enjoyed this post.

    ReplyDelete
  10. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic.

    Selenium Training in Electronic City

    ReplyDelete
  11. Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging.
    Microsoft Azure Training in Electronic City

    ReplyDelete
  12. Nice post I have been searching for a useful post like this on salesforce course details, it is highly helpful for me and I have a great experience with this, Salesforce Training India

    ReplyDelete
  13. Very informative post ! There is a lot of information here that can help any business get started with a successful social networking campaign !
    Data Science Institute in Bangalore

    ReplyDelete
  14. After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article. machine learning course training in coimbatore

    ReplyDelete
  15. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    online course

    ReplyDelete
  16. Very impressive and interesting blog found to be well written in a simple manner that everyone will understand and gain the enough knowledge from your blog being more informative is an added advantage for the users who are going through it. Once again nice blog keep it up.

    360DigiTMG Python Course

    ReplyDelete
  17. Actually I read it yesterday but I had some thoughts about it and today I wanted to read it again because it is very well written.
    artificial intelligence course in bangalore

    ReplyDelete
  18. "Thank you for sharing wonderful information with us.Really useful for everyone data scientist courses
    "

    ReplyDelete
  19. nice http://www.qababu.com/2019/02/create-fake-test-data-for-selenium.html

    ReplyDelete
  20. There are many pupils who make use of fake ids and fake driving license for some intentions, and those who wish to buy the most effective fake ids, Club21IDs is the best platform for them. Anyone can attain good quality fake ids through the help of this specific platform. If you pay a visit to this https://apa.instructure.com/eportfolios/420/_/Attain_Increased_Source_Of_Information_With_Cheap_Id site, you will receive progressively more details about the fake driving license.

    ReplyDelete
  21. Im no expert, but I believe you just made an excellent point. You certainly fully understand what youre speaking about, and I can truly get behind that. Buy Fake IDs

    ReplyDelete
  22. Please feel free to visit my website to learn more about this course and others. data science course in india

    ReplyDelete
  23. Identity robbery alludes to concealing one's unique identity and wrongfully abusing another person's identity. UNITED KINGDOM FAKE DRIVING LICENCE

    ReplyDelete
  24. Fake Casting in WoW PvP is an advanced tactic to bate enemy players into advantageous situations. Fake Casting is basically exactly what it sounds like. To master this, you should start casting a spell, wait for it to get around half way through, and then move your character to prevent it from casting. best fake id

    ReplyDelete
  25. iPods, iPads, Blackberries, DVRs, Kindles and more - all fascinating forms of technology. As the technology era continues to explode, there's something interesting that's exploding with it. Stress. Discover how to overcome stress from technology today. fake id usa

    ReplyDelete
  26. A fake alarm system if often just as effective as a real alarm system because the sound is what has the most impact on a burglar. But just as with real alarm systems, fake systems can also come in many different kinds and price ranges. fake id usa

    ReplyDelete
  27. Look for defects. The most well-known approach to recognize a fake distinguishing proof is to search for defects on the actual ID. Keep in mind, any association that is passing out drivers licenses will have the cycle idealized, and will seldom, if at any time hand out IDs that are not up to standard. New York Fake driver's license

    ReplyDelete

DevOps 01: What is DevOps and How it benefits organizations?

DevOps is a culture in an organization, where the development team and operations team help each other by sharing information, process and t...