簡體   English   中英

使用 EvoSuite Eclipse 插件時生成測試用例時出錯

[英]Error in generating test cases when using EvoSuite Eclipse Plugin

使用 EvoSuite Eclipse 插件為動態 Web 項目中擴展 HttpServlet 的類生成測試用例時,出現以下錯誤。

在此處輸入圖片說明

那些漢字的意思是“ Windows 找不到這個文件F:\\Java\\J2EEWorkspace\\EvoSuiteTest\\evosuite-tests\\com\\s...\\TestServlet_ESTest.java 。請再次檢查文件名。”

EvoSuite Eclipse Plugin 將生成的代碼是

package com.servlet;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TestServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public void service( HttpServletRequest request, HttpServletResponse     response ){
        System.out.println("I am a test...");
    }

}

盡管已經添加了Server Runtime Library,但如果我們再次將Servlet Container jars(例如tomcat/lib中的jars)添加到項目中,問題將得到解決。 我不知道是什么原因。 這可能是 Evosuite 的錯誤。

這個問題在命令行操作中也可以發現。在命令行操作中,我們發現jre缺少jdk的tools.jar。 如果把jdk1.8/lib/tools.jar放到jre8/lib/下,問題就解決了。

在 Windows 7 操作系統上使用 EvoSuite 插件進行 Eclipse

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM