If you are called as a witness, you have a duty to appear in court. This means you cannot decide for yourself whether you have the time or feel like testifying. You may be ordered to pay a fixed penalty if you fail to appear at the court hearing. You also risk being picked up by the police and potentially placed in detention until you can be questioned in court.
In certain special circumstances, you are also required to appear even though you do not have a duty to give evidence. For example, you might be a close relative of the defendant in the case. Close relatives normally include family (parents, siblings, or children) or partners (spouses or live-in partners).
In most situations, the court already knows that you are a close relative of the defendant, but if not, you can inform the court when you begin giving your testimony. The judge will then decide whether you are required to continue giving evidence.
As a close relative, you can choose to give evidence although you are not required to do so.
If you have committed a criminal offence, you do not have to give evidence about it unless you have already been convicted. The judge will normally inform you that you are not required to give evidence about your own criminal offences but that you do have to say whatever else you can about the case.