-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add test cases and implement the mock server #8
Conversation
Lets rename |
Shall we move the types generated for mock-service into the |
Co-authored-by: Ayesh Almeida <[email protected]>
Co-authored-by: Ayesh Almeida <[email protected]>
Co-authored-by: Ayesh Almeida <[email protected]>
…nerated type into it
@ayeshLK changes done!!! |
Co-authored-by: Ayesh Almeida <[email protected]>
Co-authored-by: Ayesh Almeida <[email protected]>
Co-authored-by: Nipuna Ransinghe <[email protected]>
Co-authored-by: Nipuna Ransinghe <[email protected]>
Co-authored-by: Nipuna Ransinghe <[email protected]>
ballerina/tests/test.bal
Outdated
} | ||
|
||
@test:Config { | ||
dataProvider: dataGen, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason to use a data provider for this test suite (as test data in L45 seems to be empty)? If not, better to completely remove the data provider related implementations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A data provider is used to share a common object within isolated functions. This allows for chaining test cases, where the same file ID, job ID, and model ID can be shared.
For example, after creating a file using testCreateFile, the ID is updated in the shared object and can be used after that.
Since initially the IDs are not there, those are empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NipunaRanasinghe I found that approach to be effective here, but if there is a better method, I would greatly appreciate knowing about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KATTA-00
The purpose of data providers is to allow executing the same test case with different data sets.
From what I understand, you need to make sure the order of execution of these test cases, so it's advisable to use the dependsOn
option to guarantee the order.
If there is a dependency among the test cases, you can omit the isolated keyword for test functions. The isolated
keyword is explicitly required if you want to allow these test cases to run parallel even though it accesses a global variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dilhasha Ack. The order is configured using the dependson
option and the tests are passing fine.
@NipunaRanasinghe What's your opinion? Shall we go with this way or remove isolated
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we get rid of the data provider too?
You can mark the global variable as isolated
and access it within lock
statements to avoid parallel modification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KATTA-00 as per the offline discussion we had lets remove the isolated
qualifier and the data provider implementation from the tests
Co-authored-by: Nipuna Ransinghe <[email protected]>
Co-authored-by: Nipuna Ransinghe <[email protected]>
Co-authored-by: Nipuna Ransinghe <[email protected]>
Co-authored-by: Nipuna Ransinghe <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Purpose