簡體   English   中英

如何使用Java在一組工作空間中檢索Cucmber特征文件名

[英]How do I retrieve cucmber feature file names in a set of workspaces using Java

我在不同的工作區中有一些黃瓜特征文件。 例如: projectA中的a.feature ,b.feature和projectB中c.feature ,d.feature。 我必須使用Java從另一個projectC中檢索功能文件的名稱。

結果如下。

一個特征

b.feature

c.feature

d.feature

請幫忙。

提前致謝。

以下代碼將用於獲取具有擴展功能的文件

File dir = new File((".//"));//+PACKAGENAMEVALUE.replace(".", "//")+"//"));
System.out.println(dir.getAbsolutePath());
String[] extensions = new String[] { "feature"};

List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true);
for (File file1 : files) {
   // System.out.println("file: " + file1.getCanonicalPath());
    bw.write("Cucumber Feature File Name:" +" " + file1.getName());
    bw.newLine();
}

您可以通過如下修改以下內容來獲取不同類型的文件:

String []擴展名=新的String [] {“ feature”,“ jsp”,“ txt”};

暫無
暫無

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

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