rest-api-fuzz-testing icon indicating copy to clipboard operation
rest-api-fuzz-testing copied to clipboard

Error copying examples to workdir

Open LYDE1234 opened this issue 3 years ago • 4 comments

I've setup my RAFT config with:

    "toolName": "RESTler",
    "outputFolder": "restler-logs",
    "toolConfiguration": {
      "tasks": [
        {
          "task": "compile",
      "compileConfiguration": 
	{
		"discoverExamples": true,
    "usebodyexamples": true,
    "UseQueryExamples": true,
    "ExamplesDirectory": "."

and my API json has:

    "parameters": [
      {
        "name": "id",
        "in": "path",
        "description": "Id of the object",
        "required": true,
        "schema": {
          "type": "string",
          "format": "guid"
        },
          "examples": 
        {
            "example": {
              "$ref": "./examples.json"
            }
        }

So I would expect the Examples.json to get copied to the work dir, but I get

Unhandled exception. System.AggregateException: One or more errors occurred. (Could not resolve the JSON path '/work_dir_6ac5804a-4632-4ec4-aa45-a0dd090ecfde/examples.json' with the full JSON path '/work_dir_6ac5804a-4632-4ec4-aa45-a0dd090ecfde/examples.json'.) ---> System.InvalidOperationException: Could not resolve the JSON path '/work_dir_6ac5804a-4632-4ec4-aa45-a0dd090ecfde/examples.json' with the full JSON path '/work_dir_6ac5804a-4632-4ec4-aa45-a0dd090ecfde/examples.json'. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not find file '/work_dir_6ac5804a-4632-4ec4-aa45-a0dd090ecfde/examples.json'. File name: '/work_dir_6ac5804a-4632-4ec4-aa45-a0dd090ecfde/examples.json'

from the RESTler compiler and the examples.json is not in the workdir

LYDE1234 avatar May 25 '21 12:05 LYDE1234

@LYDE1234

Hi, can you provide RESTler config.json that was generated ?

stishkin avatar Jun 03 '21 23:06 stishkin

@LYDE1234 - ping.

Could you attach the config.json file to the ticket ?

stishkin avatar Jun 11 '21 14:06 stishkin

Sure. Please see attached file - renamed from json to txt to workaround issue editor limitation.

restler3.txt

LYDE1234 avatar Jun 13 '21 12:06 LYDE1234

@LYDE1234 - Sorry, I guess I was not clear. The config.json file we need is the one produced after RESTler compile step runs. In the RESTler compile output folder there will be number of files and one of them is named config.json

it contains data something like this:

{
  "SwaggerSpecFilePath": [
    "/work_dir_19cdb741-e617-4f39-9b9a-6590afc2b81c/swagger.json"
  ],
  "GrammarOutputDirectoryPath": "/work_dir_19cdb741-e617-4f39-9b9a-6590afc2b81c",
  "CustomDictionaryFilePath": "/work_dir_19cdb741-e617-4f39-9b9a-6590afc2b81c/customDictionary.json",
  "IncludeOptionalParameters": false,
  "UseQueryExamples": false,
  "UseBodyExamples": false,
  "DiscoverExamples": false,
  "ExamplesDirectory": "/work_dir_19cdb741-e617-4f39-9b9a-6590afc2b81c/Examples",
  "DataFuzzing": false,
  "ReadOnlyFuzz": false,
  "ResolveQueryDependencies": false,
  "ResolveBodyDependencies": false,
  "UseRefreshableToken": true,
  "AllowGetProducers": false
}

stishkin avatar Jun 14 '21 14:06 stishkin