我正在尝试捕获每个故障发生的屏幕截图并编写以下代码,但这不起作用.
public class TestFile {
    WebDriver driver = new FirefoxDriver();
    @Test   
    public void Testone(){
        driver.get("http://www.google.com/");           
    }
    @AfterMethod(alwaysRun=true)
    public void catchExceptions(ITestResult result){
        System.out.println("result"+result);
        String methodName = result.getName();
        System.out.println(methodName);
        if(!result.isSuccess()){         
            try { 
                File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
                FileUtils.copyFile(scrFile,new File("C:\\screenshot2.png" ));
            } catch (IOException e1) {
                e1.printStackTrace();
            }       
        }
    }
}
Run Code Online (Sandbox Code Playgroud)
这是失败的
文件scrFile =((TakesScreenshot)驱动程序).getScreenshotAs(OutputType.FILE);
堆栈跟踪:
[TestNG] Running:
C:\Documents and Settings\537310\Local Settings\Temp\testng-eclipse-1576306112\testng-customsuite.xml
result[TestResult name=Testone status=FAILURE method=TestFile.Testone()[pri:0, instance:com.example.tests.TestFile@1b34126] output={null}]
FAILED CONFIGURATION: @AfterMethod catchExceptions([TestResult name=Testone status=FAILURE method=TestFile.Testone()[pri:0, instance:com.example.tests.TestFile@1b34126] output={null}])
net.sf.cglib.core.CodeGenerationException: java.lang.IllegalAccessException-->Class org.openqa.selenium.remote.Augmenter$CompoundHandler can not access a member …Run Code Online (Sandbox Code Playgroud) 我们使用 JMeter 进行性能测试,主要用户范围为 200 到 500 个用户。我们面临的一个问题是 JMeter 报告的质量。
有没有最好在 JAVA 中使用的开源工具,它将以 CSV 或 JTL 文件作为输入,并生成高质量的报告和图表。
我有个疑问.
我想用yy-mm-dd-time格式的uniqe名称创建.jtl文件.
我怎样才能做到这一点?