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

Hope to obtain the environment configuration of Mutahunter #24

Open
zonewenke opened this issue Nov 11, 2024 · 2 comments
Open

Hope to obtain the environment configuration of Mutahunter #24

zonewenke opened this issue Nov 11, 2024 · 2 comments

Comments

@zonewenke
Copy link

Mutahunter is a great work in my opinion. I hope that after pulling the open-source code from GitHub, I can configure it and make the code run. However, the README page of Mutahunter is the user's instruction manual rather than the developer's. Could you please tell me some necessary environment configurations? Thank you very much. (The configuration I currently know is Python 3.11+)

@jungs1
Copy link
Contributor

jungs1 commented Nov 13, 2024

The only required environment configuration is setting the LLM API key. After installing the mutahunter package via pip, you just need to set your API key by running export OPENAI_API_KEY="your_key_here". Does this help?

@zonewenke
Copy link
Author

  • When I had my environment set up and was ready to try # Java Maven Example, I encountered the issue of [WinError 2] The system cannot find the file specified. I have tried some solutions, but none of them worked. If anyone has experience in solving similar problems, please let me know, I would be very grateful!

    Here are some details about this issue.

  • mvn test (This step is fine)

(E:\conda_envs\mutahunter) PS E:\github_projects\LLM-unittest\mutahunter-main\examples\java_maven> mvn test
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.7:prepare-agent (default) @ demo ---
[INFO] argLine set to -javaagent:E:\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.7\\org.jacoco.agent-0.8.7-runtime.jar=destfile=E:\\github_projects\\LLM-unittest\\mutahunter-main\\examples\\java_maven\\target\\jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\github_projects\LLM-unittest\mutahunter-main\examples\java_maven\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\github_projects\LLM-unittest\mutahunter-main\examples\java_maven\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ demo ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running BankAccountTest
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 s - in BankAccountTest
[INFO] 
[INFO] Results:
[INFO]
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.7:report (report) @ demo ---
[INFO] Loading execution data file E:\github_projects\LLM-unittest\mutahunter-main\examples\java_maven\target\jacoco.exec
[INFO] Analyzed bundle 'demo' with 1 classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.327 s
[INFO] Finished at: 2024-11-23T12:23:41+08:00
[INFO] ------------------------------------------------------------------------
  • export OPENAI_API_KEY=your-key-goes-here.

    • In this step, I replaced "your-key-goes-here" with my own key, which I have used in another project A and is executable. The only difference is that in A, both base_url and key were set simultaneously. (In this step, I changed "export" to "set")
  • mutahunter run --test-command "mvn test" --code-coverage-report-path "target/site/jacoco/jacoco.xml" --coverage-type jacoco --model "gpt-4o-mini",

    • When I run this command, an error occurred: " [WinError 2] The system cannot find the file specified", as shown below.
    (E:\conda_envs\mutahunter) PS E:\github_projects\LLM-unittest\mutahunter-main\examples\java_maven> mutahunter run --test-command "mvn test" --code-coverage-report-path "target/site/jacoco/jacoco.xml" --coverage-type jacoco --model "gpt-4o-mini"                                                                                                                            
    2024-11-23 11:58:26,059 INFO: Starting Coverage Analysis...
    2024-11-23 11:58:26,060 ERROR: Coverage analysis failed: Failed to complete coverage analysis: [WinError 2] 系统找不到指定的文件

    1.When I search for this file using the cd command, I can find it.

    (E:\conda_envs\mutahunter) PS E:\github_projects\LLM-unittest\mutahunter-main\examples\java_maven> cd target/site/jacoco
    (E:\conda_envs\mutahunter) PS E:\github_projects\LLM-unittest\mutahunter-main\examples\java_maven\target\site\jacoco> ls
    
    
        目录: E:\github_projects\LLM-unittest\mutahunter-main\examples\java_maven\target\site\jacoco
    
    
    Mode                 LastWriteTime         Length Name
    ----                 -------------         ------ ----
    d-----        2024/11/15     17:44                com.example
    d-----        2024/11/15     17:44                jacoco-resources
    d-----        2024/11/21     18:07                logs
    -a----        2024/11/22     12:53           3946 index.html
    -a----        2024/11/22     12:38          37214 jacoco-sessions.html
    -a----        2024/11/22     12:38            235 jacoco.csv
    -a----        2024/11/23     11:10           7552 jacoco.xml
    -a----        2024/11/21     18:07          28672 mutahunter.db

    2.When I run the mutahunter run command, specifying the file as jacoco.xml under java_maven,

    I still get the error [WinError 2] The system cannot find the file specified.

    (E:\conda_envs\mutahunter) PS E:\github_projects\LLM-unittest\mutahunter-main\examples\java_maven> mutahunter run --test-command "mvn test" --code-coverage-report-path "jacoco.xml" --coverage-type jacoco --model "gpt-4o-mini"
    2024-11-21 19:24:29,238 INFO: Starting Coverage Analysis...
    2024-11-21 19:24:29,239 ERROR: Coverage analysis failed: Failed to complete coverage analysis: [WinError 2] 系统找不到指定的文件

    3.The path separator in Windows environment may cause issues. Try running the command with the following variations:

    Using forward slash

    • /
      

      Replace backslash:

      mutahunter run --test-command "mvn test" --code-coverage-report-path "E:/github_projects/LLM-unittest/mutahunter-main/examples/java_maven/target/site/jacoco/jacoco.xml" --coverage-type jacoco --model "gpt-4o-mini"
    • with double backslashes:

      \\
      
      mutahunter run --test-command "mvn test" --code-coverage-report-path "E:\\github_projects\\LLM-unittest\\mutahunter-main\\examples\\java_maven\\target\\site\\jacoco\\jacoco.xml" --coverage-type jacoco --model "gpt-4o-mini"

​ The above commands have been tried without success.

  • When I checked my Maven and Java configurations, I didn't find any issues.

    • (E:\conda_envs\mutahunter) PS E:\github_projects\LLM-unittest\mutahunter-main\examples\java_maven\target\site\jacoco> mvn -v
      Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
      Maven home: D:\apache-maven-3.6.3\bin\..
      Java version: 1.8.0_212, vendor: Oracle Corporation, runtime: D:\Java\JDK\jre
      Default locale: zh_CN, platform encoding: GBK
      OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
      (E:\conda_envs\mutahunter) PS E:\github_projects\LLM-unittest\mutahunter-main\examples\java_maven\target\site\jacoco> java -version
      java version "1.8.0_212"
      Java(TM) SE Runtime Environment (build 1.8.0_212-b10)
      Java HotSpot(TM) 64-Bit Server VM (build 25.212-b10, mixed mode)

      If you have any suggestions, I would be very grateful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants