Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EvoMaster crashed when reading em.yaml file #1159

Open
Tenpoless opened this issue Jan 24, 2025 · 7 comments
Open

EvoMaster crashed when reading em.yaml file #1159

Tenpoless opened this issue Jan 24, 2025 · 7 comments

Comments

@Tenpoless
Copy link

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

@arcuri82 arcuri82 added the bug label Jan 24, 2025
@arcuri82
Copy link
Collaborator

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 arcuri82 changed the title EvoMaster process terminated abruptly. EvoMaster crashed when reading em.yaml file Jan 24, 2025
@Tenpoless
Copy link
Author

Tenpoless commented Jan 27, 2025

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

@arcuri82
Copy link
Collaborator

@Tenpoless thanks for providing this example

@arcuri82
Copy link
Collaborator

arcuri82 commented Jan 31, 2025

@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...

@Tenpoless
Copy link
Author

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

@arcuri82
Copy link
Collaborator

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
Copy link
Collaborator

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 added a commit that referenced this issue Jan 31, 2025
#1159: better error message if issues in em.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants