Skip to content
/ iQuery Public
forked from vowei/iQuery

A general test framework to query UI control on mobile platforms.It is released under GPL v3.

Notifications You must be signed in to change notification settings

k4124k/iQuery

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iQuery is a ui control query library, currently supports for iOS and Android UI automation are implemented.

iOS usage

iQuery for iOS is based on instrument, object-c version is not available yet, however, since it is based on antlr, it can be extended to object-c version quite easily.

To use iquery in your instrument test cases, follow below steps:

  1. import iquery.js in your test case.

    #import "iquery.js";

  2. And then you can use iQuery in your code.

  3. iquery.js contains a simplified unit test framework with it. If you want to use iQuery with your own test framework. you can remove the test framework's code in common.js.

Below is a sample usage, for detailed usage, please read the test sources: https://github.com/vowei/iQuery/blob/master/iOS/sampleTest.js :

 var target = UIATarget.localTarget(); 
 var root = target.frontMostApp().mainWindow();
 var assert = new Assert();
 var result = root.$("UIAWindow > UIASegmentedControl > UIAButton :eq(0) + UIAButton");
 assert.Equals(1, result.length);

Android usage

iQuery for android supports instrument test cases, and query text from hierarchyviewer output.

Below are steps required for use iQuery in instrument test cases:

  1. Create an android unit test project, you may include [robotium] (https://code.google.com/p/robotium/) in the project.
  2. Include antlr-runtime-3.4.jar, iQA.Runtime.jar and iQA.Runtime.Instrument.jar in your project's build path.

Import antlr and iQuery packages in your code:

 import org.antlr.runtime.*;
 import cc.iqa.iquery.*;
 import cc.iqa.iquery.android.*;

And use it:

List<SoloTreeNode> result = iQuery.query(new SoloTreeNode(
    _solo.getCurrentViews().get(0)), 
    "LinearLayout >> TextView [mText = 'Down Under']");
  1. If an invalid query is given, iQuery.query will throw a iQueryParserException object, you can get details errors by calling e.getErrors() - the errors message are Chinese. :(

for detailed usage, please read the test sources: https://github.com/vowei/iQuery/blob/master/java/Test/iQA.Runtime.Test/src/cc/iqa/iquery/test/iQueryParserTest.java

About

A general test framework to query UI control on mobile platforms.It is released under GPL v3.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published