B & V Limited and B & V Phase I Limited (collectively “B & V”) appeal an order granting the motion of All Dade General Construction, Inc. (“All Dade”), to dismiss B & Vs complaint on res judicata grounds. We reverse.
B & V and All Dade entered into several contracts for roof repairs or replacements on a number of different structures. Each contract involves a different building with separate and distinct work specifications. The repair work for each building was memorialized in an individual All Dade contract, specifying the building’s address, the work required, and the contract price.
In 1993, All Dade sued B & V to recover damages for breach of contract and for failure to pay for services rendered under the contracts on the following buildings:
110 N.E. 10th Street, Homestead, Florida
929 N.W. 2nd Avenue, Homestead, Florida
930-938 N.W. 1st Avenue, Homestead, Florida
155 N.W. 10th Street, Homestead, Florida
1223 N.E. 1st Avenue, Homestead, Florida
960 N.E. 1st Avenue, Homestead, Florida
55-67 N.E. 9th Court, Homestead, Florida
154-162 N.W. 7th Street, Homestead, Florida
B & V answered the complaint and asserted as an affirmative defense that the work was improperly performed and unsatisfactory. The suit ended with the court’s entry of a Stipulated Final Judgment pursuant to settlement.
In 1995, B & V sued All Dade to recover damages for work not completed satisfactorily as required by contracts for the following buddings:
460-480 N.W. 6th Street, Homestead, Florida
521 N.W. 5th Avenue, Homestead, Florida
186-194 N.W. 2nd Street, Homestead, Florida
925 N. Krome Avenue, Homestead, Florida
30100 Old Dixie Highway, Homestead, Florida
150-170 N.W. 10th Street, Homestead, Florida
41 N.E. 3rd Road, Homestead, Florida
107 N.W. 4th Street, Homestead, Florida
125 N.W. 4th Street, Homestead, Florida
114 N.W. 5th Street, Homestead, Florida
All Dade filed a motion to dismiss asserting that res judicata barred the suit. The court *415granted the motion, dismissing the complaint with prejudice.
We reverse the order dismissing B & Ys complaint, and hold that this action is not barred by the doctrine of res judicata.1 In Albrecht v. State, 444 So.2d 8 (Fla.1984), the Florida Supreme Court explained:
several conditions must occur simultaneously if a matter is to be made res judicata: identity of the thing sued for; identity of the cause of action; identity of parties; identity of the quality in the person for or against whom the claim is made. It is also a settled rule that when the second suit is between the same parties, but based upon a different cause of action from the first, the prior judgment will not serve as an estoppel except as to those issues actually litigated and determined in it.
Albrecht, 444 So.2d at 12 (citations omitted). The test for determining whether a second suit between the parties is based on the same cause of action “is whether the facts or evidence necessary to maintain the suit are the same in both actions.” Albrecht, 444 So.2d at 12. It is inconceivable that B & Ys suit for breach of ten distinct contracts will require proof identical to All Dade’s prior suit based on eight other contracts. Each contract memorialized an agreement as to a particular building, the distinct work that had to be performed, and contained different price quotes. These lawsuits do not litigate one all-encompassing contract for repairs on all the buildings. Although, as All Dade suggests, the contracts may have been the result of contemporaneous negotiations, the parties chose to memorialize each building’s work requirement with a separate contract. Moreover, an action for poor workmanship requires a different showing for each building: To argue that improper work was performed on building X requires a showing of what work was required on building X, and what was and what was not done on that building. Such a lawsuit could not be won using evidence of work on building Y and the requirements under the building Y contract. See Super Serv. Prod. Corp. v. North Store Corp., 214 So.2d 664 (Fla. 3d DCA 1968). If All Dade’s assertion is carried to its logical conclusion, once All Dade received a judgment in the first action for monies owed on those eight contracts, it would be barred from bringing a later action to recover any future monies owed it by B & V on the other contract. This would not be a correct application of res judicata.
Alternatively, All Dade argues that res judicata bars B & Ys lawsuit because the claims should have been raised as compulsory counterclaims to All Dade’s suit. A compulsory counterclaim is “any claim which at the time of serving the pleading the pleader has against any opposing party, provided it arises out of the same transaction or occurrence that is the subject matter of the opposing party’s claim_” Fla.R.Civ.P. 1.170(a). The logical relationship test is applied to determine whether a compulsory counterclaim exists. Londono v. Turkey Creek, Inc., 609 So.2d 14, 20 (Fla.1992), (citing Neil v. South Fla. Auto Painters, Inc., 397 So.2d 1160 (Fla. 3d DCA 1981)). In the present case, the logical relationship test is not met because this is not a case where “the same aggregate of operative facts serves as the basis of both claims_” Neil, 397 So.2d at 1164. Aside from the common fact that the same parties negotiated for, and entered into, a number of contracts, the individual contracts themselves stand alone as the basis for the causes of action. The pleadings do not demonstrate that all of the contracts constitute the same transaction. The record reveals that the parties’ communications continually referred to the properties individually and specifically. Thus, we cannot conclude that there is a logical relationship between all the claims sufficient to implicate the compulsory counterclaim rule.
*416We are not unmindful that “the goal of the compulsory counterclaim rule is ‘to prevent multiplicity of actions and to achieve a just resolution in a single lawsuit of all disputes arising out of common matters.’ ” Neil, 397 So.2d at 1164. However, in this ease, the record reveals that the parties chose to memorialize each transaction with a separate contract. Accordingly, we may not conclude that the claims raised in B & Vs lawsuit were compulsory counterclaims to All Dade’s prior action, and as such, are barred by res judicata.
Based on the foregoing reasoning, we hold that the court erred in dismissing B & Vs complaint with prejudice on res judicata grounds. We therefore reverse the dismissal order, and remand with instructions to reinstate B & Vs complaint.
Reversed and remanded.
. As a threshold matter, we agree with B & V's assertion that the defense of res judicata is not properly raised by motion to dismiss, Warwick v. Post, 613 So.2d 563 (Fla. 5th DCA 1993), but rather, should be raised in an answer. Palmer v. McCallion, 645 So.2d 131 (Fla. 4th DCA 1994), Brock v. Associates Fin., Inc., 625 So.2d 135 (Fla. 1st DCA 1993). Additionally, the motion could not be properly granted in this case as the defense is not established on the face of the complaint. Strachan Shipping Co. v. Spigner, 573 So.2d 926 (Fla. 1st DCA), review denied, 583 So.2d 1034 (Fla.1991).