title: Google Test: How to run fixture only once for multiple tests?
body: <p>I am trying to test a http client using gtest. I want to test this client with my own http server. I have a small python server. Test cases would be client sending various requests to this python server. Is there a way to start the server before all tests run and destroy that server after tests?</p>
  
  <p>I am trying to use gtest fixture as shown here; by creating a new process in SetUp and killing it in TearDown. But it looks like the these calls are made for every test. </p>
  
  <pre><code>class Base: public ::testing::Test {
  public:
      pid_t child_pid = 0;
      void SetUp() {
          char *cmd = "/usr/bin/python";
          char *arg[] = {cmd, "./http_server.py", NULL};
          child_pid = fork();
          if ( child_pid == 0) {
              execvp(cmd, arg);
              std::cout &lt;&lt; "Failed to exec child: " &lt;&lt; child_pid &lt;&lt; std::endl;
              exit(-1);
          } else if (child_pid &lt; 0) {
              std::cout &lt;&lt; "Failed to fork child: " &lt;&lt; child_pid &lt;&lt; std::endl;
          } else {
              std::cout &lt;&lt; "Child HTTP server pid: " &lt;&lt; child_pid &lt;&lt; std::endl;
          }
      }
  
      void TearDown() {
          std::cout &lt;&lt; "Killing child pid: " &lt;&lt; child_pid &lt;&lt; std::endl;
          kill(child_pid, SIGKILL);
      }
  };
  
  TEST_F(Base, test_1) {
      // http client downloading url
  }
  
  TEST_F(Base, test_2) {
      // http client downloading url
  }
  </code></pre>