AngularJS Catcher Tests - Should E2E Tests Have Lights?

There are many questions that ask how to mock HTTP responses in protractor tests. How to do this is not a question, we must do it.

http://en.wikipedia.org/wiki/Test_fixture#Software

I have been a QA engineer for more than 4 years, and most of my automated test experience concerns both low-level (single) tests of controllers, models, etc., as well as high-level (integration) tests for complete systems. In my ruby ​​world experience, we used Capybara for integration tests along with a plan and factorygirl (for different projects) to create false entries in the database. This was our integration test / E 2E.

I just recently switched to the javascript team using AngularJS. In the original embedded test environment (now obsolete) there was a built-in Backend module that seemed suitable for our needs. Protractor is now the standard. Only after the protractor got a pair, did I hear the backlash of using E2E testing instruments. Many reports indicate that E2E testing should test the full stack, so any backend should not be mocked and made available.

If integration tests use devices and why?

+8
angularjs testing integration protractor
source share
4 answers

There is a problem with vocabulary. Testing "e2e" in the Angular world has nothing to do with end-to-end testing. This is only part of the end of the user interface, which means the lack of an e2e test. This is user interface testing.

Gojko Adzic, in the book "spec by example", recommends performing functional tests based on testing based on "under the skin of the application", that is, without a part of the user interface.

To answer your question:

- Should UI tests have a fixture? No, use mocks or stubs

- Perform Backend tests with fasteners? Yes

+2
source share

You ask 2 questions - about e2e tests and integration tests. :)

The e2e test, at least in the Angular world, is testing your complete application, as a real user can interact with it. This includes testing your backend request and response. However, if it works slowly and requires resources, it makes sense to switch to a smaller (or even fake) version of your backend for testing.

The integration test refers to part of your code, and the unit test refers to individual units. In both cases, some or all of the dependencies can be mocked to isolate the tests.

Thus, in all cases it is useful to use tools or mocks.

See my answer here for a more detailed discussion of the use cases, benefits and limitations of Karma and the Transporter.

+1
source share

Yes, we use ngMockE2E to mock the backend, and then expose some helpers to the window object so that we can sow different states of the layout data. We also use sinon to impose a specific time for testing date-sensitive dates, so all new Date () calls return what you want

0
source share

I ran into the same issue here with a personal code project. I am using the MEAN stack and my solution would be:

  • use grunt to run tests.
  • before starting the Node server, use the mongoose tools to configure the Mongodb db test ( https://github.com/powmedia/mongoose-fixtures )
  • start the Node server with the parameter so that it uses test db.

You can do something like this approach if on a different stack, although Grunt is very useful as a regular runner.

0
source share

All Articles