Could this be Fablehaven, specifically the fourth book, Fablehaven: Secrets of the Dragon Sanctuary?
Fablehaven is a secret nature preserve protecting beings of myth and legend from the outside world. The current caretaker, Stan Sorenson, describes it as "a refuge for mystical creatures". Those who live in this large sanctuary, mortal and magical, must abide by a treaty of rules. The most common rules are focused upon "the law of the harvest" or "the law of retribution" meaning, you reap what you sow. It is described in the book as, "mischief for mischief, trouble for trouble, magic for magic." If this law in the treaty is broken, you lose the magical protection it provides, allowing for retaliation, which is essentially what drives the plot through the first book. There also exist magical borders that keep most mystical creatures within the preserve, but out of certain domains. The caretaker's house and grounds are within one of these protective boundaries. However, some of these borders dissolve on certain nights, allowing frightening creatures to roam free on the grounds, one of which - Midsummer Eve - occurs in the first book.
The series begins as 13-year-old Kendra and 11-year-old Seth Sorenson are traveling to their Grandpa and Grandma Sorenson's house while their parents are away on a 17-day Scandinavian cruise. When they get there, they also meet Dale, the groundskeeper, and Lena, the housekeeper. Grandma Sorenson is "mysteriously" missing. Grandpa Sorenson does not tell Kendra and Seth about Fablehaven being a secret preserve for magical creatures at first but instead sets up a rather complex puzzle involving six keys and a locked journal for Kendra to solve. Once Kendra unlocks the mostly blank journal, she discovers the words "drink the milk". She and Seth drink the magical milk Dale sets outside in their yard every morning, opening their eyes to a whole new, mystical world full of the magical beings of Fablehaven. Then Kendra and Seth must face challenges such as defeating an evil witch and a powerful demon, defending the preserve from an evil society, stopping a plague that changes creatures of light into creatures of darkness,accidentally turning Lena into a naiad, and, ultimately, protecting the world from a horde of imprisoned demons.
The shapeshifter would probably be Torina Barker:
Makes her first appearance in Book 4 as Kendra's abductor. She reveals herself as a lectoblix, who absorbs the youth of others with a bite. When Kendra first sees her she looks in her early 50's, but during her incarceration she witnesses her in the act of draining the youth from a new victim, and allows Kendra to flatter her on her new youthful appearance. She holds Kendra at her lair until the Sphinx takes custody of her.
The dragon could be Agad:
The caretaker of Wyrmroost. He holds conference with Trask's team and reveals himself as one of the last actual wizards on earth. He informs the team that they are there at their own risk, and that they cannot stay at the keep. He later reveals to Kendra that he was once a dragon, that all true wizards were once dragons, who opted to stay in human form.
A son of the Dragon King Celebrant, he was presumed dead when cockatrice invaded his nest and destroyed the eggs. His egg was rescued and he was raised by fairies. His primary guardian and teacher while growing up was Shiara. He calls himself the fairy dragon, and is much smaller than average. His breath heals and helps things grow. He has a silver, sleek appearance as if he was built for speed. Kendra says he is like a sports car. His best skill is flying, and he can turn invisible at will. He is shy, however, with low self-esteem, and is drawn to, but hesitates to make first contact with Kendra. They eventually connect and become fast friends.
I haven't found any mention of the test or the library, but I'll keep poking.