on 2024 Nov 20 12:55 AM
Hello SAP Community,
I'm working on a CAP project in SAP Business Application Studio (BAS) where I need to run automated tests (cds.test()) involving connections to on-premise environments using Jest.
Specifically, I want to:
Here's an example of a test where I attempt a POST request to an OData service connected to ECC and validate the error response:
it('POST ECC', async () => {
try {
// where the connection to ECC is made
const { status } = await POST('/odata/v4/<Service>/<EntitySet>',
{
CNPJ: '1234',
Pedido: '1234'
},
{
headers: {
'Authorization': authHeader
}
});
expect(status).toEqual(201); //code 400 Failed to destination
});
Has anyone successfully configured and run such a setup? Any guidance, best practices, or examples would be greatly appreciated!
Thanks in advance for your help! 😊
Request clarification before answering.
I would create a separate testing profile that has the necessary connection information and then use cds.test with a profile reference. Any reason that would not work for you?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.