title: How can I determine if a (Python) behave feature file ran successfully from within the stepfile?
body: <p>Say I have a master python-behave feature file, and in said file, I check to see if 25, give or take, feature files exist, run each of them in their correct order, and then verify some postconditions.</p>
  
  <p>I want to be able to test multiple features inside a single feature file, if that's possible. I've written this step:</p>
  
  <pre><code>@when(u'Feature {name} is executed')
  def step_meta_feature(context, name):
      context.script_start_time = datetime.datetime.now()
      print("Testing feature " + name)
      os.system("behave " + name + ".feature --no-capture")
      context.script_end_time = datetime.datetime.now()
  </code></pre>
  
  <p>Currently, whenever, in the @when clauses of the main feature file, a feature is executed, this step will always run successfully. I'm fairly certain this is because it isn't checking any conditions, and if a behave script is executed, whether it fails or not, this step will always pass.</p>
  
  <p>In order to fix this problem, I would like to add a line(s), either in this step, or in the after_feature() function of the environment.py file to check if the executed behave feature passed.</p>
  
  <p>Behave's API does say that it contains a Feature object, created from feature files, which returns a "status" variable that tells you whether the feature passed or failed. However, that status variable only seems to be accessible within the environment.py file.</p>
  
  <p>My thinking is that I would find a way to execute a feature object from within the step using behave's functionality instead of os.system, and check its status afterwards, but I don't know if that's possible. Alternatively, I understand that I could write a single feature file that executes the 25 scenarios in order, but has all of the scenarios in the file. However I want to avoid doing that since the primary script is split out into 25 smaller scripts for individual testing purposes. Also, it wouldn't be a great idea to have several smaller features and one big feature that does what all of the smaller feature does in the same folder, running in some arbitrary order.</p>
  
  <p>How can I check from within environment.py or steps.py if a feature from another file passed or failed?</p>
  
  <p>EDIT: Another idea I guess is to find a way to output the text that is sent to the command line to a feature-for-feature log file and read the last few lines to find if any features or steps failed, although that seems like a roundabout way of doing things.</p>