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

How can I run tests using Telerik Testing Framework in Jenkins?

5 Answers 184 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mexi
Top achievements
Rank 1
Mexi asked on 24 Jun 2019, 06:05 PM

I'm trying to run my tests in Jenkins. Is there a way to implement tests using Telerik Testing Framework to Jenkins? I couldn't find any information about this on the website. I only saw information for Test Studio and Jenkins. 

 

This is the error I'm seeing when I ran tests in Jenkins.

<ErrorInfo>
          <Message>Initialization method ReconciliationTests.DefaultCashTests.TestInitialize threw exception. System.TypeInitializationException: System.TypeInitializationException: The type initializer for 'ArtOfTest.WebAii.Messaging.Process.ExecutionMediator' threw an exception. ---&gt; System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information..</Message>
          <StackTrace>    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at ArtOfTest.WebAii.WebExtensions.StartPageProviderFactory.StartPageProviderFactory.RegisterProviders()
   at ArtOfTest.WebAii.WebExtensions.StartPageProviderFactory.StartPageProviderFactory..ctor()
   at ArtOfTest.WebAii.Messaging.Process.ExecutionMediator..ctor()
   at ArtOfTest.WebAii.Messaging.Process.ExecutionMediator..cctor()
 --- End of inner exception stack trace ---
    at ArtOfTest.WebAii.Core.Manager.SetNewBrowserTracking(Boolean enable)
   at ArtOfTest.WebAii.Core.Manager.Start()
   at xxxTests.xxxTests.TestInitialize() in C:\Users\Public\Documents\Jenkins\workspace\xxx\xxxTests\xxxTests.cs:line 33
</StackTrace>
        </ErrorInfo>

 

 

Please see the attachment for build set up in Jenkins. 

5 Answers, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 26 Jun 2019, 01:46 PM
Hi Mexi,

I am sorry to hear you encountered troubles with running tests in Jenkins. 

Since you are using the Testing Framework, you should be using unit tests to run with Jenkins. And based on the shared error message it seems that not all dlls may be deployed on the machine where the tests are being run. Please, see a this post for a similar misbehavior as what you describe - the solution is to set the 'Copy Local' attribute of the referenced dlls to 'true'. Can you verify if this will solve the issue on your end as well? 

If still facing troubles, I will appreciate if you can prepare a sample project, which demonstrates the misbehavior and share it zipped via this thread. 

I am looking forward to hearing back from you. And thanks in advance for your cooperation. 

Regards,
Elena Tsvetkova
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Mexi
Top achievements
Rank 1
answered on 26 Jun 2019, 07:45 PM

Hi Elena,

 

I don't have a problem running the test on my machine through visual studio. I need to run these tests on Jenkins and the error message I listed above was shown in Jenkins output console when I executed on Jenkins. I set up my machine as a node on Jenkins so that I can execute my tests through Jenkins and see the test results. What I don't understand is why the tests can run on the machine when I execute through visual studio but not on Jenkins. What configuration I need to do on Jenkins that I can execute my test on there?

 

Best,

Mexi

0
Elena
Telerik team
answered on 27 Jun 2019, 10:13 AM
Hello Mexi,

Please, excuse me for any misunderstanding so far. 

I would like to sort out few things to ensure all necessary details are listed in our discussion. Therefore I will appreciate if you can share your input on the topics below:
- How do you run the tests from Visual Studio?  Do you use the MSTest.exe again? 
- Have you tried to run the same command, listed in Jenkins job, from a command prompt on the machine where the Visual Studio is installed? 
- Have you tried to run the tests with the VSTest.Console.exe?
- Is the Jenkins machine the same as the one where you run the tests from Visual Studio? 
- If these machines are different, is the Testing Framework installed on the Jenkins machine? 
- If these machines are different, how is the solution deployed to the Jenkins machine? 

The requested details will help me better understand what might be going wrong and it will be very useful if you find some time to provide these. In case you find anything else relevant to the current issue, please do not hesitate to share this as well. 

I am looking forward to hearing back from you. And thank you in advance for your cooperation. 

Regards,
Elena Tsvetkova
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Mexi
Top achievements
Rank 1
answered on 08 Jul 2019, 01:45 PM

Hi Elena,

Thank you for getting back to me so soon. Here are some updates I have from last week. I was able to run the tests with VSTest.console.exe but not MSTest.exe.

 

I have a couple of projects in this solution. All my projects are running fine but only one wasn't able to run. The error I saw on Jenkins console output is this: 
Starting test execution, please wait...
Failed   TestCash
Error Message:
 Initialization method Tests.CashTests.TestInitialize threw exception. System.TypeInitializationException: System.TypeInitializationException: The type initializer for 'ArtOfTest.WebAii.Messaging.Process.ExecutionMediator' threw an exception. ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information..
Stack Trace:
    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at ArtOfTest.WebAii.WebExtensions.StartPageProviderFactory.StartPageProviderFactory.RegisterProviders()
   at ArtOfTest.WebAii.WebExtensions.StartPageProviderFactory.StartPageProviderFactory..ctor()
   at ArtOfTest.WebAii.Messaging.Process.ExecutionMediator..ctor()
   at ArtOfTest.WebAii.Messaging.Process.ExecutionMediator..cctor()
 --- End of inner exception stack trace ---
    at ArtOfTest.WebAii.Core.Manager.SetNewBrowserTracking(Boolean enable)
   at ArtOfTest.WebAii.Core.Manager.Start()
   at Tests.CashTests.TestInitialize() in C:\Users\Public\Documents\Jenkins\workspace\XXX\Tests\CashTests.cs:line 29



Answers to your questions: 
- I usually run the tests just by selecting the tests and run. I've tried MSTest.exe but it didn't work in command prompt. VSTest.console.exe works for me. 
- The Jenkins machine is the same one where I run the tests from Visual Studio.

0
Elena
Telerik team
answered on 09 Jul 2019, 03:39 PM
Hi Mexi,

Thank you for your cooperation in our discussion. 

Based on the shared screenshots, it seems that the batch file triggers the MSTest.exe to execute the tests from Jenkins. However, you tested that in a plain command prompt aside from Jenkins and confirmed that MSTest did not execute the tests built with the Testing Framework. 

Though, VSTest.Console.exe did run the tests successfully and therefore my next suggestion will be to edit the Jenkins job to use that runner instead of MSTest. Then, run the Jenkins build or job and verify if you still get the errors initially listed in this thread. 

Please, let me know of the outcome and if you need any further assistance on the case. 

Regards,
Elena Tsvetkova
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Mexi
Top achievements
Rank 1
Answers by
Elena
Telerik team
Mexi
Top achievements
Rank 1
Share this question
or