我有两个Scala文件,我需要从第二个Scala文件导入一个类,但我不知道
在第一个scala文件中,我有一个请求,并且在特定请求中,我想从该对象的第二个文件中调用一个对象,我有一个验证请求。
我如何导入?
对不起我的基本问题,我是Gatling的新手,我需要帮助:c
我的第一个档案有:
class SearchCustomerClientNumber2 extends Simulation {
val httpProtocol = http
.baseURL("http://URL")
.inferHtmlResources()
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("es-CL,es;q=0.8,en-US;q=0.5,en;q=0.3")
.userAgentHeader("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0")
.exec(http("request_9")
.get("/bei010Web/bei010/sp_MX/bei10.jsp")
.headers(headers_0))
.pause(1)
.exec(http("request_10")
.get("/bei010Web/Security?WSDL")
.resources(http("request_11")
.get("/bei010Web/Activities?WSDL")))
.pause(4)
//here i want to import a object from another scala file is
aauthenticate web service
.resources(http("request_13")
.post("/bei010Web/Security")
.headers(headers_13)
.body(RawFileBody("SearchCustomerClientNumber2_0013_request.txt")),
我的第二个Scala文件:
Class IC6SaaSRestUAT_Tuves extends Simulation {
val httpProtocol = http
.baseURL("http://URL") // PROD
.inferHtmlResources()
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("es-CL,es;q=0.8,en-US;q=0.5,en;q=0.3")
.userAgentHeader("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0")
val csvFeeder = csv("Users.csv").circular // use a comma separator
val headers_12 = Map(
"Content-length" -> "1135",
"Content-type" -> "text/xml; charset=utf-8",
"SOAPAction" -> """""""")
val uri1 = "http://URL/bBBBBWeb/"
print("*******")
print("*******")
print(csvFeeder)
object IC6SaaS { //I want to import this object if is possible
val ic = feed(csvFeeder)
.exec(http("request_12")
.post("/bei010Web/Security")
.headers(headers_12)
//.body(RawFileBody("SearchAccountNumberxxx_0012_request.txt"))
.body(StringBody("""<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<tns:authenticateUser
xmlns:tns="http://webservice.bei.inffinix.com/">
<login>${Username}</login>
<password>${pass}</password>
<program>1</program>
</tns:authenticateUser>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>"""))
check(regex("""errors""").count.is(0)))
}