The CMS Collaboration is preparing to replace its endcap calorimeters for the HL-LHC era with a high-granularity calorimeter (HGCAL). The HGCAL will have fine segmentation in both the transverse and longitudinal directions, and will be the first such calorimeter specifically optimized for particle-flow reconstruction to operate at a colliding-beam experiment. The proposed design uses silicon sensors as active material in the regions of highest radiation and plastic scintillator tiles equipped with on-tile silicon photomultipliers (SiPMs), in the less-challenging regions. The unprecedented transverse and longitudinal segmentation facilitates particle identification, particle-flow reconstruction and pileup rejection. We will overview some of the novel reconstruction methods being explored. As part of the ongoing development and testing phase of the HGCAL, prototypes of both the silicon and scintillator-based calorimeter sections have been tested in 2018 in beams at CERN. We report on the performance of the prototype detectors in terms of stability of noise and pedestals, MIP calibration, longitudinal/lateral shower shapes, precision timing, as well as energy linearity and resolution for electrons and pions. We compare the measurements with a detailed GEANT4 simulation. We also report on beam tests of the scintillator-based section at DESY in 2020 and 2021.