May 09, 2021 Ember.js Reference documents
Original English: Https://guides.emberjs.com/v2.7.0/testing/
The test is
Ember。js
part of the js framework development process.
Now suppose you're using the Ember framework to develop a blog system
user
post
with login and blog creation.
Finally, suppose you want to automate testing in your program.
You'll need the following three types of tests:
Acceptance testing is a test that ensures that the program process is correct and that the various interaction characteristics are in line with user expectations.
Acceptance testing is used to confirm the basic functions of the project, to ensure that the core functions of the project are not degraded, and to ensure that the objectives of the project are achieved. The way you test your app is consistent with how users interact with it (e.g., filling out a form, clicking a button).
In the above scenario, the following acceptance tests may be performed:
Unit tests are tests that are performed on the smallest testable unit in a program, such as a class or a method. The test can write statements relative to the program logic to test the relevant units
Here are some concrete examples of unit tests:
Integration testing is a test that is between unit testing and acceptance testing. The purpose of integrated testing is to verify that the client interacts with the system as a whole, that all unit tests, and the algorithmic logic of specific code at the micro level can pass.
Integration testing is used to verify the relationship between the various modules of an application, such as the behavior of several UI controls. I t can also be used to confirm that data and actions are correctly passed and executed in different parts of the system, while providing the conditions under which the various components of the system operate in conjunction under a given assumption.
We recommend that each component be tested for integration because each component of the component runs in the same way in the context of the system, and there is an impact between the components, including rendering the component from the template and receiving component lifecycle callback functions.
An example of integration testing is as follows:
QUnit is the default test framework for this manual, but Ember .js also supports testing frameworks from other third parties.
Enter the
ember test
to run the test.
You can also re-run the test after each file change with the
ember test -server
command.
When you develop a project locally, you
/tests/index.html
by accessing
ember server
provided that you run your project using the command ember server.
If you are using this way there is one thing to note:
ember server
are tests in a development environment and call parameters in a development environment
ember test --server
are tests in a test environment that invokes parameters in the test environment, such as loading dependencies.
Therefore, we recommend that
ebmer test --server
to run the test.
Use
--filter
to specify how to run some tests. F
or example: quickly run the current work of the test using the
ember test --filter="dashboard"
run the specified type
ember test --filter="integration"
you can
!
to exclude acceptance test
ember test --filter="!acceptance"