testing timing issues of my API

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RiFa
Level 1
Level 1
First reply posted First question asked Welcome!

Hello,

I know that the API I'm testing with Cypress has a problem when two calls are sent that are too close (in time) to each other.

I would like to write a flow in Cypress where  the same call can be made within X milliseconds and the two results are shown.

I would like to play with interval X to see when the API breaks and whether our fix works.

Could someone let me know if there is a way to do this?

Thanks,

R

0 Likes
1 Solution
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi @RiFa 

 

The simplest way to achieve this would be with the help of a delay. This would make it a blocking operation and in case you need it to be non-blocking, you can use a timer as well. But in both the cases, only one function would be active at a time. 

 

Best regards, 
Hari

View solution in original post

0 Likes
5 Replies
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I think we could do something like

 uint32_t delay_ms = 1 ; // change this value for testing...
 
  my_api() ;
  CyDelay(delay_ms) ;
  my_api() ;

But meantime, I suppose that most of APIs should have a way to check if the process of that API is done.

By any chance, can you provide the name of the API you'd like to test?

moto

0 Likes

Hi @MotooTanaka , thank you for your input. Is there a way to monitor, get back, when each call is actually sent out?

Sorry, this is our proprietary API in a microservice-based application.

Cheers,

RiFa

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi @RiFa

 

Can you provide some details about the API that you are testing? Is it an interrupt driven function which returns before it completes? Or is the application using an OS like FreeRTOS?

 

Best regards, 
Hari

0 Likes
RiFa
Level 1
Level 1
First reply posted First question asked Welcome!

Hello @Hari ,

thank you for looking into this. To be honest, I'm the PO and I don't have this type of information (other than I call a REST API and get back something).

Generally speaking, I just would like to know how to send out two API calls from Cypress spaced by X ms (X being my (reasonable) choice) and how to verify at what time each call was sent out.

Is that possible?

Thank you in advance,

RiFa   

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi @RiFa 

 

The simplest way to achieve this would be with the help of a delay. This would make it a blocking operation and in case you need it to be non-blocking, you can use a timer as well. But in both the cases, only one function would be active at a time. 

 

Best regards, 
Hari

0 Likes