Open chainhead opened 3 years ago
@chainhead Love your ideas above!
To understand it better:
Generate Unit tests: I would like to understand more about how you currently write unit test cases. What kind of unit tests you generally write. Would you be up for a short discussion on this.
Runner is not native to a programming lang: Would love for you to checkout our open source CLI companion called newman. You can use newman to run your collections in the CLI and integrate it with CI/CD Pipelines too.
Tests should become part of CI/CD: You can currently export your collection json and run your tests in your CI/CD pipelines. You can alternatively also use newman command to run your collection using the public postman API to get your collection on the go. This will fetch the latest collection and run your tests during your CI/CD build. Read more here
Please let me if you have tried out the above and if you have any feedback on the above.
@malvikach limiting our discussion to NodeJs, the idea is to generate test cases in say, facebook/jest
from the collection created in Postman. See here for an example of testing API end-points with facebook/jest
. From the same link, for a given Collection, Postman should generate a test similar to the one below.
/* eslint-env jest */
const github = require('../github')
// A simple example test
describe('#getUser() using Promises', () => {
it('should load user data', () => {
return github.getUser('vnglst')
.then(data => {
expect(data).toBeDefined()
expect(data.entity.name).toEqual('Koen van Gilst')
})
})
})
I haven't used newman
; however, the idea is to keep the testing part "native" to a programming language a developer is familiar with.
While I don't mind a discussion, in the spirit of open source, perhaps, we should continue over GitHub.
Is your feature request related to a problem? Please describe. No.
Describe the solution you'd like Once I have finalized my requests in a collection, I would like to see an option to generate unit tests out of the requests. For example, in NodeJs, these will probably be
chai
,mocha
, etc. based test cases that I can launch with anpm test
. These tests are either downloaded locally or posted to version control system such as GitHub etc.Describe alternatives you've considered The Runner option is helpful; but, it is not native to the programming language used by a developer. Further, the tests should become a part of the larger CI/CD pipeline that the developer maybe using. Hence, this request.
Additional context None.