Page 1 of 1

Get TestCase Name in Report

Posted: Tue Oct 16, 2018 9:17 am
by JcNvG
Hey,

i want to get the name of the current TestCase into an e-Mail i send after finishing a testrun.

I tried TestReport.CurrentTestCaseActivity.TestCaseName, TestReport.CurrentTestModuleActivity.TestModuleName and several other commands, but the Mail-Logger fails to send emails if i try.

Is there an easy way to get the name of the current Testcase as a string?

Thank you in advance

JcNvG

Re: Get TestCase Name in Report

Posted: Tue Oct 16, 2018 10:09 am
by odklizec
Hi,

Email is usually sent as a last action in test suite, when the test suite is actually finished and there is no way to obtain current test case, because there is no longer "current" test case available.
What exactly do you want to achieve?
Could you please show us the structure of your test suite and location/implementation of email module?

Re: Get TestCase Name in Report

Posted: Tue Oct 16, 2018 12:45 pm
by JcNvG
Thank you for the quick reply!
Email is usually sent as a last action in test suite, when the test suite is actually finished and there is no way to obtain current test case, because there is no longer "current" test case available.
This makes sense, yes.
After finnishing the test-runs, an email is sent, containing the Ranorex-Logfile as PDF. The email-body contains a short test-summary, which is structured like this at the moment:


Test-Name: [Name Test-Data] - Status: [success/fail] - ...
Test-Name: [Name Test-Data] - Status: [success/fail] - ...
Test-Name: [Name Test-Data] - Status: [success/fail] - ...
and so on...

The Suite contains severel Test-Cases. Every Test-Case is linked with an individual Excel-Data-Connector in which the Test-Data is stored.
I want to Add the Name of the Test-Case to the short summary in the email-body, so it should look like this:


Test-Case: Test-Case #1 - Test-Name: Data 1 - Status: success
Test-Case: Test-Case #1 - Test-Name: Data 2 - Status: failed
Test-Case: Test-Case #1 - Test-Name: Data 4 - Status: success
Test-Case: Test-Case #3 - Test-Name: Data 2 - Status: success

I think it should be possible because we already save the status and the name of the Test-Data.

I added a Screenshot of the TestSuite-structure. As seen, the MailLogger is user-code.

After some research i noticed, that there exists a method, which records the data used in a particular test-case. After finnishing the entire Test-Case, the recorded information is set into the mailbody.
I think i have to record the TestCase-Name inside of that "list" through that method.