» gRPC快速入门:Node.js » 6. 测试 » 6.1 运行测试

运行测试

grpc-node/examples 目录中执行如下命令:

安装所需依赖:

npm install

运行 server:

node ./routeguide/dynamic_codegen/route_guide_server.js --db_path=./routeguide/dynamic_codegen/route_guide_db.json

在另一个终端中,运行 client:

node ./routeguide/dynamic_codegen/route_guide_client.js --db_path=./routeguide/dynamic_codegen/route_guide_db.json

你将看到大致如下输出:

Found feature called "Berkshire Valley Management Area Trail, Jefferson, NJ, USA" at 40.9146138, -74.6188906
Found no feature at 0, 0
Looking for features between 40, -75 and 42, -73
Found feature called "Patriots Path, Mendham, NJ 07945, USA" at 40.7838351, -74.6143763
Found feature called "101 New Jersey 10, Whippany, NJ 07981, USA" at 40.8122808, -74.3999179
Found feature called "U.S. 6, Shohola, PA 18458, USA" at 41.3628156, -74.9015468
Found feature called "5 Conners Road, Kingston, NY 12401, USA" at 41.9999544, -74.0371136
Found feature called "Mid Hudson Psychiatric Center, New Hampton, NY 10958, USA" at 41.4008389, -74.3951297
Found feature called "287 Flugertown Road, Livingston Manor, NY 12758, USA" at 41.9611318, -74.6524769
Found feature called "4001 Tremley Point Road, Linden, NJ 07036, USA" at 40.6109563, -74.2186778
Found feature called "352 South Mountain Road, Wallkill, NY 12589, USA" at 41.6802456, -74.2370183
Found feature called "Bailey Turn Road, Harriman, NY 10926, USA" at 41.2950425, -74.1077389
Found feature called "193-199 Wawayanda Road, Hewitt, NJ 07421, USA" at 41.2144655, -74.3949739
Found feature called "406-496 Ward Avenue, Pine Bush, NY 12566, USA" at 41.5736605, -74.2847522
Found feature called "162 Merrill Road, Highland Mills, NY 10930, USA" at 41.384393, -74.0501726
Found feature called "Clinton Road, West Milford, NJ 07480, USA" at 41.0873075, -74.4459023
Found feature called "16 Old Brook Lane, Warwick, NY 10990, USA" at 41.2346009, -74.4026814
Found feature called "3 Drake Lane, Pennington, NJ 08534, USA" at 40.2948455, -74.7903913
Found feature called "6324 8th Avenue, Brooklyn, NY 11220, USA" at 40.6337092, -74.0122226
Found feature called "1 Merck Access Road, Whitehouse Station, NJ 08889, USA" at 40.6421967, -74.7727624
Found feature called "78-98 Schalck Road, Narrowsburg, NY 12764, USA" at 41.6318082, -74.9677716
Found feature called "282 Lakeview Drive Road, Highland Lake, NY 12743, USA" at 41.530172, -74.8416257
Found feature called "330 Evelyn Avenue, Hamilton Township, NJ 08619, USA" at 40.2647019, -74.7071791
Found feature called "New York State Reference Route 987E, Southfields, NY 10975, USA" at 41.2567807, -74.1058078
Found feature called "103-271 Tempaloni Road, Ellenville, NY 12428, USA" at 41.6855156, -74.4420597
Found feature called "1300 Airport Road, North Brunswick Township, NJ 08902, USA" at 40.4663628, -74.4820157
Found feature called "211-225 Plains Road, Augusta, NJ 07822, USA" at 41.1633782, -74.678497
Found feature called "165 Pedersen Ridge Road, Milford, PA 18337, USA" at 41.3447164, -74.8712898
Found feature called "100-122 Locktown Road, Frenchtown, NJ 08825, USA" at 40.5047245, -74.9800722
Found feature called "650-652 Willi Hill Road, Swan Lake, NY 12783, USA" at 41.7951888, -74.8484944
Found feature called "26 East 3rd Street, New Providence, NJ 07974, USA" at 40.7033786, -74.3977337
Found feature called "611 Lawrence Avenue, Westfield, NJ 07090, USA" at 40.658979, -74.3560121
Found feature called "18 Lannis Avenue, New Windsor, NY 12553, USA" at 41.4653148, -74.0477477
Found feature called "82-104 Amherst Avenue, Colonia, NJ 07067, USA" at 40.5957808, -74.3255336
Found feature called "170 Seven Lakes Drive, Sloatsburg, NY 10974, USA" at 41.1733589, -74.1648093
Found feature called "1270 Lakes Road, Monroe, NY 10950, USA" at 41.2676291, -74.2606606
Found feature called "509-535 Alphano Road, Great Meadows, NJ 07838, USA" at 40.9224445, -74.8286738
Found feature called "652 Garden Street, Elizabeth, NJ 07202, USA" at 40.652342, -74.2135517
Found feature called "349 Sea Spray Court, Neptune City, NJ 07753, USA" at 40.1827388, -74.0294537
Found feature called "13-17 Stanley Street, West Milford, NJ 07480, USA" at 41.0564152, -74.3685054
Found feature called "47 Industrial Avenue, Teterboro, NJ 07608, USA" at 40.8472324, -74.0726046
Found feature called "5 White Oak Lane, Stony Point, NY 10980, USA" at 41.2452168, -74.0214052
Found feature called "Berkshire Valley Management Area Trail, Jefferson, NJ, USA" at 40.9146138, -74.6188906
Found feature called "1007 Jersey Avenue, New Brunswick, NJ 08901, USA" at 40.470138, -74.4781745
Found feature called "6 East Emerald Isle Drive, Lake Hopatcong, NJ 07849, USA" at 40.9642566, -74.6017679
Found feature called "1358-1474 New Jersey 57, Port Murray, NJ 07865, USA" at 40.8031728, -74.8645385
Found feature called "367 Prospect Road, Chester, NY 10918, USA" at 41.3700272, -74.2135189
Found feature called "10 Simon Lake Drive, Atlantic Highlands, NJ 07716, USA" at 40.4310607, -74.0282632
Found feature called "11 Ward Street, Mount Arlington, NJ 07856, USA" at 40.93198, -74.6201391
Found feature called "300-398 Jefferson Avenue, Elizabeth, NJ 07201, USA" at 40.6685311, -74.2108603
Found feature called "43 Dreher Road, Roscoe, NY 12776, USA" at 41.9018117, -74.9142781
Found feature called "Swan Street, Pine Island, NY 10969, USA" at 41.2856162, -74.5148837
Found feature called "66 Pleasantview Avenue, Monticello, NY 12701, USA" at 41.6560744, -74.6721964
Found feature called "565 Winding Hills Road, Montgomery, NY 12549, USA" at 41.5534177, -74.2900616
Found feature called "231 Rocky Run Road, Glen Gardner, NJ 08826, USA" at 40.689853, -74.912708
Found feature called "100 Mount Pleasant Avenue, Newark, NJ 07104, USA" at 40.758688, -74.1670168
Found feature called "517-521 Huntington Drive, Manchester Township, NJ 08759, USA" at 40.0106455, -74.287019
Found feature called "40 Mountain Road, Napanoch, NY 12458, USA" at 41.880388, -74.4102673
Found feature called "48 North Road, Forestburgh, NY 12777, USA" at 41.5464475, -74.7175374
Found feature called "9 Thompson Avenue, Leonardo, NJ 07737, USA" at 40.4226644, -74.0517141
Found feature called "213 Bush Road, Stone Ridge, NY 12484, USA" at 41.8811433, -74.1718005
Found feature called "1-17 Bergen Court, New Brunswick, NJ 08901, USA" at 40.4839914, -74.4759616
Found feature called "35 Oakland Valley Road, Cuddebackville, NY 12729, USA" at 41.4638017, -74.5957854
Found feature called "42-102 Main Street, Belford, NJ 07718, USA" at 40.4318328, -74.0835638
Found feature called "3387 Richmond Terrace, Staten Island, NY 10303, USA" at 40.6411633, -74.1722051
Found feature called "261 Van Sickle Road, Goshen, NY 10924, USA" at 41.3069058, -74.4597778
Found feature called "3 Hasta Way, Newton, NJ 07860, USA" at 41.0248224, -74.7127767
Visiting point 40.9224445, -74.8286738
Visiting point 40.6109563, -74.2186778
Visiting point 40.2647019, -74.7071791
Visiting point 40.2948455, -74.7903913
Visiting point 40.4310607, -74.0282632
Visiting point 41.2144655, -74.3949739
Visiting point 40.0066188, -74.6793294
Visiting point 41.3628156, -74.9015468
Visiting point 40.6411633, -74.1722051
Visiting point 40.689853, -74.912708
Finished trip with 10 points
Passed 9 features
Travelled 737011 meters
It took 8 seconds
Sending message "First message" at 0, 0
Sending message "Second message" at 0, 1
Sending message "Third message" at 1, 0
Sending message "Fourth message" at 0, 0
Got message "First message" at 0, 0

持续前进。持续学习。