Roq n Roll Your Tests 🎶

Roq n Roll Your Tests 🎶

2025, Jan 28    

Hello folks,

I'm excited to share something very cool! I've developed a way to:

  • Test the full generation of your website.
  • Use RestAssured to test the generated site (thanks to an already started static server).

Step 1: Add the Dependency

First, include the quarkus-roq-testing test dependency in your pom.xml.

Step 2: Basic Test Example

Once you've added the dependency, you can easily ensure all pages are generated without errors:

@QuarkusTest
@RoqAndRoll
public class RoqSiteTest {
    
    @Test
    public void testGen() {
        // All pages will be generated/validated during test setup
    }
}

That's it! This basic test already verifies that your site generation is error-free.


Step 3: Test the Generated Content

To go even further, you can test the actual content of your generated site. The RestAssured port will automatically use the Roq static server. Here's how:

@QuarkusTest
@RoqAndRoll
public class RoqSiteTest {

    @Test
    public void testIndex() {
        RestAssured.when().get("/")
                .then()
                .statusCode(200)
                .body(containsString(
                    "A Static Site Generator to easily create a static website or blog using Quarkus super-powers."
                ));
    }
}

Why I Love It ❤️

With just a few annotations and a bit of setup, you can effortlessly test both the generation process and the content of your site. It's powerful, elegant, and super simple to use.

Give it a try and let me know how it works for you. Happy testing! 🚀