AssertionError的IDEA输出中的字符编码

QAu*_*ron 5 testng intellij-idea character-encoding junit4

我正在使用IntelliJ IDEA 12.0.4.做一些测试.当我使用JUnit4框架运行时,我的Assertion Error看起来像:

java.lang.AssertionError: Status should be: ???????? expected [true] but found [false]
Run Code Online (Sandbox Code Playgroud)

如果我使用的是TestNG,它看起来像这样:

java.lang.AssertionError: Status should be: ?§?µ???????????? expected [true] but found [false]
Run Code Online (Sandbox Code Playgroud)

所有其他西里尔语输出在两个框架上都能正常工作,只有断言文本才能正常工作.

项目文件编码设置为UTF-8.

更新: 例如简单的WebDriver测试.我使用TestNG和IE.

import org.testng.Assert;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

import java.util.concurrent.TimeUnit;


public class SeleniumExample  {

    protected WebDriver driver;
    protected String baseUrl;

    @BeforeSuite
    public void setUp() throws Exception
    {

        /* Local Driver  */
        driver = new InternetExplorerDriver();
        baseUrl = "http://www.google.com";
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }

    @DataProvider
    public Object[][] TestData() {
        return new Object[][]{
                {"????"},
        };
    }

    @Test(description = "Create_InvestProjectRequest", dataProvider = "TestData")
    public void Test(String s) {

        driver.get(baseUrl);

        Assert.assertTrue(driver.getTitle().contains(s), "??????");
    }

    @AfterSuite
    public void tearDown() throws Exception {
        driver.quit();
    }
}
Run Code Online (Sandbox Code Playgroud)

在测试结果输出中,我看到:

java.lang.AssertionError:Ошибка预期:true实际:false

另一个问题是,如果我在DataProvider中使用西里尔文,那么在测试树中,我会看到Test("РћС€Р")而不是Test("Гугл")

Cra*_*der 2

这是一个已知的错误,将在下次更新中修复,感谢您的项目帮助我们追踪它。

当前的解决方法是编辑.vmoptions 文件并添加-Dfile.encoding=UTF-8选项。