cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to create a user session - Error in Jenkins

SOLVED
Highlighted
Occasional Contributor

Unable to create a user session - Error in Jenkins

I am trying to run Test Complete projects as a Freestyle Project on Windows server using Jenkins that is installed on the same sever.

Getting below Jenkins error –

 

Console Output

Started by user Shehnaz Patanwala

Running as SYSTEM

Building in workspace C:\Program Files (x86)\Jenkins\workspace\Test Complete

 

[TestComplete] The test execution started (PITA_Internal/C:\Users\Public\Install\pita-ui-automation-projects\PITA_Internal\A-Account_Reset_Project\A-Account_Reset_Project.mds).

[TestComplete] Found TestComplete/TestExecute installations:

        Type: TE, Version: 14.10.1042.11, Path: "C:\Program Files (x86)\SmartBear\TestExecute 14\x64\bin\TestExecute.exe"

[TestComplete] Selected TestComplete/TestExecute installation:

        Type: TE, Version: 14.10.1042.11, Path: "C:\Program Files (x86)\SmartBear\TestExecute 14\x64\bin\TestExecute.exe"

[TestComplete] Launching the test runner.

$ '"C:\Program Files (x86)\SmartBear\TestExecute 14\bin\TestCompleteService14.exe"' //LogonAndExecute //lDomain: "" //lName: "" //lPassword: ******** //lTimeout: "-1" //lUseActiveSession: "true" //lCommandLine: '""C:\Program Files (x86)\SmartBear\TestExecute 14\x64\bin\TestExecute.exe" C:\Users\Public\Install\pita-ui-automation-projects\PITA_Internal\PITA_Internal.pjs /run /SilentMode /ForceConversion /ns /exit "/ExportLog:C:\Program Files (x86)\Jenkins\workspace\Test Complete\1571766356292.tclogx" "/ExportLog:C:\Program Files (x86)\Jenkins\workspace\Test Complete\1571766356292.htmlx" "/ErrorLog:C:\Program Files (x86)\Jenkins\workspace\Test Complete\1571766356292.txt" /project:C:\Users\Public\Install\pita-ui-automation-projects\PITA_Internal\A-Account_Reset_Project\A-Account_Reset_Project.mds /DoNotShowLog /JenkinsTCPluginVersion:2.3"'

[TestComplete] Test runner exit code: -10 (Unable to create a user session).

[TestComplete] [WARNING] Unable to find the log file "1571766356292.tclogx".

[TestComplete] [WARNING] Unable to find the log file "1571766356292.htmlx".

[TestComplete] [WARNING] Errors occurred during the test execution.

[TestComplete] Marking the build as UNSTABLE.

[TestComplete] [WARNING] Unable to publish test results (xml data is empty).

[TestComplete] The test execution finished (PITA_Internal/C:\Users\Public\Install\pita-ui-automation-projects\PITA_Internal\A-Account_Reset_Project\A-Account_Reset_Project.mds).

Build step 'TestComplete Test' changed build result to UNSTABLE

Finished: UNSTABLE

 

 

Looks like it’s failing because of not creating a User Session. I have configured my workstation accordingly. Only thing that's missing in Jenkin step is creating a node and cofiguring Jenkins slave agent runs as a service. 

Is this a required step to run freestyle job on the server locally?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Unable to create a user session - Error in Jenkins

Thank you Alex, this is a great detailed answer.

 

@Nikolayev I checked your support case and see that the tests are running normally for you. Here's the article with requirements that need to be met: 

https://support.smartbear.com/testcomplete/docs/working-with/integration/jenkins/requirements-and-li...


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

13 REPLIES 13
Highlighted
Community Leader

Re: Unable to create a user session - Error in Jenkins

Hi,


Yesterday i had the same error working with Jenkins and we notice that we needed to configure Jenkins slave exactly on the user You are trying to use with Jenkins slave service.


So, did you configure the Jenkins slave on the user which You are trying to use with Jenkins?

 

Ore there is a few configure checboxes to set up before run slave job, like "use active session" etc.

Highlighted
Community Hero

Re: Unable to create a user session - Error in Jenkins

Hi,

 

https://support.smartbear.com/testcomplete/docs/working-with/automating/session-creator/index.html might help as well.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Community Manager

Re: Unable to create a user session - Error in Jenkins

Thanks for your suggestions, AlexKaras, Wamboo.

 

@Shehnaz, do the suggestions help you resolve the issue?

 

 

 

 

 
---------
Tanya Gorbunova
SmartBear Community Manager

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
Occasional Contributor

Re: Unable to create a user session - Error in Jenkins


Hi @Shehnaz 

I have the same Error message.

I didn't find answer on community so I recently open a case to the smartbear Support Team.


Our Jenkins Master is based on another server, that seems to be the only difference with you issue.

 

My Agent si installed as a service
His name is : jenkinsslave-G__jenkins_workspace

The windows service is set to run as "local service account" with "allow service to interact with desktop" checked.

I launch my tests and I have the Jenkins message ending with :

[TestComplete] Test runner exit code: -10 (Unable to create a user session).
... [TestComplete] Marking the build as FAILED.

 

Did you find a solution ?

Highlighted
Occasional Contributor

Re: Unable to create a user session - Error in Jenkins

...  @Shehnaz    Ho   ..  I see that after my first answer : the user name is empy in your Jenkins Job   "  /lName: "" . Maybe you remove  it voluntarily ?

Highlighted
Community Hero

Re: Unable to create a user session - Error in Jenkins

Hi,

 

service is set to run as "local service account" with "allow service to interact with desktop" checked.

To my knowledge, this setting allows service to display message boxes visible on the current desktop, but does not make service capable to create interactive user session.

The best solution (if not the only possible one) is to set Jenkins slave to run as an application within the user session. (Yes, you must ensure session's existence first.)

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Community Manager

Re: Unable to create a user session - Error in Jenkins

Hi @Nikolayev, have you tried what Alex is suggesting?


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
Occasional Contributor

Re: Unable to create a user session - Error in Jenkins

Hi Alex, Thank you for this.

 

" .... set Jenkins slave to run as an application within the user session".

I need to understand what you mean regarding what it is possible to do with Windows Server 2016.

Actually, the slave Jenkins node is set to use a Windows Service called "jenkinsslave-G__jenkins_workspace" 

It don't works so you mean that I can try  another way to call what  "jenkinsslave-G__jenkins_workspace" do ?

 

You mean I have to create a application called "jenkinsslave-G__jenkins_workspace"  with the JAR.

And then launch it on the server ?

how can I launch this if no user session is open ?  

 

turn 

 

 

 

Actually, the slave Jenkins node is set to use a Windows Service called "jenkinsslave-G__jenkins_workspace" 

 

 

 

Highlighted
Community Hero

Re: Unable to create a user session - Error in Jenkins

Hi,

 

how can I launch this if no user session is open ?  

Well...

-- In order for TestComplete (TestExecute, QTP, even Selenium) to be able to interact with the GUI of the tested application, this tested application must render its UI;

-- In order for the Windows application to be able to render its UI, it must have a desktop assigned to it;

-- In order for the application to have a desktop assigned to it, some user must be logged-in interactively and have active not locked user session.

 

So, if no user is logged-on interactively, there will be no active user session, there will be no desktop and the application started on behalf of this user (or any system account that does not have active user session with the desktop either) will not be able to render its UI. Thus test automation software will not be able to drive application's UI just because it is absent. Point.

 

For the GUI applications, slave Jenkins setup is usually like this:

-- slave box is configured to login automatically under some dedicated user;

-- This ensures active not locked user's session with desktop;

-- Scheduled task is set up to start Jenkins slave application on user logon;

-- This ensures that a) Jenkins master will be able to communicate with the slave; and b) that the application (TestComplete in our case) will be started by the slave within this user session;

-- Then TestComplete starts the tested application (again, within the user session that has desktop assigned), tested application obtains desktop where it can render its UI and thus TestComplete gets a possibility to drive the tested application via UI.

 

Impossibility to render UI if no desktop is assigned to user session is fundamental Windows OS behavior but not a limitation of TestComplete.

 

https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+agent+machines+on+Wi...

https://support.smartbear.com/testcomplete/docs/working-with/integration/jenkins/preparing.html

might help.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!

Retrieve Data from a Web Page

Participate!
Top Kudoed Authors