Can't find the right exec?!

I’ve got what looks like one last hurdle to my restful service library:

`

09:08:18.675 [ERROR] i.g.a.ZincCompiler$ - /src/poc/rtde/src/scala/com/cigna/rtde/simulations/sandbox.scala:19: ambiguous reference to overloaded definition,
both method exec in trait Execs of type (scenario: io.gatling.core.structure.ScenarioBuilder)io.gatling.core.structure.ChainBuilder
and method exec in trait Execs of type (chains: Iterable[io.gatling.core.structure.ChainBuilder])io.gatling.core.structure.ChainBuilder
match argument types (Nothing)
09:08:18.675 [ERROR] i.g.a.ZincCompiler$ - .exec( RTDE.Individuals.me.request.check( jsonPath( “$.result” ).saveAs( INDIVIDUAL_DETAIL ) ) )
09:08:18.675 [ERROR] i.g.a.ZincCompiler$ - ^

`

My scenario looks like this:

`
scenario( “sandbox” )
.exec( Setup.common )
.during( Test.duration ) {
feed( User.feed.random )
.exec( RTDE.Login.sequence )
.exec( RTDE.Individuals.me.request.check( jsonPath( “$.result” ).saveAs( INDIVIDUAL_DETAIL ) ) )
.debug.valueOf( INDIVIDUAL_DETAIL )
}

`

Gatling reports the .exec as the problem. The IDE reports the call to feed() as the problem, but gives the same error about overloaded exec.

At this point, I’m not sure if my problem is my code, or if it is using a feed() inside of a during(). I’m going to try making a simple gatling script that does not use my code, to see.

In the mean time, just in case it’s my code, here is what it looks like:

`
trait RestfulService {

protected def gatlingRequest[T <: AbstractHttpRequestBuilder[T]] : T
}
trait RestfulGET extends RestfulService {
def gatlingRequest =
http( description )
.get( url )
.header( HttpHeaderNames.Accept, HttpHeaderValues.ApplicationJson )
.headers( requestHeaders )
.queryParamMap( queryParams )
}

class RtdeAuth[R <: RestfulService]( desc : String ) extends RestfulService {

private def sendThroughLayer7[T <: AbstractHttpRequestBuilder[T]] ( request : T ) : T = … // modify the request
private def sendDirectToServer[T <: AbstractHttpRequestBuilder[T]] ( request : T ) : T = … // modify the request

def request[T <: AbstractHttpRequestBuilder[T]] : T =
if ( Config.Endpoint.Services.config.getBoolean( “layer7” ) )
sendThroughLayer7( this.gatlingRequest )
else
sendDirectToServer( this.gatlingRequest )

}

class IndividualsService {

def me = new RtdeAuth[RestfulGET] ( “Individuals.me” ) {
def path = “/v1/individuals/me”
def withPreferences = this.queryParameter( “preferences”, true )
def channels( which : String ) = this.queryParameter( “channels”, which )
}
}

object RTDE {

val Individuals = new IndividualsService()

}
`

I’ve no idea what caused it, but I re-organized my code still further in order to get it to work correctly, and this problem went away. So strange…

Honestly, my poor little brain is not capable of debugging such typing issues by email. It needs the full almost compiling code.

I can’t even tell you exactly what I did that fixed it, but the problem went away on it’s own. Makes one wonder… :stuck_out_tongue:

On the bright side, my framework compiles, now I’m creating tests to validate that everything works as intended. YAY!

Congrats! :slight_smile: