testingmockingautomated-teststestcafeautomocking

In TestCafe Is possibile to register xhr and use as mocking (automocking)


I'm using testCafe for my functional test.

My project used a lot of XHR request and I don't want to waste my time to generate each single mock.

Exists an automocker like this: https://github.com/scottschafer/cypressautomocker for testcafe?


Solution

  • TestCafe does not provide the described functionality out of the box. However, you can use the combination of RequestLogger and RequestMock

    The idea is in that you can create a JSON file with request results at the first run using the RequestLogger. Then, based on results of the first run, you can configure your RequestMock object to respond with the results from the file for all consequent requests.