
788 A.2d 465 (2002)
RHODE ISLAND EMPLOYMENT SECURITY ALLIANCE, LOCAL 401, S.E.I.U., AFL-CIO et al.
v.
STATE of Rhode Island, DEPARTMENT OF EMPLOYMENT AND TRAINING et al.
No. 2000-302-Appeal.
Supreme Court of Rhode Island.
January 18, 2002.
*466 Present WILLIAMS, C.J., LEDERBERG, BOURCIER, FLANDERS, and GOLDBERG, JJ.
Marc B. Gursky, Providence, Holly Hendon, for plaintiff.
John LP Breguet, Thomas A. Palombo, Providence, for defendant.

OPINION
PER CURIAM.
Thirteen computer operators employed at the Rhode Island Department of Labor and Training (DLT) and their union, the Rhode Island Employment Security Alliance, Local 401, S.E.I.U., AFL-CIO (collectively, plaintiffs), brought suit in Superior Court seeking declaratory, compensatory and injunctive relief to redress alleged violations of the Merit System Act, G.L. 1956 chapter 4 of title 36. The plaintiffs alleged that they have been placed in lower job classifications and pay grades than other state workers in positions with substantially similar authority, responsibility, character of work, and working conditions. These placements, they alleged, violated § 36-4-9, which requires "that all positions that are substantially similar with respect to authority, responsibility, and character of work are included within the same class and that the same pay schedules can be made to apply with equity under like working *467 conditions." The complaint named DLT[1] and numerous state officials as defendants.
The Superior Court dismissed the complaint, pursuant to Rules 12(b)(1) and (6) of the Superior Court Rules of Civil Procedure, for failure to exhaust administrative remedies under the Merit System Act and because plaintiffs' claims could be brought only as an appeal under the Administrative Procedures Act (APA), G.L. 1956 § 42-35-15. The case came before the Supreme Court for oral argument on December 3, 2001, pursuant to an order directing the parties to show cause why the issues raised in this appeal should not be decided summarily.
"[T]he sole function of a motion to dismiss is to test the sufficiency of the complaint." Rhode Island Affiliate, ACLU v. Bernasconi, 557 A.2d 1232, 1232 (R.I.1989) (citing Ryan v. State Department of Transportation, 420 A.2d 841, 842 (R.I.1980) and Dutson v. Nationwide Mutual Insurance Co., 119 R.I. 801, 803-04, 383 A.2d 597, 599 (1978)). "In reviewing a trial justice's grant of a motion to dismiss pursuant to Rule 12(b)(6), this Court assumes the allegations contained in the complaint to be true and views the facts in the light most favorable to the plaintiffs." St. James Condominium Association v. Lokey, 676 A.2d 1343, 1346 (R.I.1996) (citing Builders Specialty Co. v. Goulet, 639 A.2d 59, 60 (R.I.1994) and Ellis v. Rhode Island Public Transit Authority, 586 A.2d 1055, 1057 (R.I.1991)). "This Court has cautioned that such a motion should not be granted `unless it appears to a certainty that [the plaintiffs] will not be entitled to relief under any set of facts which might be proved in support of [their] claim.'" Id. (quoting Bragg v. Warwick Shoppers World, Inc., 102 R.I. 8, 12, 227 A.2d 582, 584 (1967)); see also Ward v. Pawtucket Police Department, 639 A.2d 1379, 1381 (R.I.1994).
It is well settled that a plaintiff aggrieved by a state agency's action first must exhaust administrative remedies before bringing a claim in court. Burns v. Sundlun, 617 A.2d 114, 116 (R.I. 1992). The exhaustion of remedies requirement serves two purposes: "(1) it aids judicial review byallowing the parties and the agency to develop the facts of the case, and (2) `it promotes judicial economy by avoiding needless repetition of administrative and judicial factfinding, perhaps avoiding the necessity of any judicial involvement.'" Id. at 117 (quoting Schwartz, Administrative Law § 8.33 at 542 (1991)). This Court has made exceptions when the exhaustion of administrative remedies would be futile. See M.B.T. Construction Corp. v. Edwards, 528 A.2d 336, 338 (R.I.1987) (holding that an appeal to an agency review board would be futile because the board lacked authority to invalidate ordinance as requested).
In this case, plaintiffs contended that they, in effect, had exhausted all available administrative and contractual remedies. They also contended that exhaustion of administrative remedies would have been futile because the relief sought is not available through the administrative appeal process. In fact, plaintiffs brought this declaratory judgment action in the Superior Court even though eight of them had received upgrades in classification and pay by pursuing Merit Act procedures, and two plaintiffs have administrative appeals still pending. They argued that any upgrade obtainable through the administrative process would be insufficient because *468 "the classification itself, as promulgated by the Department of Personnel, is biased against [them]." The motion justice ruled that plaintiffs should have sought the changes in classification by following the procedures set out in the Merit System Act, and only after exhausting these administrative remedies could plaintiffs bring an action in the Superior Court under the APA. We agree.
We pointed out in Prete v. Parshley, 99 R.I. 172, 175, 206 A.2d 521, 523 (1965), that under § 36-4-9, "the personnel administrator is required * * * to see to it that all positions `that are substantially similar with respect to authority, responsibility, and character of work are included within the same class * * *.'" Thus, if plaintiffs were able to demonstrate that their jobs are substantially similarto those in a higher pay class, then the personnel administrator would be statutorily mandated to provide the relief plaintiffs are seeking, irrespective of the label placed on that class or the department to which it is applied. By their own account, eight of the thirteen named plaintiffs who pursued the administrative appeals process succeeded in achieving an upgrade both in classification and in pay grade. Therefore, contrary to plaintiffs' assertions, it might not have proved futile for those employees who did not receive favorable upgrades to have pursued further administrative remedies and for those who sought still greater increases, to continue on the administrative path.
This case is procedurally similar to Cipolla v. Rhode Island College, Board of Governors for Higher Education, 742 A.2d 277 (R.I.1999) (per curiam), in which the plaintiff, an employee of Rhode Island College whose position was funded by a grant that did not provide retirement benefits, filed a grievance seeking retroactive enrollment in the retirement system. Id. at 279. The grievance was denied, and the plaintiff chose not to proceed to arbitration as required by the collective bargaining agreement, but proceeded to file a complaint for injunctive relief in the Superior Court. Id. The Superior Court granted the defendants' motion for summary judgment on the basis of the doctrine of election of remedies, and this Court affirmed, holding that "when one party to a [collective bargaining agreement] attempts to take advantage of the grievance procedure and loses, the election of remedies doctrine prohibits that party from pursuing the same dispute in the courts of this state." Id. at 281. Like the plaintiff in Cipolla, plaintiffs in this case filed administrative appeals, but rather than following through with that remedy, either by carrying their appeals to completion or seeking judicial review via the Administrative Procedures Act, they opted to file the instant lawsuit. The plaintiffs here, having elected their remedies, are now barred from pursuing the matter in court until the remedy they initiated has been exhausted.
Finally, we disagree with the plaintiffs' contention that the dismissal of their case was inconsistent with allegations in the complaint that set forth the administrative steps that the plaintiffs had taken. Those steps, they argued, were evidence that "all relevant administrative and contractual remedies had been exhausted." The motion justice determined that the administrative steps taken by the plaintiffs were undisputed, but she properly concluded that "the complaint, as phrased, is inconsistent with the statutory structure." We agree with the motion justice that the conclusory allegations in the complaint do not preclude the justice's ruling as a matter of law that both the failure of some of the plaintiffs to exhaust further steps pursuant to the Merit System Act and the pendency of the two appeals indicated that *469 the plaintiffs had not exhausted their administrative remedies and that the proper form of action would have been an appeal in accordance with the APA.
Accordingly, we summarily deny and dismiss the plaintiffs' appeal and affirm the judgment of the Superior Court, to which we return the papers in this case.
NOTES
[1]  The plaintiffs' complaint was brought under the DLT's former designation, the Department of Employment and Training. See P.L. 1996, ch. 226, §§ 2, 10.
