     import Darwin
 #endif
 
-#if os(Linux)
-    extension TestResponse : XCTestCaseProvider {
-        var allTests : [(String, () throws -> Void)] {
+class TestResponse : KituraTest {
+    #if os(Linux)
+        override var allTests : [(String, () throws -> Void)] {
             return [
                 ("testSimpleResponse", testSimpleResponse),
                 ("testPostRequest", testPostRequest),


@testable import KituraRouter
@testable import KituraNet
@testable import KituraSys
@testable import HeliumLogger

#if os(Linux)
    import Glibc

                ("testRedirect", testRedirect)
            ]
        }
    #endif

    let router = TestResponse.setupRouter()

    func testSimpleResponse() {
    	performServerTest(router) {
            self.performRequest("get", path:"/qwer") {response in
                XCTAssertNotNil(response, "ERROR!!! ClientRequest response object was nil")
                XCTAssertEqual(response!.statusCode, HttpStatusCode.OK, "HTTP Status code was \(response!.statusCode)")
                XCTAssertNotNil(response!.headers["Date"], "There was No Date header in the response")
                //XCTAssertEqual(response!.method, "GET", "The request wasn't recognized as a get")
                do {
                    let body = try response!.readString()
                    XCTAssertEqual(body!,"<!DOCTYPE html><html><body><b>Received</b></body></html>\n\n")
                }
                catch{
                    XCTFail("No respose body")
                }
            }
        }
    }

    func testPostRequest() {
    	performServerTest(router) {
            self.performRequest("post", path: "/bodytest") {response in
                XCTAssertNotNil(response, "ERROR!!! ClientRequest response object was nil")
                //XCTAssertEqual(response!.method, "POST", "The request wasn't recognized as a post")
                XCTAssertNotNil(response!.headers["Date"], "There was No Date header in the response")
                do {
                    let body = try response!.readString()
                    XCTAssertEqual(body!,"<!DOCTYPE html><html><body><b>Received text body: </b>plover\nxyzzy\n</body></html>\n\n")
                }
                catch{
                    XCTFail("No respose body")
                }
            }
        }
        //plover\nxyzzy\n
    }

    func testParameter() {
    	performServerTest(router) {
            self.performRequest("get", path: "/zxcv/test?q=test2") {response in
                XCTAssertNotNil(response, "ERROR!!! ClientRequest response object was nil")
                do {
                    let body = try response!.readString()
                    XCTAssertEqual(body!,"<!DOCTYPE html><html><body><b>Received /zxcv</b><p><p>p1=test<p><p>q=test2<p><p>u1=Ploni Almoni</body></html>\n\n")
                }
                catch{
                    XCTFail("No respose body")
                }
            }
        }
    }

    func testRedirect() {
        performServerTest(router) {
            self.performRequest("get", path: "/redir") {response in
                XCTAssertNotNil(response, "ERROR!!! ClientRequest response object was nil")
                do {
                    let body = try response!.readString()
                    XCTAssertNotNil(body!.rangeOfString("ibm"),"response does not contain IBM")
                }
                catch{
                    XCTFail("No respose body")
                }
            }
        }
    }

    static func setupRouter() -> Router {
        let router = Router()
        // the same router definition is used for all these test cases
        router.all("/zxcv/:p1") { request, _, next in
            request.userInfo["u1"] = "Ploni Almoni".bridge()
            next()
