EvoMaster icon indicating copy to clipboard operation
EvoMaster copied to clipboard

EvoMaster crashed when reading em.yaml file

Open Tenpoless opened this issue 11 months ago • 8 comments

C:\Users\Administrator>evomaster *


| | | / | | | | |_ _____ | . . | __ _ | | ___ _ __ | __\ \ / / _ | |/| |/ ` / | / _ \ '| | |\ V / () | | | | (| __ \ || / | _/ _/ _/_| |/_,|/____|_|

  • EvoMaster version: 3.4.0
  • Loading configuration file from: C:\Users\Administrator\em.yaml
  • [ERROR] EvoMaster process terminated abruptly. This is likely a bug in EvoMaster. Please copy&paste the following stacktrace, and create a new issue on https://github.com/EMResearch/EvoMaster/issues

java.lang.IllegalArgumentException: Failed to parse config file at: C:\Users\Administrator\em.yaml at org.evomaster.core.config.ConfigUtil.readFromFile(ConfigUtil.kt:36) at org.evomaster.core.EMConfig.loadConfigFile(EMConfig.kt:355) at org.evomaster.core.EMConfig.updateProperties(EMConfig.kt:290) at org.evomaster.core.EMConfig$Companion.validateOptions(EMConfig.kt:101) at org.evomaster.core.Main$Companion.main(Main.kt:74) at org.evomaster.core.Main.main(Main.kt) Caused by: com.fasterxml.jackson.databind.JsonMappingException: Parameter specified as non-null is null: method org.evomaster.core.config.ConfigsFromFile.setConfigs, parameter <set-?> at [Source: (File); line: 8, column: 9] (through reference chain: org.evomaster.core.config.ConfigsFromFile["configs"]) at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:276) at com.fasterxml.jackson.databind.deser.SettableBeanProperty._throwAsIOE(SettableBeanProperty.java:627) at com.fasterxml.jackson.databind.deser.SettableBeanProperty._throwAsIOE(SettableBeanProperty.java:615) at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:143) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177) at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4730) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3542) at org.evomaster.core.config.ConfigUtil.readFromFile(ConfigUtil.kt:34) ... 5 common frames omitted Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method org.evomaster.core.config.ConfigsFromFile.setConfigs, parameter <set-?> at org.evomaster.core.config.ConfigsFromFile.setConfigs(ConfigsFromFile.kt) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:141) ... 11 common frames omitted

EvoMaster Version: 3.4.0

Tenpoless avatar Jan 24 '25 09:01 Tenpoless

Hi @Tenpoless

thanks for reporting this issue. the read em.yaml config has problems. EvoMaster shouldn't crash, but rather give a better error message, as that stack-trace is quite confusing. Did you modify em.yaml manually? If so, could you paste it here? If not, was it generated by a previous version of EvoMaster before 3.4.0?

thx

arcuri82 avatar Jan 24 '25 09:01 arcuri82

Sorry for the late reply.

Yes, I modified the em.yaml file manually, but I still followed the template you provided.

configs:  # remove this {} when specifying properties
    bbSwaggerUrl: "http://obedocumentation.fwh.is/?i=1"
    bbTargetUrl: "http://obedocumentation.fwh.is/?i=1"
    blackBox: true
    configPath: "em.yaml"
    endpointFocus: null
    endpointPrefix: null
    endpointTagFilter: null
    #   header0: ""
    #   header1: ""
    #   header2: ""
    maxTime: "60s"
    outputFilePrefix: "EvoMaster"
    outputFileSuffix: "Test"
    outputFolder: "generated_tests"
    outputFormat: "DEFAULT"
    prematureStop: ""
    ratePerMinute: 0
    sutControllerHost: "localhost"
    sutControllerPort: 40100
    testTimeout: 60


auth:
  - name: i gede
    loginEndpointAuth:
      payloadRaw: "{\"email\": \"[email protected]\", \"password\": \"sainsdata\"}"
  - name: susrama
    loginEndpointAuth:
      payloadUserPwd:
        email: [email protected]
        password: "sainsdata"
        usernameField: email
        passwordField: password
        token:
          headerPrefix: "Bearer "
          extractFromField: "/token/authToken"
          httpHeaderName: "Authorization"

authTemplate:
  loginEndpointAuth:
    endpoint: /login
    verb: POST
    contentType: application/json
    expectCookies: true

Thanks

Tenpoless avatar Jan 27 '25 23:01 Tenpoless

@Tenpoless thanks for providing this example

arcuri82 avatar Jan 28 '25 17:01 arcuri82

@Tenpoless is that example the one that led to that error message? I tried to reproduce it, and a get a different error:

$ evomaster.exe --configPath "–C:\Users\arcur\WORK\code\EvoMaster\core\src\test\resources\config\issue1159.yaml"
*
 _____          ___  ___          _
|  ___|         |  \/  |         | |
| |____   _____ | .  . | __ _ ___| |_ ___ _ __
|  __\ \ / / _ \| |\/| |/ _` / __| __/ _ \ '__|
| |___\ V / (_) | |  | | (_| \__ \ ||  __/ |
\____/ \_/ \___/\_|  |_/\__,_|___/\__\___|_|


* EvoMaster version: 3.4.0
* Loading configuration file from: C:\Users\arcur\WORK\code\EvoMaster\core\src\test\resources\config\issue1159.yaml
* [ERROR] EvoMaster process terminated abruptly. This is likely a bug in EvoMaster. Please copy&paste the foll
owing stacktrace, and create a new issue on https://github.com/EMResearch/EvoMaster/issues
java.lang.IllegalArgumentException: Failed to parse config file at: C:\Users\arcur\WORK\code\EvoMaster\core\src\test\resourc
es\config\issue1159.yaml
        at org.evomaster.core.config.ConfigUtil.readFromFile(ConfigUtil.kt:36)
        at org.evomaster.core.EMConfig.loadConfigFile(EMConfig.kt:355)
        at org.evomaster.core.EMConfig.updateProperties(EMConfig.kt:290)
        at org.evomaster.core.EMConfig$Companion.validateOptions(EMConfig.kt:101)
        at org.evomaster.core.Main$Companion.main(Main.kt:74)
        at org.evomaster.core.Main.main(Main.kt)
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "email" (class org.evomaster
.client.java.controller.api.dto.auth.PayloadUsernamePasswordDto), not marked as ignorable (4 known properties: "password", "
usernameField", "username", "passwordField"])
 at [Source: (File); line: 33, column: 43] (through reference chain: org.evomaster.core.config.ConfigsFromFile["auth"]->java
.util.ArrayList[1]->org.evomaster.client.java.controller.api.dto.auth.AuthenticationDto["loginEndpointAuth"]->org.evomaster.
client.java.controller.api.dto.auth.LoginEndpointDto["payloadUserPwd"]->org.evomaster.client.java.controller.api.dto.auth.Pa
yloadUsernamePasswordDto["email"])
        at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
        at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:1132)
        at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:2202)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1705)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1683)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:320)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
        at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
        at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java
:359)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
        at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.ja
va:323)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4730)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3542)
        at org.evomaster.core.config.ConfigUtil.readFromFile(ConfigUtil.kt:34)
        ... 5 common frames omitted


which tells you the problem, you have an unknown field called email. still, we should get a better error message not flooded with stacktraces...

arcuri82 avatar Jan 31 '25 12:01 arcuri82

Thank you, the previous problem has been resolved and black box testing is running. The OpenAPI I tested uses JWT tokens and I had trouble adjusting the evomaster. I am looking for a solution using ChatGPT and I have to install MVN and JDK, but an error occurs.

C:\Users\Administrator\evomaster\evomaster-driver>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------< com.example.evomaster:evomaster-driver >---------------
[INFO] Building evomaster-driver 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.588 s
[INFO] Finished at: 2025-01-31T20:05:39+07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project evomaster-driver: Could not resolve dependencies for project com.example.evomaster:evomaster-driver:jar:1.0-SNAPSHOT
[ERROR] dependency: org.evomaster:evomaster-client-java:jar:3.4.0 (compile)
[ERROR]         org.evomaster:evomaster-client-java:jar:3.4.0 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Thanks

Tenpoless avatar Jan 31 '25 13:01 Tenpoless

look at https://github.com/WebFuzzing/EvoMaster/blob/master/docs/write_driver.md

you are importing the wrong dependency evomaster-client-java. you should rather import evomaster-client-java-controller

arcuri82 avatar Jan 31 '25 13:01 arcuri82

btw, for using black-box testing, there is no need of EM Java libraries to generate tests. those are only needed for white-box testing.

arcuri82 avatar Jan 31 '25 13:01 arcuri82

Dear @Tenpoless ,

thanks for trying out EvoMaster and opening an issue here. If you have 10 minutes, we would be grateful if you could fill this survey on test naming strategies #1206. We will use such information to improve EvoMaster. Thanks!

arcuri82 avatar Mar 23 '25 10:03 arcuri82

closed as release 4.0.0 is out

arcuri82 avatar Aug 11 '25 21:08 arcuri82