-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Mock Data provider for API Testing #496
Comments
Can I work on this issue??? |
You can mention the below details in this thread:
|
Implementation Details
|
As you are a first time contributor to this project, I recommend you to pick up an open issue first and resolve it to get familiar with the codebase, before working on adding this completely new feature. |
Alright, Thanks for your response. |
First, I’ll identify where user inputs (like email or username) are injected into requests. Then, I’ll create small utility functions to generate random values for common fields (e.g., randomEmail() could combine random strings with @test.com). Next, I’ll update the request-handling logic to detect placeholders like {{$randomEmail}} in API payloads. Using regex or string replacement, I’ll swap these placeholders with the outputs of the corresponding utility functions just before sending the request. I’ll ensure this replacement works for all endpoints, nested JSON structures, and repeated fields. To keep it lightweight, I’ll avoid external libraries and stick to simple, APIDash core functionalities, @ashitaprasad @animator @DenserMeerkat Please provide me feedback for my approach! |
@abhinavs1920 think how you can leverage some concept similar to env variables for this feature. |
I'll use APIDash's current environment variables feature that is very well implemented. I'll add a new section called 'Random Generators' where testers can use special tags like {{$randomEmail}} in their API requests (Or we can use some flag to identify if they are the dummy value placeholders or not). When someone runs the request, the system will automatically replace these tags with fresh random values. First, I'll update the code to check for these {{$...}} tags after handling normal environment variables. Simple functions will generate the random data. The UI will show examples so testers understand how to use {{$randomUsername}} or {{$randomId}} without confusion(extension of feature). This way I can use the existing implementation. |
Random Generators => Fake Data Providers very nice idea. |
@animator Keeping in mind Fake Data Providers |
@abhinavs1920 Yes you can proceed 👍 |
@animator |
Implement Mock Data provider for API Testing
Description
Currently, when testing API endpoints in the API Dash repository, users must manually enter or modify details such as email, username, and other user-specific information. This manual effort can be tedious and error-prone, especially during repeated testing. To streamline this process, we propose implementing a feature that generates random placeholder values for common fields like
email
,username
, etc.Feature Details
Introduce a set of predefined random data variables (e.g.,
{{$randomEmail}}
,{{$randomUsername}}
) that can be used in the API requests. These placeholders will automatically populate with randomized data when the API is called, allowing testers to quickly simulate unique user details without manual input.Benefits
Implementation Suggestions
{{$randomEmail}}
with generated values.This feature will greatly enhance developer productivity and provide a more seamless testing experience in the API Dash environment.
The text was updated successfully, but these errors were encountered: