HER2 testing should be conducted at the time of initial cancer diagnosis, particularly for patients with invasive breast cancer or metastatic gastric cancer. It’s essential to determine the HER2 status early to tailor the most effective treatment plan. Repeat testing may be necessary if there is a significant change in the cancer’s behavior or if the initial biopsy was inadequate.