×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

FoxFaker Library

FoxFaker Library

FoxFaker Library

(OP)
Hi everybody

I've released a class library that fakes data for you. This is really useful when you're implementing n-tier architecture, 3-layer, or just isolate the business logic and data access layer.


NOTE: you may combine FoxFaker with FoxUnit and FoxMock for a better performance.

https://github.com/Irwin1985/FoxFaker


Basic Usage:

Public Faker
Faker = NewObject("FoxFaker", "FoxFaker.prg")
?Faker.fakeName() && Jhon Doe
 


Hope you really enjoy it like I do.

Thanks!

Irwin R.

RE: FoxFaker Library

Thanks for contributing this, Irwin. I guess what you call "fake data" is what we used to call "test data"? If so, this sort of thing can save a lot of tedious work.

I have a vague memory of Tamar producing something similar way back when, and writing about it in FoxPro Advisor. I've also created a simple test data generator myself, but I expect it is nothing like as sophisticated as yours.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: FoxFaker Library

(OP)
Hi Mike,

Correct. It's a test data generator and really can save a lot of tedious work.

regards

A team is only pieces that you exchange until you finish the work, it is efficient, it works.

RE: FoxFaker Library

Irwin - Maybe I misunderstood (I haven't looked hard), but my impression is what you've provided is a generator that can give a particular test data item on the fly. It's designed specifically to work in a testing environment like unit testing.

What I wrote years ago was a framework to let you create a test database, which is a whole different thing.

Am I getting it right?

Tamar

RE: FoxFaker Library

(OP)
Hi Tamar,

You're in the right way, FoxFaker generate random test data that can be used on unit testing by filling in your business logic objects:

Consider these examples:

CODE --> vfp

Procedure test_should_save_a_record_in_table_returns_true

   oPerson.FirstName = Faker.fakeName('female')
   oPerson.LastName  = Faker.fakeLastName()
   oPerson.Age       = Faker.fakeNumberBetween(18, 50)
   oPerson.Email     = Faker.fakeEmail()

   This.AssertTrue(oPerson.Save(), "something went wrong")
   
*================================================= 

Off course it can be used in different way like filling forms in presentation layer:

CODE --> vfp

Procedure btnFillData.Click
   With Thisform
      .txtFirstName.Value = Faker.fakeName('female')
      .txtLastName.Value  = Faker.fakeLastName()
      .txtAge.Value       = Faker.fakeNumberBetween(18, 50)
      .txtEmail.Value     = Faker.fakeEmail()
   EndWith
EndProc 

Or populating records in a table:

CODE --> vfp

Select People
For i=1 To 50 Step 1
   Append Blank
   Replace FirstName With Faker.fakeName('female')
   Replace LastName  With Faker.fakeLastName()
   Replace Age       With Faker.fakeNumberBetween(18, 50)
   Replace Email     With Faker.fakeEmail()
EndFor
Browse 




A team is only pieces that you exchange until you finish the work, it is efficient, it works.

RE: FoxFaker Library

Right, so it's for on-the-fly test data generation, not like the tool that I built, which is for creating a test data set that you might, for example, distribute with an application. Whole different purpose and very handy.

Tamar

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close