[TechCorner Challenge #8] Finding Elements on a Web Page
Hi TestComplete Community! Today, I bring you a new TechCorner Challenge task 🙂 By completing the tasks, you will not only learn TestComplete features but also get into the TechCorner Leaderboard. Today we will use the Leaderboard table itself to sharpen your skills! Let’s use TestComplete to find out if a user is on the table and how many points they gained so far! Task: Create a TestComplete script that will go to theLeaderboard page, search for yourself (by your user name) and a user named tristaanogre in the table and, if this user is mentioned on the Leaderboard, post their score to the log. Can you compete with people in the Leaderboard?😊 Difficulty: Tip: You can useFindChildorFindElementin your script. Note: You will need a Web Module to fulfill this task. Good luck!Solved13KViews2likes7Comments[TechCorner Challenge #9] Generate a random number within a range
Hi Community! Another awesome task is ready🙂 By completing the task, you will not only learn TestComplete features but also get into the TechCorner Leaderboard. Participate in the challenge and earn new unique badges! Check out some of these awesome rewards: Let's imagine that you are testing an application that has gaming elements - a knight is using a legendary sword to slay a dragon! And, the sword will deliver damage in the following range - from 30 to 75. Instead of using the same number every time, you want to generate a random number on each run and enter it in the application. How would you do it in TestComplete? Let's see if we can get an example for each scripting language (JavaScript, JScript, Python, VBScript)! Task: Generate a random number within the following range (30-75) in TestComplete using a scripting language of your choice. Difficulty: Bonus: You will get an additional point for each script written in a different language. Best of luck!Solved11KViews1like10Comments[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.1KViews0likes17Comments[TechCorner Challenge #11] Converting UTC TimeDate in an Excel file
Hi everyone! Up for a challenge? By completing the tasks, you can practice your skills of working with TestComplete features and also get into the TechCorner Leaderboard! Today, we are going to work with UTC DateTime stored in an Excel file. Task: Read the UTC DateTime in an Excel file (attached), convert the value for the PST (Pacific StandardTime) time zone and log each date in the following format: <month name> <day of month>, <full weekday name>. For example: September 8, Tuesday. Difficulty: Note: Find the Excel file attached. Steps to do this: 1. Read the dates from the Excel file using one of the approaches described in Working with Microsoft Excel Files. 2. Convert the dates using the aqDateTime object methods. 3. Log the date using the aqConvert.DateTimeToFormatStr method. Best of luck to all participants!Solved5.6KViews0likes8Comments[TechCorner Challenge #7] Change an XPath Match assertion to a JSONPath Match assertion
Imagine that the logic of the server has been changed and you started getting responses from the server in the JSON format instead of XML. And, it may appear that XMLPath assertions don’t suit you anymore. In this case, you need to convert all XPath Match assertions to JSONPath Match assertions in your project. There could be a lot of test steps to change, so it’s better to automate this process. Task: Create a script to convert XPath Match assertion to JSONPath Match assertion for the REST test steps where the request URL is the following: https://example.com/test. Difficulty: A script should do this: 1. Add the JSONPath Match assertion to REST test steps that have the https://example.com/test endpoint. 2. Convert the XPath expression and expected result from the XPath Match assertion to the JSONPath expression and expected result for the corresponding test steps. 3. Remove the XPath Match assertions for those test steps. A sample response: JSON XML { "id": 1111, "category": { "id": 0, "name": "string" }, "name": "doggie", "photoUrls": [ "string" ], "tags": [ { "id": 99, "name": "string" } ], "status": "available" } <Response xmlns="https://petstore.swagger.io/v2/pet"> <id>1111</id> <category> <id>0</id> <name>string</name> </category> <name>doggie</name> <photoUrls> <e>string</e> </photoUrls> <tags> <e> <id>99</id> <name>string</name> </e> </tags> <status>available</status> </Response> XMLPath Match assertions example: Condition: declare namespace ns1='https://petstore.swagger.io/v2/pet'; //ns1:Response[1]/ns1:tags[1]/ns1:e[1]/ns1:id[1] Expected result: ${#TestCase#ID} Tips: https://support.smartbear.com/readyapi/docs/soapui/steps/groovy.html#working-with https://support.smartbear.com/readyapi/apidocs/soapui/DefaultPackage/XPathContainsAssertion.html https://support.smartbear.com/readyapi/apidocs/pro/DefaultPackage/JsonPathContentAssertion.html Good luck and have fun😊Solved5.4KViews0likes10Comments[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.3KViews0likes9Comments[TechCorner Challenge #1] Passing custom command-line arguments as test parameter
Hi Community! This resource we are creating together has gained so much value over the years. Tons of helpful content can be found in the TestComplete Community thanks to all of you! I propose that we take it to the next level by adding even more useful things to the TechCorner tag - a tag where we keep your tech articles, script examples, use cases, etc. Here's your chance to share expertise and contribute. Task:Write a script that will take the value of a custom argument from the TC command line and use this value to run a parameterized test. Difficulty: For example, imagine that you have a web test that takes the name of the browser as a parameter. The script should check the command line TC was launched with, find the /BrowserName parameter, read its value, and pass it to the web test as a parameter. If the command line contains /BrowserName=chrome, the web test should launch Chrome; for /BrowserName=firefox the web test should launch Firefox, etc. Good luck!Solved5.3KViews3likes7Comments[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.1KViews0likes5Comments[TechCorner Challenge #1] How to add a new tag and assign it to all TestCases in a TestSuite?
Hi Community! As you know, we have aTechCorner label, a place where tons of useful information about ReadyAPI is stored. We would like to make this section even bigger. I would like to encourage you to share more great content with all ReadyAPI community members under this label: use cases, tips, scripts, script templates, all the helpful things you are using in your daily testing with ReadyAPI. Here’s one request that we get a lot from users,that you can help with: Create a script, that can add a newtagand then assign it to every TestCases in a TestSuite Difficulty: A link that will help you choose the right methods ofworking with tags at the TestCase level. Tags are a neat feature of ReadyAPI, they help group TestCases and give more control over the testing process. This script is going to be very useful for ReadyAPI users. Who will contribute?🙂Solved5.1KViews0likes10Comments[TechCorner Challenge #6] - Compare HTML table with Excel file and correct data in Excel file
Hi TestComplete Community! Welcome to our weekly challenge where anyone can put their tool knowledge to the test! By completing the task, you will practice your TestComplete skills, learn new things about working with the product, and get into the TechCorner Leaderboard! Check out this week’s task: Since working with HTML tables and Excel files is quite common when working with TestComplete, here’s one more task connected to this topic. Task: Create a script to compare an HTML table with an Excel file and correct the data in the Excel file. Difficulty: So, when the script encounters an HTML table cell, the value of which is different from the value of the corresponding Excel table cell, the Excel cell value should be changed to what’s actually shown in the table. Resources: - The HMTL table can be found here - Web Orders table. - The Excel file is attached below. Steps to follow to fulfill this task: 1. Parse the Orders table. 2. Save the table to the variable. 3. Working with Microsoft Excel Files - here you can choose the right way to extract data from the Excel file (TestComplete 14.50 users, check out thenew Excel support- it does not require Excel to be installed on your machine). 4. Using a loop in the script, compare the table variable and Excel content cell-by-cell. 5. If the value in the Excel cell is different from the HTML table cell, it should be replaced with what’s shown in the table. Good luck! P.S. You can find the TechCorner Leaderboard and the rules of how to participate in the TechCorner Challenge by this link.4.4KViews0likes4Comments