Uber Inc. struck a deal with Chinese automaker BYD Co. to test a fleet of electric cars for its drivers.