This is a migrated thread and some comments may be shown as answers.

Obtain TestList Name when running agent

8 Answers 46 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 20 Dec 2019, 06:33 PM

I wanted to see if there's any feasible way to get the name of the currently executing test list name from an execution client?

Basically I want to obtain the testlist name and store it in a local variable within the method OnBeforeTestStarted

 

From the Article below

This feature allows only one machine to have a running scheduling server and multiple machines to be connected to it and serve as execution clients. In this case the complete set of execution extension methods will be executed on the scheduling server machine only.
All execution machines will not execute OnBeforeTestListStarted() and OnAfterTestListCompleted() and will only recognize the OnBeforeTestStarted() and OnAfterTestCompleted().

https://docs.telerik.com/teststudio/advanced-topics/coded-samples/general/execution-extensions

 

8 Answers, 1 is accepted

Sort by
0
Plamen Mitrev
Telerik team
answered on 23 Dec 2019, 09:34 AM

Hello David,

I am sorry to tell you that there is option to get the test list name on the execution server in the standard scenario. However, if the scheduling server and the execution server are the same machine, you should be able to get the list name in the OnBeforeTestListStarted() method.

I could be able to suggest different approach, if you can share more details about the use case and what you are trying to achieve. So, please expand on that and share more details on the scheduling setup as well.

Thank you for your cooperation in advance.

Regards,
Plamen Mitrev
Progress Telerik

 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
David
Top achievements
Rank 1
answered on 23 Dec 2019, 01:27 PM

The hope was to be able to have test list names denoted by environment why....

Because the executive dashboard and results don't display any type of environment "ran in"  so if I have a test list called "SmokeTests" it could be ran in different environments but the overall result doesn't denote which environment (application environment dev/test/prod) it was ran against

0
Plamen Mitrev
Telerik team
answered on 23 Dec 2019, 02:42 PM

Hello David,

Thank you for following up with more details.

You can check the execution server name in the executive dashboard, under the Test Lists View in column "Executed on". The same information is available in the Results tab in Test Studio once you select the test list (see executedOn.png). You can also get the machine name of the current machine in code and log it in the execution log (using Log.WriteLine() method).

If I understand correctly, you are more interested to get more details about the application environment, which is being tested. I assume that you are using the baseURL test list setting to switch from dev to test to prod environments and run the same test list against all of them. The baseURL setting is actually logged at the start of each test like so - "Using 'http://at-hyperv01/js' as base url." or you can use the following code sample to write it in the log.

Log.WriteLine(Manager.Settings.Web.BaseUrl.ToString());

In case none of the above suggestions cover your requirements, or you see the need for improvement, you can open a public feature request from here. I can do that on your behalf, as well, but I will need to better understand the request. Please share a short example in your next reply.

Thank you for your understanding and cooperation in this discussion.

Regards,
Plamen Mitrev
Progress Telerik

 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
David
Top achievements
Rank 1
answered on 30 Dec 2019, 02:23 PM

Thanks Plamen

Unfortunately the applications we test against are not on the same machines as the execution so the exec dashboard just says what machine kicked off the test

 

BaseURL is what we're using, but that requires someone to click on the "view log" file to see what environment it kicked off in

The usecase here is we have an executive that uses the executive dashboard, if we run a test named "all smoke tests" and run it in different environments the result (without clicking view log) doesn't show to be executed in a different environment.

0
David
Top achievements
Rank 1
answered on 30 Dec 2019, 02:33 PM
Could we get a request that states

"Access OnBeforeTestListStarted() method from execution servers (remote)"
0
Plamen Mitrev
Telerik team
answered on 31 Dec 2019, 09:58 AM

Hello David,

Thank you for sharing more details on the use case.

Actually, there is already such feature request from a few years back and you can vote for it and follow it. The reason why it is not implemented yet, is because the current architecture of the scheduling is not designed to support it. We researched the possible solutions and they require a lot of development and come with some risk to the existing behavior.

My suggestion is to work with the test list name, to help you quickly see which environment it was executed against. There are 2 approaches for this solution and you can find more details below.

  1. Create as many test lists as environments and name them accordingly - "Dev All Smoke Tests", "Prod All Smoke Tests", etc. Then configure the baseURL for each of those test lists for the correct environment. This way the test list name, that appears in the executive dashboard, will correspond to the tested environment.
    The issue here, is that you need to add any new tests to all test lists that need to execute them.
  2. Keep only 1 test list and rename it when you change the baseURL setting. Again, the idea is to use the test list name to show the tested environment. The benefit here is that you need to maintain one test list.

I hope the above suggestions will make it easier to recognize the target environment for each test list execution.

I want to share more details about the OnBeforeTestListStarted() method. You can test it, if you can spare some time, because it works if you have setup the scheduling and execution all on one machine. You need to have Test Studio, scheduling and storage services and connect the execution server on the same machine to that scheduling. That said, I believe it is not the ideal solution for this scenario, as it will also write the details in the log. So, the information will not be easily accessible from the executive dashboard or results tab.

I remain available to continue our discussion and find the best approach for you.

Thank you for your understanding.

Regards,
Plamen Mitrev
Progress Telerik

 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
David
Top achievements
Rank 1
answered on 02 Jan 2020, 02:41 PM

I'll look into those recommendations Plamen.

In the meantime, I did add my vote to the requested feature even though it sounds like it's a far fetched idea.

The key thing for us is being able to drive the environment a test is executed in based on the test list name.

0
Plamen Mitrev
Telerik team
answered on 03 Jan 2020, 12:01 PM

Hello David,

I want to make sure that we are on the same page and that I am not imagining the scenario that you want to achieve in the wrong way. I will combine my previous suggestion with a sample project and we can use that as a base line for our discussion. If it turns out to be totally off, please set me straight and try to give me a more concrete example to work with.

The attached sample project has 1 test, called BaseTest. This test navigates to Wikipedia's main page and I used only partial URL, because I plan to use baseURL. Then, the test will enter some text and search for it. The same test can be executed against the English version - https://en.wikipedia.org or the German version - https://de.wikipedia.org of the page, the same way as "dev" and "prod" environments.

I have 2 separate test lists called "GermanList" and "EnglishList", which only have that 1 test. The idea here is to have baseURL for each of those tests, so that they run against the different version of the application under test. You can achieve that with the Test List Settings, under the Web tab. I can see that I used different baseURLs for both test lists and they will run against the specified environment.

With that setup there is no need to get the test list name or other parameter, in order to set a specific baseURL to the test list. Please note that if there baseURL test list setting is empty, the test will use the project baseURL setting instead.

The feature request might take some time to be implemented and I want to help you in the present. Please let me know what do you think about the attached project and suggestion. If that does not work for you, I will appreciate if you can provide an example from your side, so I can help you with other suggestions.

Thank you for your understanding and cooperation in this discussion.

Regards,
Plamen Mitrev
Progress Telerik

 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
Plamen Mitrev
Telerik team
David
Top achievements
Rank 1
Share this question
or