How to Test RPC project With a Mock Session

In the following guide, you will learn how to test an RPC project using a mock session.

 

  1. Create an RPC project.

  2. While generating the entity, check the Generate JSON Mock Data checkbox.

3. Go to src/test/resources/trails/ {entityName}.trail.

4. Open {entityName}.trail and edit it as you wish.

For example:

5. Move the trail file into src/resources/trails.

6. Edit the application.yml.

Add the following properties to the application.yml:

live: false # When live is false, we go to mock-properties to use a mock backend. mock: # Mock properties for RPC trail-path: trails/{EntityName}.trail # trail path verify-send: false # When working in liveSession false it indicates whether to compare input.

The SDK’s application YAML should look like:

ol: h3270: project: mfScreens: base-packages: - com.mf_screens.openlegacy hostname: mainframe.company.com port: 23 code-page: 37 model: 2 ssl-type: # Use for MainFrame additional settings: http://x3270.bgp.nu/Unix/s3270-man.html additional-params: -xrm ws3270.unlockDelay:false live: false # When live is false, we go to mock-properties to use a mock backend. mock: # Mock properties for RPC trail-path: trails/{EntityName}.trail # trail path verify-send: false # When working in liveSession false it indicates whether to compare input.

 

Now you can test your app with a mock session.