Skip to content
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

Integration tests #13

Open
gregorwolf opened this issue Mar 12, 2019 · 12 comments
Open

Integration tests #13

gregorwolf opened this issue Mar 12, 2019 · 12 comments
Labels
question Further information is requested

Comments

@gregorwolf
Copy link
Contributor

Hello @balbinosoares @NabheetCloud @mattiastrr @lechnerc77,

thank you for all your contributions. Great to see them flowing in.

In SITreg I've created integration tests calling the OData API using users with the corresponding role assigned. I would like to follow this approach in CAPM too. What is the standard tool to run API tests in a NodeJS environment? Does SAP already posted some best practice?

In the next step we would also need to setup local authentication + authorizations to be able to test the different user roles.

Best regards
Gregor

@gregorwolf gregorwolf added the question Further information is requested label Mar 12, 2019
@lechnerc77
Copy link
Contributor

Hi Gregor,

I think Supertest (https://www.npmjs.com/package/supertest) might be an option for API tests in node.js

I am not aware of any best practises by SAP in CAPM context.

BR Christian

@balbinosoares
Copy link
Contributor

There is mocha and chai, but I never used... there is a combination of mocha and supertest too...

@lechnerc77
Copy link
Contributor

I use mocha and chai for unit tests, I do not really see a way how to use them for integration tests that Gregor targets. I would say mocha and supertest might be worth a try, although I did not yet use supertest

@balbinosoares
Copy link
Contributor

balbinosoares commented Mar 13, 2019

I also think we can use mocha and supertest

@NabheetCloud
Copy link
Contributor

Mocha and Supertest makes sense. Infact i was checking your existing app you have used Jasmine to test XSC app. Jasmine can also be used with NodeJS apps. I think we shall also check with @qmacro for his recommendations in this area and what SAP recommends.

PS: Mocha/Supertest looks okay.

@gregorwolf
Copy link
Contributor Author

What's about https://jestjs.io/ ?

@chgeo
Copy link

chgeo commented Mar 13, 2019

Jest is what is used by here at SAP to test the Node.js parts of CAPM. Reason not to use Mocha + Chai + Istanbul + Sinon + Supertest is not wanting to manage the dependency issues between all our dev dependencies.

@gregorwolf
Copy link
Contributor Author

Thank you @chgeo for jumping in. Is it feasible to use Jest to call the OData API's locally and in a CI tool? Are there any public examples for that? Or could you contribute them ;-)?

@chgeo
Copy link

chgeo commented Mar 13, 2019

As discussed.. we are working on guidelines.. will publish as soon as they are ready. Stay tuned :)

@gregorwolf
Copy link
Contributor Author

An inspiration for testing can be found in the openSAP HANA7 Course Exercise Materials

@gregorwolf
Copy link
Contributor Author

With #23 we have a first working test case. Feel free to create test cases based on the tests from the old SITreg backend

@gregorwolf
Copy link
Contributor Author

With #46 I've added API tests with Jasmine. Unfortunately the usedrequest library is deprecated. So this must still be migrated to axios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants