0

Now I am trying to unit test the a simple Phonegap application. Especially, I want to test the vibration function in this application. This issue is described here.

In the proposed solution, vibration event is written to the Chrome's log by calling console.log(). In order to write unit test, I want to parse Chrome's log after that. Is it possible to do that from JavaScript?

In this reference question, the content of log is written to disk first. I also wonder if it is possible to read the log without saving it to disk.

2
  • why dont you do your unit testing with QUnit ? Commented Jan 25, 2013 at 8:10
  • 1
    Thanks for your replying. I decided to use QUnit to test the javascript part of Phonegap application. It works. But I also want to test the GUI part of it, e.g. text field. The problem is that I create a new html(it will be run in Chrome) for testing, while the text field is located in index.html which is used by phonegap(it will be run in emulator). Do you have any idea how to test the DOM in this scenario? Commented Jan 30, 2013 at 21:32

1 Answer 1

2

My answer in the referenced question gave you a way to log to the console, but you could replace that logic in the abstraction with anything you want. You can add the vibration events to a dictionary or an array and then process those values later.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Kevin! Could you please check the comment I added to the question?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.