[TechCorner Challenge #17] Get a full Raw JMS request
Hello Сommunity! Check out this new TechCorener task! Participation rules and the TechCorner Leaderboard can be found here. When sending long JMS messages, they might be shown truncated on the Raw Request and Response tabs in ReadyAPI: Task: Write a script for RequestFilter.filterRequest event handler to get the full Raw JMS Request message. Difficulty: Here is a sample of a JMS body: { "feild1":"IT", "feild2":" accepted", "feild3":"Test_accepted", "feild4":"000-111-222", "feild5":" data3", "feild6": " data4", "feild7": " data5" } Best of luck, friends!😊 A tip: You should be able to get a full response using this piece of code: def request = testRunner.getTestCase().getTestStepByName("JMS_TestSTep_Name").getRequestStep().getTestRequest() def fullJmsMessage = request.getResponse().getMessageReceive().getText()1.2KViews0likes0Comments[TechCorner Challenge #16] Compare an expected JSON value and actual response in Events
Hello ReadyAPI Сommunity! We are bringing more awesome tasks your way🙂Check out the participation rules and the TechCorner Leaderboard here. In this task, we will have a scenario where you will be comparing an expected JSON value from your Data Source and the actual JSON response. This can be done in a separate Groovy Script test step or in the Script assertion but for this task, we are asking you to do so in the RequestFilter.afterRequest event. Task: Compare an expected JSON and actual response in the event Difficulty: In your script, you will be fetching the expected response from your Data Source and your JSON response, and then, parsing the JSON to compare their values. JSON response example Expected JSON value (stored in the DataSource test step) { "id": 1111, "name": "doggie", "photoUrls": [ "string" ], "tags": [ { "id": 99, "name": "string", "Additional info": [ { "ad1": "string", "ad2": "string" } ] } ], "status": "available" } { "id": 1111, "category": { "id": 0, "name": "string" }, "name": "doggie", "photoUrls": [ "string" ], "tags": [ { "id": 99, "name": "string" } ], "status": "available" } Here's hint:https://smartbear-cc.force.com/portal/KbArticleViewer?name=How-Do-I-Compare-Two-Dynamic-JSON-Responses&sp=all1.3KViews0likes1Comment[TechCorner Challenge #15] Fetch a value/data from a JSON response using a Groovy Script
Hello ReadyAPI Community! We have another task for you to put your ReadyAPI knowledge to the test. Check out the participation rules and the TechCornerLeaderboardhere. In this task, we will have a scenario in which you need to iterate throughout a JSON response to find a specific item/value from it. You should stop once the value has been found. Task: Find a specific value in a JSON response using a Groovy script Difficulty: Here is what your script should do: 1. Iterate through all the test steps in a test case that have JSON responses. 2. Compare the value given (VeryImportantString) with all the values in the JSON response. 3. Once the value is found, return it. If there is no such value in the response, return “The value wasn’t found“. JSON response example: { "id": 1111, "name": "doggie", "photoUrls": [ "string" ], "tags": [ { "id": 99, "name": "string", "Additional info": [ { "ad1": "VeryImportantString", "ad2": "NoteVeryImportantString" } ] } ], "status": "available" } Helpful Tips: Iteration Sample Code: def TesCaselist=context.testCase.testSuite.getTestCaseList() TesCaselist.each{ def steps=it.getTestStepList(); //'it' is used for referring to current item steps.each{ (CHECK SMTH)? <DO SMTH>:<DO SMTH ELSE> } Good luck!Solved5.3KViews0likes5Comments[TechCorner Challenge #14] Filtering data retrieved from a DataSource
Hi ReadyAPI Community! We’ve prepared an interesting task for you to solve today! Check out the participation rules and the TechCornerLeaderboard here. Imagine that you are working with an app for setting up online conferences, and you need to filter data based on certain criteria. In our case - the location of an online conference participant. Task: Create a script that will filter data retrieved from a DataSource Difficulty: Here’s what your script should do: 1. Take an item in a DataSourse and check if it matches the criteria. 2. If it does, run the test. If it doesn't - skip the item. The Excel file to be used as a DataSource is attached below. Condition: Run the test only when participants of an online user conference are located in Boston. Resources: Here are some examples of working with DataSources in Groovy scripts:https://support.smartbear.com/readyapi/docs/testing/scripts/samples/data.html The full description of the class - here you can find all the properties and methods that the class has: https://support.smartbear.com/readyapi/apidocs/pro/DefaultPackage/WsdlDataSourceTestStep.html Good luck!Solved4.1KViews0likes7Comments[TechCorner Challenge #13] - Call Database Connection Using Groovy Script
Hello ReadyAPI Community! We have returned with a task for you to attempt. See the participation rules and the TechCornerLeaderboard here. Participate in the challenge and earn new unique badges! Check out some of these awesome rewards: In this week’s task, we will be having you use scripting to connect to a database. Task: Create a Groovy script that will connect to a database Difficulty: Steps to follow: 1.Create a database connection using the ReadyAPI interface. 2. From your script, call the database connection, connect to the database, and return a success message on a successful connection to the database. Good Luck!Solved3.6KViews0likes6Comments[TechCornerChallenge #12] A script to get data from Petstore and add it to Excel sheets
Hello ReadyAPI Сommunity! We have another task for you to put your ReadyAPI knowledge to the test. Check out the participation rules and the TechCornerLeaderboard here. In this task, we will be having you use Groovy DataSink to write results from a data source to a file. Task: Write a Groovy script that will take data from Swagger Petstore and add them to different excel sheets Difficulty: Exporting the results to one file can be done easily, but, sometimes, you need to sort data to different sheets inside it or to separate files. From the request, put the IDs of cats in one or sheet of an Excel table, the IDs of dogs in another, all the rest should go to the third one ("Others"). Bonus: You can gain an additional point if you create two scripts: 1) for putting data into separate Excel sheets within one file and 2) into separate Excel files. The best of luck to all participants🙂2.2KViews0likes5Comments[TechCorner Challenge #11] Change Socket Timeout for HTTP requests using Groovy Script
Hi Community!🙂 Here's a new task for you to practice your skills of using the ReadyAPI tool. Check out the participation rules and TechCornerLeaderboard here. ReaydAPI allows you to set a global socket timeout value for HTTP requests through its preferences, however, there are times where this is not enough. Some specific requests may require a different value to better suit your expectations for the test. In these cases, you can use a Groovy script to change the socket timeout value then change it back to its original value. Task: Write a Groovy Script that will set socket timeout to a new value, then return it to the default value. Difficulty: Good luck😊Solved2.4KViews1like3Comments[TechCorner Challenge #8] How to Clear Cookies in API Request
Hello Community! I am back with another interesting task for you. Here is the task: create a Groovy script that will clear the cookies that are sent with the request. Difficulty: Assume that you have a TestCase in ReadyAPI with several test steps and for some of them, you need to maintain the HTTP session, i.e. to send the Cookie HTTP header. You can achieve this task by using the Maintain HTTP session option of the TestCase. But, for other requests in your Test Case, cookies cause failure. In this case, you may need a script that will remove the Cookie header for these test steps. For example, you have the following configuration of your ReadyAPI test: You need to write a script that will remove the cookies only for the “Login Server 2” and “Get Info Server 2” test steps. Note that there could be several or zero Cookie headers in the requests. Expected Task Results:the implementation of this task requires a Groovy script to be created. Tip:Working With Headers Good luck!Solved6.3KViews0likes17Comments[TechCorner Challenge #10] Connecting to JMS using Groovy script
Hi Community! The TechCorner Challenge continues. You can put your skills to the test and learn something new about the tool, as well as bring more valuable content to the ReadyAPI Community! And, those who complete tasks, will get into the Leaderboard. This week's task: Sometimes, the JMS test step doesn’t suit you since you might have custom JMS settings, or you need to add additional logic before or after sending/receiving a JMS message. In this case, you can use Groovy scripts. So, try writing a sample script to connect to JMS that can be used as a basis for further customization. Task: write a script for the Groovy Script test step which creates a connection to a JMS provider (ActiveMQ, WebSphere or another), sends a JMS message to the “Test“ queue, and shows all messages in this queue. Difficulty: Notes: use the manual connection, not the HermesJMS session. Check out the TechCornerLeaderboardand detailed participation rules here. Good luck, as always!Solved5.4KViews0likes9Comments[TechCorner Challenge #9] A script to include custom details to the report
Hi ReadyAPI Community! I bring more challenges 🙂 If you have the "Complete error logs" option enabled, the printable report includes the Raw request and Raw response for the failed test steps. But, you may need to get this info for passed test steps, as well. Currently, there is no built-in option in ReadyAPI to show raw request and response of passed test steps in the printable (Jasper) report. Task:Write a Groovy script for the "TestRunListener.afterStep"event that will post the raw request URL and the full raw response to the printable report. Difficulty: Here is an example: 💡Hint:https://community.smartbear.com/t5/SoapUI-Pro/TechCorner-Challenge-9-A-script-to-include-custom-details-to-the/m-p/205242/thread-id/46875 Check out the TechCornerLeaderboard here. Good luck😊Solved4.4KViews0likes7Comments