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

45 comments:

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

    ReplyDelete
    Replies
    1. Great Article
      android based projects

      Java Training in Chennai

      FInal Year Project Centers in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

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

    ReplyDelete
  3. After reading this web site I am very satisfied simply because this site is providing comprehensive knowledge for you to audience.
    Thank you to the perform as well as discuss anything incredibly important in my opinion. We loose time waiting for your next article writing in addition to I beg one to get back to pay a visit to our website in


    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune

    ReplyDelete
  4. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Selenium Training in Electronic City

    ReplyDelete
  5. 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
  6. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. fake id online

    ReplyDelete
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging.
    Microsoft Azure Training in Electronic City

    ReplyDelete
  15. Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites!

    machine learning course

    artificial intelligence course in mumbai

    ReplyDelete
  16. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!

    data science course

    ReplyDelete
  17. wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries.
    Data Science Course

    ReplyDelete
  18. 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
  19. Great post! I am actually getting ready to across this information, It’s very helpful for this blog. Also great with all of the valuable information you have Keep up the good work you are doing well.
    CRS Info Solutions Salesforce training for beginners   

    ReplyDelete
  20. I am so happy to found your blog post because it's really very informative. Please keep writing this kind of blogs and I regularly visit this blog. Have a look at my services.
    I have found this Salesforce training in India worth joining course. Try this Salesforce training in Hyderabad with job assistance. Join Salesforce training institutes in ameerpet with certification. Enroll for Salesforce online training in hyderabad with hands on course.  

    ReplyDelete
  21. Myself so glad to establish your blog entry since it's actually quite instructive. If it's not too much trouble continue composing this sort of web journals and I normally visit this blog. Examine my administrations.
    Go through these Salesforce Lightning Features course. Found this Salesforce CRM Using Apex And Visualforce Training worth joining. Enroll for SalesForce CRM Integration Training Program and practice well. 

    ReplyDelete
  22. Gone through this wonderful coures called Salesforce Certification Training in Dallas who are offering fully practical course, who parent is Salesforce Training in USA and they have students at Salesforce Training classes in Canada institutes.

    ReplyDelete
  23. 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
  24. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Correlation vs Covariance
    Simple linear regression

    ReplyDelete
  25. Such a very useful article. Very interesting to read this article. I would like to thank you for the efforts you had made for writing this awesome article.
    Data Science Course in Pune
    Data Science Training in Pune

    ReplyDelete
  26. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    Data Science Certification in Bangalore

    ReplyDelete
  27. I see some amazingly important and kept up to length of your strength searching for in your on the site
    Data Science Course in Bangalore

    ReplyDelete
  28. I think about it is most required for making more on this get engaged
    Data Science Training in Bangalore

    ReplyDelete
  29. Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.

    Simple Linear Regression

    Correlation vs Covariance

    ReplyDelete
  30. Very interesting blog. Many blogs I see these days do not really provide anything that attracts others, but believe me the way you interact is literally awesome.You can also check my articles as well.

    Data Science In Banglore With Placements
    Data Science Course In Bangalore
    Data Science Training In Bangalore
    Best Data Science Courses In Bangalore
    Data Science Institute In Bangalore

    Thank you..

    ReplyDelete
  31. 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
  32. 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
  33. It has fully emerged to crown Singapore's southern shores and undoubtedly placed her on the global map of residential landmarks. I still scored the more points than I ever have in a season for GS. I think you would be hard pressed to find somebody with the same consistency I have had over the years so I am happy with that.
    machine learning courses in bangalore

    ReplyDelete
  34. 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
  35. It has fully emerged to crown Singapore's southern shores and undoubtedly placed her on the global map of residential landmarks. I still scored the more points than I ever have in a season for GS. I think you would be hard pressed to find somebody with the same consistency I have had over the years so I am happy with that.
    artificial intelligence course in bangalore

    ReplyDelete
  36. Terrific post thoroughly enjoyed reading the blog and more over found to be the tremendous one. In fact, educating the participants with it's amazing content. Hope you share the similar content consecutively.

    360DigiTMG Data Analytics Course

    ReplyDelete
  37. Amazing Article ! I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Correlation vs Covariance
    Simple Linear Regression
    data science interview questions
    KNN Algorithm
    Logistic Regression explained

    ReplyDelete
  38. Very nice blogs!!! i have to learning for lot of information for this sites…Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing, data sciecne course in hyderabad

    ReplyDelete
  39. 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
  40. Very nice blogs!!! i have to learning for lot of information for this sites…Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing, best data science courses in hyderabad

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

    ReplyDelete

Selenium4: Working with two parallel windows in Selenium Automation

A new method newWindow() is introduced in Selenium 4 (Alpha). Using this method we can open a new tab or new window from the current window...