ANGULARJS: The development and test environment of building Phonecat project

Source: Internet
Author: User
Tags install node

Angularjs's official website provides a sample project for learning: Phonecat. This is a web app where users can browse some Android phones, learn more about them, and perform search and sort operations.

For the development environment of the PHONECAT project and the construction of the test environment, detailed guidance is provided on the official website: http://docs.angularjs.org/tutorial.

Get Source code

The source code for the Phonecat project is hosted on GitHub, so git (http://git-scm.com/download) needs to be installed before you can get it. After you install git, you can download the source code from git clone:

--depth= + https://github.com/angular/angular-phonecat.git     

The –DEPTH=14 option means that only the last 14 code submissions are downloaded, which reduces the size of the downloaded file and speeds up the download.

Install dependent packages

Phonecat is a Web application, so it's best to run it in a Web server for best results. It is officially recommended to install node. JS (http://nodejs.org/download/).

The run and test of the Phonecat project relies on a number of other tools that can be installed with the NPM command after installing node. js. The following commands need to be run under the Angular-phonecat project path:

NPM Install

After you run the command, the following dependency packages are installed under the ANGULAR-PHONECAT project path:

    • Bower. Package Manager
    • http-server. Lightweight Web server
    • Karma. For running Unit tests
    • protractor. For running end-to-end testing
Run the Phonecat project

After doing this, running the PHONECAT project is simple, run the following command under the ANGULAR-PHONECAT project path:

NPM start

Once Phonecat is running, you can open http://localhost:8000/app/index.html in your browser to access the Web App.

Run unit tests

Unit tests in the PHONECAT project are done using Karma, and all unit test cases are stored in the Test/unit directory. You can run unit tests by executing the following command:

NPM Test

It's worth mentioning that Google Chrome must be installed on your computer before you run your unit tests.

run end-to-end testing

The PHONECAT project uses end-to-end testing to ensure the operability of Web applications, and this end-to-end testing is done by using protractor, where all end-to-end test cases are stored in the TEST/E2E directory. You can run an end-to-end test by performing the following steps:

Update Webdriver, this command only runs once NPM run update-webdriver//Run Phonecatnpm start    

Open another command-line window in which to run:

NPM Run Protractor

ANGULARJS: The development and test environment of building Phonecat project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.