How to test remote (production) Scalatra web service with Specs2? -


i'm using specs2 test scalatra web service.

class apispec extends scalatraspec {   def = "simple test" ^      "invalid key should return status 401" ! root401^    addservlet(new apiservlet(),"/*")    def root401 = get("/payments") {     status must_== 401   } } 

this tests web service locally (localhost). perform same tests production jetty server. ideally, able changing url. possible @ ? or have write own (possible duplicate) testing code production server?

i don't know how scalatra manages urls 1 thing can in specs2 control parameters command-line:

class apispec extends scalatraspec commandlinearguments { def = s2"""   simple test   invalid key should return status 401  $root401     ${addservlet(new apiservlet(),s"$baseurl/*")}   """    def baseurl = {     // assuming passed 'url www.production.com' on command line     val args = arguments.commandline.split(" ")     args.zip(args.drop(1)).find { case (name, value) if name == "url" => value }.       getorelse("localhost:8080")   }    def root401 = get(s"$baseurl/payments") {     status must_== 401   } } 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -