We're using Ranorex 7.2, with all tests written in Visual Studio, using NUnit runner. We have a problem with reporting - I can only create separate logs per test class (which is OK), but in a form of simple line by line entries. Of course I can include entries like "Begin Test: TestName" with all test steps and validation, but they are quite hard to read. For some reason I can't get this report divided into expandable test entries.
Here's an example test class:
Code: Select all
[TestFixture, RequiresThread(ApartmentState.STA)]
public class TempTests
{
private const string ReportPath = "C:\\RanorexReport\\";
[OneTimeSetUp]
public void RunBeforeTests()
{
TestReport.Setup(ReportLevel.Debug, ReportPath + TestContext.CurrentContext.Test.ClassName + ".html", true);
//TestReport.BeginTestSuite((TestContext.CurrentContext.Test.ClassName));
}
[SetUp]
public void SetUp()
{
TestReport.BeginTestCaseContainer(TestContext.CurrentContext.Test.Name);
TestReport.BeginTestModule(TestContext.CurrentContext.Test.Name);
}
[TearDown]
public void TearDown()
{
TestReport.EndTestModule();
TestReport.EndTestCaseContainer();
}
[OneTimeTearDown]
public void RunAfterTests()
{
//TestReport.EndTestSuite();
TestReport.SaveReport();
}
[Category("CAD.Playground")]
[Test]
public void ReporterTestPass()
{
Report.Info("Make this test pass.");
Ranorex.Validate.IsTrue(true, "Life is life.");
}
[Category("CAD.Playground")]
[Test]
public void ReporterTestFail()
{
Report.Info("Make this test fail.");
Ranorex.Validate.IsFalse(true, "Is life life?");
}
}
If I enable BeginTestSuite line in [OneTimeSetup], the report will be completely empty.
I can also move TestReport.Setup() from [OneTimeSetUp] to test [SetUp] method - it will produce expandable test container, however only for the last test executed, I suppose due to the data file being overwritten by each test.
Code: Select all
[SetUp]
public void SetUp()
{
TestReport.Setup(ReportLevel.Debug, ReportPath + TestContext.CurrentContext.Test.ClassName + ".html", true);
TestReport.EnableTracingScreenshots = false;
TestReport.BeginTestCaseContainer(TestContext.CurrentContext.Test.ClassName);
TestReport.BeginTestModule(TestContext.CurrentContext.Test.Name);
}
Am I missing something? Is there a way to gereate reports looking like above, but including all tests from current class?
I don't know why there is a difference when I call TestReport.Setup() from my [OneTimeSetUp] method which, I think, would be a logical thing to do. Prepare reporter before running anything, then add test containers for each executed test.