[IE TESTS] Fix passrate in report (#3904)

* [IE TESTS] Fix passrate in report

* add skip
This commit is contained in:
Irina Efode 2021-01-21 11:05:10 +03:00 committed by GitHub
parent 573a13b252
commit a3234593db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -68,12 +68,10 @@ struct PassRate {
}
float getPassrate() const {
if (passed == 0 && failed == 0) {
return 0.;
} else if (passed != 0 && failed == 0) {
return 100.;
if (passed + failed == 0) {
return 0.f;
} else {
return (passed / (passed + failed)) * 100.;
return passed * 100.f / (passed + failed + skipped);
}
}
};

View File

@ -123,10 +123,10 @@ void TestEnvironment::TearDown() {
for (const auto &it : stats) {
std::string name = std::string(it.first.name) + "-" + std::to_string(it.first.version);
pugi::xml_node entry = currentDeviceNode.append_child(name.c_str());
entry.append_attribute("passed").set_value(std::to_string(it.second.passed).c_str());
entry.append_attribute("failed").set_value(std::to_string(it.second.failed).c_str());
entry.append_attribute("skipped").set_value(std::to_string(it.second.skipped).c_str());
entry.append_attribute("passrate").set_value(std::to_string(it.second.getPassrate()).c_str());
entry.append_attribute("passed").set_value(it.second.passed);
entry.append_attribute("failed").set_value(it.second.failed);
entry.append_attribute("skipped").set_value(it.second.skipped);
entry.append_attribute("passrate").set_value(it.second.getPassrate());
}
bool result = doc.save_file(reportFileName.c_str());
if (!result) {