Application Test Automation fails with "Caught Exception while creating OAuth2 client" on CreateCase step

Context:
I built a simple single-case-type application using Pega Blueprint, deployed it to DemoX, and wanted to try out Application Test Automation. All test cases were generated using the built-in Pega GenAI assistant (“Add Application Tests with AI”). The app’s Service Package (application, v2) requires OAuth 2.0 authentication.

What I’ve tried:

  1. Basic Auth Profile for the test persona → fails with 401 invalid_authorization_header (makes sense, since the Service Package needs OAuth 2.0, not Basic).
  2. Created an OAuth 2.0 Client Registration (Client Credentials grant, Access Group PlanChange:Users) and a matching OAuth 2.0 Authentication Profile.
  3. Verified the same Client ID/Secret work fine via a manual curl call to the token endpoint — returns a valid access token with the correct access group in the payload.
  4. Selected the new Authentication Profile in Configure Personas — test still fails, but now with Caught Exception while creating OAuth2 client (fails at client construction, not token exchange).
  5. Tried a different pre-existing profile (RoboticAutomationRequestorProfile) instead — got a plain 401 this time, suggesting that one’s OAuth2 client builds fine but isn’t authorized, while mine fails earlier, at construction.
  6. Confirmed via the test’s built-in Request/Response/Endpoint viewer that it’s specifically the CreateCase step failing, not the login step.

Question:
Since the manual curl test with identical credentials succeeds, what would cause Pega’s own OAuth2 client to fail at construction rather than at authorization? Is there a separate Global Test Data instance (Data-Test-Application-GlobalTestData) that needs its own OAuth2 configuration for GenAI-generated Application Tests, independent of the Authentication Profile picked in Configure Personas? If so, where is this normally set up?

I’d be curious to see the exception details from step 4, have you tried tracing or checking the logs? My first thought is there is something wrong with the Authentication Profile. You could try opening it up and saving it to trigger validation and verify that it’s good.

Same here. This seems to be a demoX issue connecting to its own token endpoint - the SSL handshake closes before any Auth happens:

2026-08-19 21:46:59,646 [ttp-nio-8080-exec-22] [TABTHREAD0] [                    ] [ DogWalking:01.01.01] (    connect.rest.RESTConnector) ERROR fa8537e54a224e50.pegademo.com|172.31.100.7 H9I20SBRPM3VQIPY6YGIOXM7ZJPB66UX0A [email protected] - Unable to complete interaction with remote resource: Caught Exception while creating OAuth2 client 
com.pega.pegarules.pub.services.OutboundMappingException: Caught Exception while creating OAuth2 client 
	at com.pega.pegarules.integration.engine.internal.connect.rest.ComponentsOAuth20HttpAuthScheme.fetchAccessToken(ComponentsOAuth20HttpAuthScheme.java:113) 
	at com.pega.pegarules.integration.engine.internal.connect.rest.ComponentsOAuth20HttpAuthScheme.setCredentials(ComponentsOAuth20HttpAuthScheme.java:127) 
	at com.pega.pegarules.integration.engine.internal.connect.rest.ComponentsOAuth20HttpAuthScheme.configure(ComponentsOAuth20HttpAuthScheme.java:300) 
	at com.pega.platform.integrationcore.client.http.internal.ComponentsHttpClient.applyAuthScheme(ComponentsHttpClient.java:440) 
	at com.pega.platform.integrationcore.client.http.internal.ComponentsHttpClient.applyAuthDetails(ComponentsHttpClient.java:464) 
	at com.pega.platform.integrationcore.client.http.internal.ComponentsHttpClient.createApacheRequest(ComponentsHttpClient.java:679) 
	at com.pega.platform.integrationcore.client.http.internal.ComponentsHttpClient.invokeHttpClient(ComponentsHttpClient.java:223) 
	at com.pega.pegarules.integration.engine.internal.connect.rest.RESTConnector.invokeREST(RESTConnector.java:2141) 
	at com.pega.pegarules.integration.engine.internal.connect.rest.RESTConnector.executeRequest(RESTConnector.java:2656) 
	at com.pega.pegarules.integration.engine.internal.connect.rest.RESTConnector.perform(RESTConnector.java:462) 
	at com.pega.pegarules.integration.engine.internal.connect.rest.RESTConnector.invoke(RESTConnector.java:281) 
	at com.pega.pegarules.integration.config.internal.connect.PRConnectorFactory.invokeConnector(PRConnectorFactory.java:95) 
	at com.pega.pegarules.integration.engine.internal.util.PRConnectorUtilsPriv.invokeConnector(PRConnectorUtilsPriv.java:174) 
	at com.pega.pegarules.session.internal.mgmt.Executable.invokeConnector(Executable.java:12452) 
	at com.pegarules.generated.activity.ra_action_pzexecuterestconnector_44f5fe978b3ce7b0a492df32c82116cc.step3_circum0(ra_action_pzexecuterestconnector_44f5fe978b3ce7b0a492df32c82116cc.java:371) 
	at com.pegarules.generated.activity.ra_action_pzexecuterestconnector_44f5fe978b3ce7b0a492df32c82116cc.perform(ra_action_pzexecuterestconnector_44f5fe978b3ce7b0a492df32c82116cc.java:126) 
	at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:2970) 
	at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:11738) 
	at com.pegarules.generated.activity.ra_action_pzexecuteapiautomationconnector_f4d572e5d0b61aef0504f43857215609.step1_circum0(ra_action_pzexecuteapiautomationconnector_f4d572e5d0b61aef0504f43857215609.java:175) 
	at com.pegarules.generated.activity.ra_action_pzexecuteapiautomationconnector_f4d572e5d0b61aef0504f43857215609.perform(ra_action_pzexecuteapiautomationconnector_f4d572e5d0b61aef0504f43857215609.java:78) 
	at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:2970) 
	at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:11738) 
	at com.pegarules.generated.activity.ra_action_pzexecuteapiautomationstep_aa951b2e82c496108209bd4c7d8c1050.step4_circum0(ra_action_pzexecuteapiautomationstep_aa951b2e82c496108209bd4c7d8c1050.java:451) 
	at com.pegarules.generated.activity.ra_action_pzexecuteapiautomationstep_aa951b2e82c496108209bd4c7d8c1050.perform(ra_action_pzexecuteapiautomationstep_aa951b2e82c496108209bd4c7d8c1050.java:136) 
	at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:2970) 
	at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:11738) 
	at com.pegarules.generated.activity.ra_action_pzexecuteapiautomationtest_e53ff0a6fa548e8b4566d284a0041d58.step5_8_3_circum0(ra_action_pzexecuteapiautomationtest_e53ff0a6fa548e8b4566d284a0041d58.java:1685) 
	at com.pegarules.generated.activity.ra_action_pzexecuteapiautomationtest_e53ff0a6fa548e8b4566d284a0041d58.step5_8_0_circum0(ra_action_pzexecuteapiautomationtest_e53ff0a6fa548e8b4566d284a0041d58.java:1341) 
	at com.pegarules.generated.activity.ra_action_pzexecuteapiautomationtest_e53ff0a6fa548e8b4566d284a0041d58.step5_0_circum0(ra_action_pzexecuteapiautomationtest_e53ff0a6fa548e8b4566d284a0041d58.java:771) 
	at com.pegarules.generated.activity.ra_action_pzexecuteapiautomationtest_e53ff0a6fa548e8b4566d284a0041d58.perform(ra_action_pzexecuteapiautomationtest_e53ff0a6fa548e8b4566d284a0041d58.java:187) 
	at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:2970) 
	at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:11738) 
	at com.pegarules.generated.activity.ra_action_pzexecuteapiautomationwrapper_8305864ea5367ecc4dae5335b7933795.step2_circum0(ra_action_pzexecuteapiautomationwrapper_8305864ea5367ecc4dae5335b7933795.java:310) 
	at com.pegarules.generated.activity.ra_action_pzexecuteapiautomationwrapper_8305864ea5367ecc4dae5335b7933795.perform(ra_action_pzexecuteapiautomationwrapper_8305864ea5367ecc4dae5335b7933795.java:103) 
	at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:2970) 
	at com.pegarules.generated.activity.ra_action_pzrunactionwrapper_ac0a72e05137ec84aaca914d5e95a645.step2_circum0(ra_action_pzrunactionwrapper_ac0a72e05137ec84aaca914d5e95a645.java:474) 
	at com.pegarules.generated.activity.ra_action_pzrunactionwrapper_ac0a72e05137ec84aaca914d5e95a645.perform(ra_action_pzrunactionwrapper_ac0a72e05137ec84aaca914d5e95a645.java:97) 
	at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:2970) 
	at com.pega.pegarules.session.internal.mgmt.base.ThreadRunner.runActivitiesAlt(ThreadRunner.java:653) 
	at com.pega.pegarules.session.internal.mgmt.PRThreadImpl.runActivitiesAlt(PRThreadImpl.java:535) 
	at com.pega.pegarules.session.internal.engineinterface.service.HttpAPI.runActivities(HttpAPI.java:4825) 
	at com.pega.pegarules.session.external.engineinterface.service.EngineAPI.processRequestInner(EngineAPI.java:469) 
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) 
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) 
	at com.pega.pegarules.session.internal.PRSessionProviderImpl.performTargetActionWithLock(PRSessionProviderImpl.java:1399) 
	at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:1131) 
	at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:985) 
	at com.pega.pegarules.session.external.engineinterface.service.EngineAPI.processRequest(EngineAPI.java:382) 
	at com.pega.pegarules.session.internal.engineinterface.service.HttpAPI.invoke(HttpAPI.java:1012) 
	at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl._invokeEngine_privact(EngineImpl.java:338) 
	at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl.invokeEngine(EngineImpl.java:282) 
	at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl.invokeEngine(EngineImpl.java:259) 
	at com.pega.pegarules.priv.context.JNDIEnvironment.invokeEngineInner(JNDIEnvironment.java:281) 
	at com.pega.pegarules.priv.context.JNDIEnvironment.invokeEngine(JNDIEnvironment.java:226) 
	at com.pega.pegarules.web.impl.WebStandardImpl.invokeEngine(WebStandardImpl.java:947) 
	at com.pega.pegarules.web.impl.WebStandardImpl.makeEtierRequest(WebStandardImpl.java:895) 
	at com.pega.pegarules.web.impl.WebStandardImpl.doPostInner(WebStandardImpl.java:502) 
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) 
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) 
	at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:418) 
	at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:460) 
	at com.pega.pegarules.boot.internal.extbridge.AppServerBridgeToPega.invokeMethodPropagatingThrowable(AppServerBridgeToPega.java:225) 
	at com.pega.pegarules.boot.internal.extbridge.AppServerBridgeToPega.invokeMethod(AppServerBridgeToPega.java:274) 
	at com.pega.pegarules.internal.web.servlet.WebStandardBoot.doPost(WebStandardBoot.java:164) 
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:590) 
	at com.pega.pegarules.internal.web.servlet.WebStandardBoot.service(WebStandardBoot.java:191) 
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) 
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197) 
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) 
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:57) 
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) 
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) 
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:165) 
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:88) 
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:534) 
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) 
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:86) 
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:782) 
	at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:773) 
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:72) 
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:348) 
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) 
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:71) 
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:1307) 
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:2032) 
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:74) 
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:976) 
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:494) 
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:80) 
	at java.base/java.lang.Thread.run(Thread.java:1583) 
Caused by: com.pega.pegarules.pub.PRRuntimeException: Unable to obtain access token for client details in authentication profile configured for connector. Please check the logs for more details. AuthProfile = DogWalkerTC_OAuth:  
	at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.getAccessTokenPage(OAuth2ClientImpl.java:549) 
	at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.getAccessToken(OAuth2ClientImpl.java:488) 
	at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.updateHttpRequestWithAccessToken(OAuth2ClientImpl.java:1618) 
	at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.updateHttpRequestWithAccessToken(OAuth2ClientImpl.java:1632) 
	at com.pega.pegarules.integration.engine.internal.connect.rest.ComponentsOAuth20HttpAuthScheme.fetchAccessToken(ComponentsOAuth20HttpAuthScheme.java:102) 
	... 89 more 
Caused by: com.pega.pegarules.pub.PRRuntimeException: PRRuntimeException 
	at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.invokeTokenEndpoint(OAuth2ClientImpl.java:1058) 
	at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.getTokensFromEndpoint(OAuth2ClientImpl.java:942) 
	at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.getAccessTokenFromEndpoint(OAuth2ClientImpl.java:903) 
	at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.checkTokenExpiryAndRenew(OAuth2ClientImpl.java:575) 
	at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.getAccessTokenPage(OAuth2ClientImpl.java:545) 
	... 93 more 
Caused by: java.lang.RuntimeException: javax.net.ssl.SSLProtocolException: (unexpected_message) Received close_notify during handshake 
	at com.pega.platform.integrationcore.client.http.internal.ComponentsHttpClient.invokeHttpClient(ComponentsHttpClient.java:235) 
	at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.invokeTokenEndpoint(OAuth2ClientImpl.java:1047) 
	... 97 more 
Caused by: javax.net.ssl.SSLProtocolException: (unexpected_message) Received close_notify during handshake 
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:128) 
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117) 
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:370) 
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:326) 
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:317) 
	at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:244) 
	at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:209) 
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172) 
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1505) 
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1420) 
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455) 
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426) 
	at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436) 
	at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384) 
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) 
	at org.apache.http.impl.conn.BasicHttpClientConnectionManager.connect(BasicHttpClientConnectionManager.java:313) 
	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393) 
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) 
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) 
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) 
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) 
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) 
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) 
	at com.pega.platform.integrationcore.client.http.internal.ComponentsHttpClient.executeHttpClient(ComponentsHttpClient.java:1093) 
	at com.pega.platform.integrationcore.client.http.internal.ComponentsHttpClient.invokeHttpClient(ComponentsHttpClient.java:227) 
	... 98 more 

hi Peter, we spent some time and figured out the solution. Apparently in the DemoX environment we have to set the min TLS to 1.2 in the Auth Profile. Thanks @MARIK1

Now I stuck at the next step of the test case :grinning_face:

Apparently in the DemoX environment we have to set the min TLS to 1.2 in the Auth Profile.

Then the first step passes: