can I use a vector<string> with value-parametrized googletest
<p>I want to parameterize a directory, means every file from a directory <a href="http://i.stack.imgur.com/TzNca.png" rel="nofollow">the directory structure with two empty json and two empty cfg files</a> should be processed by a parametrized TEST_P. Is this possible?</p>

<p>Unfortunately I got an error: </p>

<pre><code>g++ -std=c++11 -g -L/opt/gtest/lib -lgtest -lgtest_main -lpthread -I./ -I../../src -I/opt/gtest/include -o test2  parametrized2.cpp
parametrized2.cpp: In function 'testing::internal::ParamGenerator&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt; gtest_ParametrizedGTestInstanceParametrizedGTest_EvalGenerator_()':
parametrized2.cpp:57:5: error: could not convert 'testing::ValuesIn(const Container&amp;) [with Container = std::vector&lt;std::basic_string&lt;char&gt; &gt;; typename Container::value_type = std::basic_string&lt;char&gt;]()' from 'testing::internal::ParamGenerator&lt;std::basic_string&lt;char&gt; &gt;' to 'testing::internal::ParamGenerator&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;'
make: ***
</code></pre>

<p>Whats my mistake? </p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;gtest/gtest.h&gt;
#include &lt;dirent.h&gt;

using namespace std;

std::vector&lt;std::string&gt; jsonCfgFiles;

//opening any folder and saving all file-names in a vector&lt;string&gt;
std::vector&lt;string&gt; openDir(string path)
{
  DIR* dir;
  dirent* pdir;
  vector&lt;string&gt; files;
  dir = opendir(path.c_str());
  while (pdir = readdir(dir)) {
     files.push_back(pdir-&gt;d_name);
  }
  return files;
}

vector&lt;string&gt; GetJsonCofigFiles(void)
{
  vector&lt;string&gt; f;
  std::vector&lt;std::string&gt; jsonCfgFilesLocal;
  string buffer = "";
  f = openDir("oem"); // pass which dir to open

  // collect only json files
  for (auto i = f.begin(); i != f.end(); ++i) {
     if ((*i).find(".json") != std::string::npos) {
        buffer = "" + (*i);
        jsonCfgFiles.push_back(buffer);
     }
  }
  return jsonCfgFilesLocal;
}
// Using just string compiles well. Why is vector&lt;string&gt; not possible?
class ParametrizedGTest : public testing::TestWithParam&lt;vector&lt;string&gt; &gt; {
public:
  ParametrizedGTest();
  virtual ~ParametrizedGTest();
};

ParametrizedGTest::ParametrizedGTest()
{
}

ParametrizedGTest::~ParametrizedGTest()
{
}

TEST_P(ParametrizedGTest, testParameter)
{
  cout &lt;&lt; (*(GetParam().begin())) &lt;&lt; "," &lt;&lt; endl;
}

INSTANTIATE_TEST_CASE_P(ParametrizedGTestInstance,
                      ParametrizedGTest,
                      ::testing::ValuesIn(jsonCfgFiles));

int main(int argc, char* argv[])
{
  jsonCfgFiles = GetJsonCofigFiles();
  ::testing::InitGoogleTest(&amp;argc, argv);
  return RUN_ALL_TESTS();
}  
</code></pre>

<p>Thanks to Marko Popovic now I solved this:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;gtest/gtest.h&gt;
#include &lt;dirent.h&gt;

using namespace std;

std::vector&lt;std::string&gt; jsonCfgFiles;

std::vector&lt;string&gt; open1(string path) //opening any folder and saving all file-names in a vector&lt;string&gt;
{
   DIR* dir;
   dirent* pdir;
   vector&lt;string&gt; files;
   dir = opendir(path.c_str());
   while (pdir = readdir(dir)) {
      files.push_back(pdir-&gt;d_name);
   }
   return files;
}

std::vector&lt;string&gt; GetJsonCofigFiles(void)
{
   vector&lt;string&gt; f;
   string buffer = "";
   std::vector&lt;std::string&gt; jsonCfgFiles;
   f = open1("oem"); // pass which dir to open
   for (auto i = f.begin(); i != f.end(); ++i) {
      if ((*i).find(".json") != std::string::npos) {
         buffer = "oem/" + (*i);
         jsonCfgFiles.push_back(buffer);
      }
   }
   return jsonCfgFiles;
}

class ParametrizedGTest : public testing::TestWithParam&lt;string&gt; {
public:
  ParametrizedGTest();
  virtual ~ParametrizedGTest();
};

ParametrizedGTest::ParametrizedGTest()
{
}

ParametrizedGTest::~ParametrizedGTest()
{
}

TEST_P(ParametrizedGTest, testParameter)
{
  cout &lt;&lt; GetParam() &lt;&lt; endl;
}

INSTANTIATE_TEST_CASE_P(ParametrizedGTestInstance,
                      ParametrizedGTest,
                      ::testing::ValuesIn(jsonCfgFiles));

int main(int argc, char* argv[])
{
  jsonCfgFiles = GetJsonCofigFiles();
  ::testing::InitGoogleTest(&amp;argc, argv);
  return RUN_ALL_TESTS();
}
</code></pre>

<p>When compiled and run</p>

<pre><code>[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from ParametrizedGTestInstance/ParametrizedGTest
[ RUN      ] ParametrizedGTestInstance/ParametrizedGTest.testParameter/0
oem/_PVO111k_.json
[       OK ] ParametrizedGTestInstance/ParametrizedGTest.testParameter/0 (0 ms)
[ RUN      ] ParametrizedGTestInstance/ParametrizedGTest.testParameter/1
oem/_PVO112k.json
[       OK ] ParametrizedGTestInstance/ParametrizedGTest.testParameter/1 (0 ms)
[----------] 2 tests from ParametrizedGTestInstance/ParametrizedGTest (0 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (1 ms total)
[  PASSED  ] 2 tests.
</code></pre>