Sha256: 69a55bcb3181a7f5de325a697e70c907401dd742ae5e2d0ffc00f2cd3ff175ec

Contents?: true

Size: 969 Bytes

Versions: 11

Compression:

Stored size: 969 Bytes

Contents

import ballerina/test;
import ballerina/io;
import ballerina/http;

boolean serviceStarted;

function startService() {
    serviceStarted = test:startServices("hello-world-service");
}

@test:Config {
    before: "startService",
    after: "stopService"
}
function testFunc() {
    // Invoking the main function
    endpoint http:Client httpEndpoint { url: "http://localhost:9090" };
    // Chck whether the server is started
    test:assertTrue(serviceStarted, msg = "Unable to start the service");

    string response1 = "Hello, World!";

    // Send a GET request to the specified endpoint
    var response = httpEndpoint->get("/hello/sayHello");
    match response {
        http:Response resp => {
            var res = check resp.getTextPayload();
            test:assertEquals(res, response1);
        }
        error err => test:assertFail(msg = "Failed to call the endpoint:");
    }
}

function stopService() {
    test:stopServices("hello-world-service");
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ballerina/exercises/hello-world-service/tests/hello_world_service_test.bal
trackler-2.2.1.179 tracks/ballerina/exercises/hello-world-service/tests/hello_world_service_test.bal
trackler-2.2.1.178 tracks/ballerina/exercises/hello-world-service/tests/hello_world_service_test.bal
trackler-2.2.1.177 tracks/ballerina/exercises/hello-world-service/tests/hello_world_service_test.bal
trackler-2.2.1.176 tracks/ballerina/exercises/hello-world-service/tests/hello_world_service_test.bal
trackler-2.2.1.175 tracks/ballerina/exercises/hello-world-service/tests/hello_world_service_test.bal
trackler-2.2.1.174 tracks/ballerina/exercises/hello-world-service/tests/hello_world_service_test.bal
trackler-2.2.1.173 tracks/ballerina/exercises/hello-world-service/tests/hello_world_service_test.bal
trackler-2.2.1.172 tracks/ballerina/exercises/hello-world-service/tests/hello_world_service_test.bal
trackler-2.2.1.171 tracks/ballerina/exercises/hello-world-service/tests/hello_world_service_test.bal
trackler-2.2.1.170 tracks/ballerina/exercises/hello-world-service/tests/hello_world_service_test.bal