Sencha Ext JS 7.7 is Here – Discover What’s New and Exciting – LEARN MORE

Sencha Test Tips for June 2017

July 13, 2017 151 Views
Show

Our Sencha Test Tips provide you with a variety of best practices and tips and tricks, so you can get up to speed quickly on using Sencha Test. Our topics for June included:

  • How to Execute Tests with TeamCity
  • How to Test IFrames Using Sencha Test API

Sign up now to receive the Sencha Test Tips emails.

Tip #1: How to Execute Tests with TeamCity

Prerequisites:

  • TeamCity is being used in your organization
  • You are able to successfully run tests from the command line using the Sencha Test Command (STC) utilities provided with the Sencha Test installation

Steps:

Sencha Test Tips - How to Execute Tests with TeamCity

  1. Navigate to an existing TeamCity project or create a new project (SenchaWebinar)
  2. Create a new build configuration (RegressionTests)
  3. In the new configuration, create a new build step and select the command line option
  4. Select custom script option from the available selection
  5. Enter the stc run command that you have used to execute tests from the command line along with all the valid parameters
    1. Sample: stc run -o teamcity -p “nameofbrowserpool” -s /pathtoscenario/ -S http://localhost:1903 -K teamcitytest -n %env.BUILD_NUMBER%
      1. -o – output will be generated in a format that TeamCity understands and results are published in TeamCity
      2. -p – you can use the embedded browser/Selenium combination (“Embedded”) or provide the name of the remote browser pool
      3. -s – provide the path of the scenario. If you are not running TeamCity on a local machine, make sure TeamCity downloads the scenario and pool information onto the build server and the correct location is being configured in the stc parameters
      4. -S – if you have an archive server set up, provide the archive server details (it is usually http://:1903
      5. -K – a key that has been set up for the results folder
      6. -n – choose the build parameter value provided by TeamCity
  6. Run the configuration and check the results in TeamCity once the build has finished test execution

Sencha Test Tips - Run the Config & Check Results in TeamCity

To learn more, watch the webinar recording, Best Practices for Implementing Continuous Web App Testing, which features TeamCity.


Tip #2: How to Test IFrames Using Sencha Test APIs

Sencha Test has a rich set of APIs that allows you to test Ext JS applications with minimal code. To test pages that have IFrames, you can use one of the APIs ‘ST.defaultContext.driver’ and leverage the API methods of WebDriverIO that is integrated with Sencha Test.

This example shows how to use the WebDriverIO API and Sencha Test APIs to test IFrames.

Test Code

Go to this GitHub repo to get the test code, and follow these steps to add the new test as a separate Scenario and a Jasmine Suite in the existing workspace.

  1. Using Sencha Studio, create a new Scenario
  2. In the advanced section, provide a name for the Scenario and select WebDriver under “Test Type”
  3. Input the URL for the IFrame sample page
  4. Add a new Jasmine Test Suite within the new Scenario
  5. Name the Suite IFrameTest.js
  6. Copy and paste the code into the editor from the GitHub file that you just downloaded

Now that the test code has been added to the workspace, it’s time to execute the test.

In the Test Runner, click on the Scenario name, select the Chrome browser and select and run the IFrameTest.

Next Steps

Download Sencha Test 2.1.1

We recently released Sencha Test 2.1.1. Here’s how to download it and get more information.

Get More Tips

Sign up now to receive the Sencha Test Tips emails. Share your feedback and questions in the Sencha Test forum.

Happy Testing!

coming soon

Something Awesome Is

COMING SOON!