You need to sign in to do that
Don't have an account?
how to write test code the return values
public String getMainBody() {
if (this.theXMLDom != null && this.theXMLDom.getElementsByTagName('main') != null) {
return this.theXMLDom.getElementsByTagName('main')[0].nodeValue;
} else {
return '';
}
}
public String getSideBar() {
if (this.theXMLDom != null && this.theXMLDom.getElementsByTagName('sidebar') != null) {
return this.theXMLDom.getElementsByTagName('sidebar')[0].nodeValue;
} else {
return '';
}
}
public String getFooter() {
if (this.theXMLDom != null && this.theXMLDom.getElementsByTagName('footer') != null) {
return this.theXMLDom.getElementsByTagName('footer')[0].nodeValue;
} else {
return '';
}
}
public String getTracker() {
if (this.theXMLDom != null && this.theXMLDom.getElementsByTagName('tracker') != null) {
return this.theXMLDom.getElementsByTagName('tracker')[0].nodeValue;
} else {
return '';
}
for this code am notable to testcoverage for the RETURN values,
please help me.
Thanking you in Advance
Hi,
Not able to cover return method line means you test method is not reaching it.
Means you’re IF condition is not satisfied with your test data.
Make sure to give proper test data such that it satisfies the conditions in IF.
Then it will cover the Return Statement.