The possibility of electric vehicles to technically replace internal combustion engine vehicles and to deliver economic benefits mainly depends on the battery and the charging infrastructure as well as on annual mileage (utilizing the lower variable costs of electric vehicles). Current studies on electric vehicles’ total cost of ownership often neglect two important factors that influence the investment decision and operational costs: firstly, the trade-off between battery and charging capacity; secondly the uncertainty in energy consumption. This paper proposes a two-stage stochastic program that minimizes the total cost of ownership of a commercial electric vehicle under uncertain energy consumption and available charging times induced by mobility patterns and outside temperature. The optimization program is solved by sample average approximation based on mobility and temperature scenarios. A hidden Markov model is introduced to predict mobility demand scenarios. Three scenario reduction heuristics are applied to reduce computational effort while keeping a high-quality approximation. The proposed framework is tested in a case study of the home nursing service. ... mehrThe results show the large influence of the uncertain mobility patterns on the optimal solution. In the case study, the total cost of ownership can be reduced by up to 3.9% by including the trade-off between battery and charging capacity. The introduction of variable energy prices can lower energy costs by 31.6% but does not influence the investment decision in this case study. Overall, this study provides valuable insights for real applications to determine the techno-economic optimal electric vehicle and charging infrastructure configuration.