This is a simple stripped-down Ruby on Rails project that utilizes the Faker gem to generate non-sensitive, non-PII test data.
Note: The current implementation will output 50 hashes of test data in the following requested format:
[ {
"client_first_name": "Sandy",
"client_last_name": "Cohen",
"service_description": "routine teeth cleaning",
"service_date": "2019-03-04",
"service_performed_by": "Sam Oakland",
"service_amount_paid": 110.40,
"service_amount_currency": "USD",
}, ...]
Running Container: The test data generator has been containerized. You will need to have docker installed where you want to run this application. Install Docker
Running Locally: If you prefer to run the test data generator locally, you will have to have Ruby installed on your machine. This method is not recommended as the application is Dockerized.
The current test data can be output to stdout or to a file in the root directory of the repository (/test-data-generator
). The file name is test.data
.
Task to output to stdout: rake generate:test_data_default
Task to output to file: rake generate:test_data_to_file
Note: Each time the task test_data_to_file
is run to generate test data to a file, the previous file will be overwritten.
- Download the code repository
- Go into the repository folder:
cd ~/test-data-generator
- Install gems:
bundle install
- Run Rails server:
rails server
- Run Generate Task:
rake generate:test_data_to_file
- Download the code repository
- Go into the repository folder:
cd ~/test-data-generator
- Bring the container up:
docker-compose up -d
- Ensure container is running:
docker ps
- Run Generate Task:
docker exec -it test-data-generator rake generate:test_data_to_file
Noted below are the core files that are used for the test data generator.
Test Data Generator Logic: test-data-generator/app/controllers/test_data_generator_controller.rb
Task Logic: test-data-generator/lib/tasks/generator.rake