Angular Protractor e2e Testing

前端 未结 4 1694
半阙折子戏
半阙折子戏 2021-01-02 01:42

I am writing an end-to-end test using Protractor for my Angular application. I can mock httpBackend for unit test but I want to actually call the server and get the JSON re

4条回答
  •  遥遥无期
    2021-01-02 01:54

    Protractor should be used for end-to-end testing of your full stack.

    In this scenario the test typically exercises the angular application (filling form, pressing buttons) which will trigger the angular application to call to the REST server, which returns data, which your Angular application transforms in DOM changes, which then your end-to-end test asserts on.

    This means that you probably want to start your application server (which hosts the angular application and is the REST backend, I suppose) before starting Protractor

    How to do that is out of scope for Protractor.

    The difficulty in this is typically how to setup your database, so that the e2e test knows what to expect as returns to your JSON services.

提交回复
热议问题