[Question]: Best practice for Testing BC API's using the build process #1584
Replies: 7 comments
-
Im currently on Vacation so forgive my briefness. But the best way would probably be to create a new user before running the test. But you would also need to create the user in the database which is probably not easy from within the test. |
Beta Was this translation helpful? Give feedback.
-
Thanks, did think of that, but was wondering if I had missed something and maybe there was a more elegant solution 😀 |
Beta Was this translation helpful? Give feedback.
-
My thoughts on this was to be able to check-in a postman or like collection to an AL-Go repo - and then we should run this collection against the BC container for testing. But... - let me know a little about how you were thinking about running API tests - and also @jonaswre - how are you running API tests? |
Beta Was this translation helpful? Give feedback.
-
@freddydk we are running API test from within Test Codeunits that actually test e2e the API. A typical test would be generate some demo data json. Post it against an endpoint an check if that did create all the entites you expected. |
Beta Was this translation helpful? Give feedback.
-
Got it - so you are writing code to connect to "yourself" using httpClient ? |
Beta Was this translation helpful? Give feedback.
-
as you @freddydk mentioned postman: we kick'd off a small PoC a little while ago to make use of NewMan to process data from Postman. that worked kind of ok :) and allows you to bypass some postman API call limitations. |
Beta Was this translation helpful? Give feedback.
-
@KristofKlein I recently had this come up again. So I've created a little Codeunit to wrap some useful methods.
There is some stuff that you might not need but this might point you into the right direction. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Question
We're using more and more Unit Tests, but with regards to how it works with testing APIs (built into BC, either standard or our own custom APIs) in the AL-Go build process I'm a bit stuck.
Given we need to authenticate against BC to access a page - how can we do that - is there something I am missing?
Just looking for a bit guidance
Beta Was this translation helpful? Give feedback.
All reactions