File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -306,9 +306,10 @@ class Steps : public ::testing::EmptyTestEventListener {
306306 ::testing::UnitTest::GetInstance ()->listeners().Append(this );
307307 // If the output is set, then add a report to the features holder
308308 const auto output = std::getenv (" OUTPUT" );
309- std::string path = std::string (output) + std::string (std::getenv (" TEST_NAME" ));
310- std::cout << path << std::endl;
309+
311310 if (output) {
311+ std::string path = std::string (output) + std::string (std::getenv (" TEST_NAME" ));
312+ std::cout << path << std::endl;
312313 Features::getInstance ()->addReport (path);
313314 }
314315 for (const auto & feature : detail::split (scenario, ' :' )) {
@@ -644,6 +645,7 @@ class Steps : public ::testing::EmptyTestEventListener {
644645 ;
645646 if (currentStep == nullptr ) return ;
646647 currentStep->setResult (!(test_part_result.failed ()));
648+ currentStep->setFailMessage (test_part_result.summary ());
647649 }
648650
649651 std::shared_ptr<GherkinCpp::Step>
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ class CucumberJson {
6565 std::string resultStr = step.second ->getResult ()?" passed" :" failed" ;
6666 curStep[" result" ] = {
6767 {" status" , resultStr},
68+ {" error_message" , step.second ->getFailMessage ()},
6869 {" duration" , 1 }
6970 };
7071 curElement[" steps" ].push_back (curStep);
Original file line number Diff line number Diff line change @@ -24,10 +24,16 @@ class Step : public GenericInfo{
2424 result = result_;
2525 }
2626
27+ void setFailMessage (const char * message_) {
28+ message = std::string (message_);
29+ }
30+
2731 bool getResult () { return result;}
32+ std::string getFailMessage () {return message;}
2833
2934private:
3035 bool result=true ;
36+ std::string message;
3137};
3238
3339} // GherkinCpp
You can’t perform that action at this time.
0 commit comments