最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Testing NativeScript app with Appium - Stack Overflow

programmeradmin2浏览0评论

I am learning NativeScript. I am trying to write some automated tests with Jasmine. From my understanding, I can use Appium with Jasmine to run automated tests in the emulator. At this time, I've added the appium-gulp-plugins to my package.son file. I also have a basic JavaScript file with a single test. That file looks like this:

describe('MyApp', function() {
  describe('Login', function() {
    it('should successfuly login', function() {
      // set username field value
      // set password field value
      // click "login" button.
      // get response.
      expect(true).toBe(true);
    });           
  });        
});

I have two challenges:

  1. How do I interact with the NativeScript view from the test?
  2. How do I actually run the tests? As it is right now, its just straight up Jasmine, so I can do the following:

    gulp.src('./path/to/tests.js').pipe(jasmine());
    

However, with Appium in the mix, I'm not sure how to integrate it as part of running my tests.

I am learning NativeScript. I am trying to write some automated tests with Jasmine. From my understanding, I can use Appium with Jasmine to run automated tests in the emulator. At this time, I've added the appium-gulp-plugins to my package.son file. I also have a basic JavaScript file with a single test. That file looks like this:

describe('MyApp', function() {
  describe('Login', function() {
    it('should successfuly login', function() {
      // set username field value
      // set password field value
      // click "login" button.
      // get response.
      expect(true).toBe(true);
    });           
  });        
});

I have two challenges:

  1. How do I interact with the NativeScript view from the test?
  2. How do I actually run the tests? As it is right now, its just straight up Jasmine, so I can do the following:

    gulp.src('./path/to/tests.js').pipe(jasmine());
    

However, with Appium in the mix, I'm not sure how to integrate it as part of running my tests.

Share Improve this question edited Nov 10, 2015 at 21:46 Zakaria Acharki 67.5k15 gold badges78 silver badges105 bronze badges asked Jul 20, 2015 at 1:30 user70192user70192 14.2k53 gold badges166 silver badges243 bronze badges 1
  • 2 It looks like you can't: github.com/NativeScript/NativeScript/issues/553 – sailens Commented Sep 30, 2015 at 10:41
Add a comment  | 

2 Answers 2

Reset to default 6

Part-1 : Views are created using xml which must have attributes like text,name,css etc. These are accessible using methods like By.name,By.cssSelector etc. depending on the attributes provided during development.

Part-2 : I believe since Appium was built on selenium initially and supports majority of its functionality. You can go ahead and try something similar to this and you can provide action to your suite accessing the objects as in Part-1. To run the tests created would require similar efforts to run your main test script.

Look this closed issue at github: https://github.com/NativeScript/NativeScript/issues/553

You don't have access to internals of your app :( (when you use appium for tests, but why you don't take a look in KIF, you access elements by using accessibility label or accessibility identifier, it's more simple. Hope helps :)

发布评论

评论列表(0)

  1. 暂无评论