The "but-for" test is a common legal and factual causation test used to determine whether the defendant's conduct caused the plaintiff's harm. It asks whether, but for the defendant's conduct, the plaintiff's harm would have occurred.
In other words, it is a test that asks whether the plaintiff's harm would have occurred anyway, regardless of the defendant's actions. If the answer is yes, then the defendant's conduct is not the cause of the plaintiff's harm, and the defendant is not liable. If the answer is no, then the defendant's conduct is the cause of the plaintiff's harm, and the defendant may be liable for damages.
The but-for test is used in many areas of law, including tort law (such as negligence claims), criminal law, and contract law. It is important to note that the but-for test is not always the only test used in determining causation, and in some cases, other tests may be used in addition to or instead of the but-for test.