- Create Start Report class with bellow respective Configurations (Specific Methods)
[OneTimeSetUp]
public void StartReport()
{
string path = System.Reflection.Assembly.GetCallingAssembly().CodeBase;
string actualPath = path.Substring(0, path.LastIndexOf("bin"));
string projectPath = new Uri(actualPath).LocalPath;string reportPath = projectPath + "Reports\\AutomationTestingReport.html";
//Get Current Host Name into your Report
string hostName = System.Net.Dns.GetHostName();
//Get Current Username into your Report
string Username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
//Get Customize Parameters into your Report
UtilityHelper utiObj = new UtilityHelper();
string env = utiObj.getEnv();
//Print Host-name & Username and Customize Parameters on the Report
extent = new ExtentReports(reportPath, true);
extent
.AddSystemInfo("Host Name", hostName)
.AddSystemInfo("Environment", env)
.AddSystemInfo("User Name", Username);
extent.LoadConfig(projectPath + "extent-config.xml");
}
- Setup a Class for to keep All customize variables and methods.
public class UtilityHelper
{
string Env = "UAT";
public string getEnv()
{
return Env;
}
}
Enjoy #SimpleThinking !!!
No comments:
Post a Comment