• (windows10)设置环境变量简化EVOSUITE的运行


    对于可执行的jar evosuite-1.1.0.jar,可以在命令行使用jave -jar执行它

    然而,每次进入到jar包所在的目录,有点繁琐,这个命令看上去也有点点长。

    那么我们可以设置环境变量EVOSUITE来取代这个命令,也即

    set EVOSUITE=java -jar C:/Libraries/maven-3.5.0/lib/evosuite-1.1.0.jar

    打印看看设置好了没

    (注意:这个设置是临时的,如果当前的cmd关闭,下一次打开时需要重新设置)

    用一下试试!

    下面随意找个类生成一下测试组件

    %EVOSUITE% -class org.apache.commons.lang3.ArrayUtils -projectCP target/classes

    命令行输出如下

    * EvoSuite 1.1.0
    * Going to generate test cases for class: org.apache.commons.lang3.ArrayUtils
    * Starting Client-0
    * Connecting to master process on port 21083
    * Analyzing classpath:
      - target/classes
    * Finished analyzing classpath
    * Generating tests for class org.apache.commons.lang3.ArrayUtils
    * Test criteria:
      - Line Coverage
      - Branch Coverage
      - Exception
      - Mutation testing (weak)
      - Method-Output Coverage
      - Top-Level Method Coverage
      - No-Exception Top-Level Method Coverage
      - Context Branch Coverage
    [Progress:>                             0%] [Cov:>                                  0%]* Total number of test goals for DYNAMOSA: 5568
    * Using seed 1695175201821
    * Starting evolution
    * Initial Number of Goals in DynaMOSA = 1447 / 5568
    [MASTER] 10:00:04.999 [logback-2] ERROR TestCluster - Failed to check cache for java.util.AbstractMap.SimpleEntry : Type points to itself
    [MASTER] 10:00:05.000 [logback-2] ERROR TestCluster - Failed to check cache for java.util.AbstractMap.SimpleImmutableEntry : Type points to itself
    [Progress:===============>              50%] [Cov:===============================>   89%][MASTER] 10:00:35.851 [logback-2] ERROR TestCluster - Failed to check cache for java.util.Comparator : Type points to itself
    [Progress:==============================100%] [Cov:===============================>   89%]
    * Search finished after 65s and 407 generations, 232971 statements, best individual has fitness: 362.0
    [MASTER] 10:01:12.788 [logback-1] WARN  TimeController - Phase SEARCH lasted too long, 7 seconds more than allowed.
    * Minimizing test suite
    [MASTER] 10:02:20.325 [logback-1] WARN  TestSuiteMinimizer - Minimization timeout. Roll back to original test suite
    * Going to analyze the coverage criteria
    * Coverage analysis for criterion LINE
    * Coverage of criterion LINE: 99%
    * Total number of goals: 1225
    * Number of covered goals: 1211
    * Coverage analysis for criterion BRANCH
    * Coverage of criterion BRANCH: 99%
    * Total number of goals: 1123
    * Number of covered goals: 1117
    * Coverage analysis for criterion EXCEPTION
    * Coverage of criterion EXCEPTION: 100%
    * Total number of goals: 57
    * Number of covered goals: 57
    * Coverage analysis for criterion WEAKMUTATION
    * Coverage of criterion WEAKMUTATION: 86%
    * Total number of goals: 1065
    * Number of covered goals: 912
    * Coverage analysis for criterion OUTPUT
    * Coverage of criterion OUTPUT: 84%
    * Total number of goals: 592
    * Number of covered goals: 498
    * Coverage analysis for criterion METHOD
    * Coverage of criterion METHOD: 100%
    * Total number of goals: 220
    * Number of covered goals: 220
    * Coverage analysis for criterion METHODNOEXCEPTION
    * Coverage of criterion METHODNOEXCEPTION: 100%
    * Total number of goals: 220
    * Number of covered goals: 219
    * Coverage analysis for criterion CBRANCH
    * Coverage of criterion CBRANCH: 96%
    * Total number of goals: 1123
    * Number of covered goals: 1083
    * Generated 1192 tests with total length 14308
    * Resulting test suite's coverage: 89% (average coverage for all fitness functions)
    * Generating assertions
    [MASTER] 10:03:14.482 [logback-1] WARN  SimpleMutationAssertionGenerator - Assertion minimization is taking too long (0.7501833333333333% of time used, but only 245/1192 tests minimized), falling back to using all assertions
    * Resulting test suite's mutation score: 40%
    * Compiling and checking tests
    * Writing tests to file
    * Writing JUnit test case 'ArrayUtils_ESTest' to evosuite-tests
    * Done!

    * Computation finished

  • 相关阅读:
    “幂等”不等于“分布式锁”,也不得不考虑返回值
    Conditional GAN
    解决typora本地图片转换成网络路径图片-防止路径改变图片丢失。
    反射课后习题及做题记录
    聊聊复杂网络环境下hdfs的BlockMissingException异常|参数dfs.client.use.datanode.hostname
    【SQL语法基础】什么是SQL函数?为什么使用SQL函数可能会带来问题?
    OneFlow源码解析:自动微分机制
    基于springboot实现校园疫情防控系统项目【项目源码+论文说明】计算机毕业设计
    Python 中如何编写类型提示
    Android基础一:Android UI基础容器
  • 原文地址:https://blog.csdn.net/weixin_44997802/article/details/133065630