diff --git a/Network/Wai/Test.hs b/Network/Wai/Test.hs
--- a/Network/Wai/Test.hs
+++ b/Network/Wai/Test.hs
@@ -10,6 +10,7 @@
     , SRequest (..)
     , SResponse (..)
     , defaultRequest
+    , setPath
     , setRawPathInfo
       -- * Assertions
     , assertStatus
@@ -30,6 +31,7 @@
 import qualified Data.ByteString.Char8 as S8
 import Data.Conduit.Blaze (builderToByteString)
 import Blaze.ByteString.Builder (flush)
+import qualified Blaze.ByteString.Builder as B
 import qualified Data.ByteString.Lazy as L
 import qualified Data.ByteString.Lazy.Char8 as L8
 import qualified Network.HTTP.Types as H
@@ -86,6 +88,17 @@
     , requestBodyLength = KnownLength 0
 #endif
     }
+
+-- | Set whole path (request path + query string).
+setPath :: Request -> S8.ByteString -> Request
+setPath req path = req {
+    pathInfo = segments
+  , rawPathInfo = B.toByteString (H.encodePathSegments segments)
+  , queryString = query
+  , rawQueryString = (H.renderQuery True query)
+  }
+  where
+    (segments, query) = H.decodePath path
 
 setRawPathInfo :: Request -> S8.ByteString -> Request
 setRawPathInfo r rawPinfo =
diff --git a/test/Network/Wai/TestSpec.hs b/test/Network/Wai/TestSpec.hs
new file mode 100644
--- /dev/null
+++ b/test/Network/Wai/TestSpec.hs
@@ -0,0 +1,32 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Network.Wai.TestSpec (main, spec) where
+
+import           Test.Hspec
+
+import           Network.Wai
+import           Network.Wai.Test
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+  describe "setPath" $ do
+
+    let req = setPath defaultRequest "/foo/bar/baz?foo=23&bar=42&baz"
+
+    it "sets pathInfo" $ do
+      pathInfo req `shouldBe` ["foo", "bar", "baz"]
+
+    it "sets rawPathInfo" $ do
+      rawPathInfo req `shouldBe` "/foo/bar/baz"
+
+    it "sets queryString" $ do
+      queryString req `shouldBe` [("foo", Just "23"), ("bar", Just "42"), ("baz", Nothing)]
+
+    it "sets rawQueryString" $ do
+      rawQueryString req `shouldBe` "?foo=23&bar=42&baz"
+
+    context "when path has no query string" $ do
+      it "sets rawQueryString to empty string" $ do
+        rawQueryString (setPath defaultRequest "/foo/bar/baz") `shouldBe` ""
diff --git a/test/Spec.hs b/test/Spec.hs
new file mode 100644
--- /dev/null
+++ b/test/Spec.hs
@@ -0,0 +1,1 @@
+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
diff --git a/wai-test.cabal b/wai-test.cabal
--- a/wai-test.cabal
+++ b/wai-test.cabal
@@ -1,5 +1,5 @@
 name:            wai-test
-version:         1.3.0.5
+version:         1.3.1
 license:         MIT
 license-file:    LICENSE
 author:          Michael Snoyman <michael@snoyman.com>
@@ -7,7 +7,7 @@
 synopsis:        Unit test framework (built on HUnit) for WAI applications.
 category:        Testing, Web, Yesod
 stability:       Stable
-cabal-version:   >= 1.6
+cabal-version:   >= 1.8
 build-type:      Simple
 homepage:        http://www.yesodweb.com/book/web-application-interface
 description:     Unit test framework (built on HUnit) for WAI applications.
@@ -29,6 +29,17 @@
                    , network
     exposed-modules: Network.Wai.Test
     ghc-options:     -Wall
+
+test-suite spec
+    type:            exitcode-stdio-1.0
+    hs-source-dirs:  test
+    main-is:         Spec.hs
+    other-modules:   Network.Wai.TestSpec
+    build-depends:   base                      >= 4        && < 5
+                   , wai-test
+                   , wai
+                   , hspec >= 1.3
+    ghc-options:     -Wall -Werror
 
 source-repository head
   type:     git
