Playframework 功能测试和在Play框架中发布文件?

Playframework 功能测试和在Play框架中发布文件?,playframework,functional-testing,Playframework,Functional Testing,在Play 1.2.4中,我一直在试图找出为什么我的功能测试没有正确地发布文件数据(它是空的)。我正在测试的控制器操作是: doUploadProfileImage(@Required File file, User user) 功能测试代码这样调用它: File file = VirtualFile.fromRelativePath("/test/imagetest.jpg").getRealFile(); Map<String,String> params = new Has

在Play 1.2.4中,我一直在试图找出为什么我的功能测试没有正确地发布文件数据(它是空的)。我正在测试的控制器操作是:

doUploadProfileImage(@Required File file, User user)
功能测试代码这样调用它:

File file = VirtualFile.fromRelativePath("/test/imagetest.jpg").getRealFile();

Map<String,String> params = new HashMap<String,String>();
params.put("user.id", user.id.toString());

Map<String,File> files = new HashMap<String,File>();
files.put("file", file);

Response response = POST(Router.reverse("ImageController.doUploadProfileImage").url, params, files);
File File=VirtualFile.fromRelativePath(“/test/imagetest.jpg”).getRealFile();
Map params=新的HashMap();
参数put(“user.id”,user.id.toString());
映射文件=新的HashMap();
文件。放置(“文件”,文件);
Response-Response=POST(Router.reverse(“ImageController.doUploadProfileImage”).url、参数、文件);
当我在调试中逐步完成时,在发布之前一切似乎都正常,但是当我到达“doUploadProfileImage()”时,“file”参数为NULL

关于这里发生的事有什么建议吗?检查/记录play服务器接收/原始POST数据的简单方法是什么

提前感谢,,
SM

经过几个小时的调试,我也发现了这个问题,因为这行代码位于play cobertura模块的conf/application.conf中:

%test.play.tmp=none
改为:

%test.play.tmp=/tmp

它起作用了

我想知道这是否与play上载tmp文件的方式有关,也许它们在控制器代码运行之前就被删除了。我们将很快调查并报告。