我正在尝试使用项目中的gradle构建测试。
On building the tests, I am getting error ->
:compileTestJava/home/vibhcool/Documents/github/loklak_server/test/org/loklak/harvester/TwitterScraperTest.java:28: error: cannot find symbol
@TEST
^
symbol: class TEST
location: class TwitterScraperTest
1 error
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestJava'.
我收到错误的文件 - >
package org.loklak.harvester;
import java.io.File;
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.loklak.harvester.TwitterScraper;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class TwitterScraperTest {
@TEST
public void test_prepareSearchURL() {
String url;
String[] query = {"q1", "q2", "q3", };
String[] out_url = {"url1", "url2", "url3"};
for (int i = 0; i < query.length; i++) {
url = TwitterScraper.prepareSearchURL(query[i]);
assertEquals(url, out_url[i]);
}
}
}
当我在文件中评论@TEST时,gradle成功构建了测试。
我已经google了很多,但是无法得到错误。
我正在使用junit 4.10
答案 0 :(得分:2)
应该是:
@Test
public void test_prepareSearchURL() {
...
}
而不是
@TEST
public void test_prepareSearchURL() {
..
}