THE BLOGS

Ionic Applications

Testing of Ionic Applications

Testing, similar to documentation, leaves most developers with one of two reactions: they either cherish it or they abhor it. Regardless of whether you’re an obstinate promoter for putting your code through unit testing, persistent incorporation tests and ease of use testing (to give some examples more elevated amount approaches that may be taken) or just a designer who hurls in a couple of support logs all over as an absolute minimum for testing there’s no getting away from the way that your code should be tried.

Presently, since we really have something to take a gander at, we have to discuss the testing and advancement process for our application. There are four different ways to test your application as you create: in a work area WebKit program, in the iOS or Android test system, in a mobile browser on your phone, or as a native application on the phone.

Desktop browser testing

Ionic developers can benefit from using these browser tools by running ionic projects with the following Ionic CLI command:

$ ionic serve

This will at that point dispatch that ionic undertaking in their system browser enabling the code to be broken down utilizing any of the beforehand said program highlights, for example, Timelines, Debugger or the Console for instance. This will begin a live-reload server for your task. At the point when changes are made to any HTML, CSS, or JavaScript documents, the program will naturally reload when the records are spared. The main drawback of program testing is that you WON’T have the capacity to run Ionic Native/Apache Cordova modules inside a browser environment.

Mobile browser testing

You can likewise test the application straightforwardly in a mobile browser. For OS X clients, Safari on OS X can specifically troubleshoot sites and test system applications. First, you need to empower the remote web examiner on both the gadget and Safari on the work area. To do this with iOS 7 and OS X Mavericks, empower the Web Inspector choice in the iOS Settings – > Safari – > Advanced area, and furthermore empower the Developer Menu in the Advanced segment of the Safari OS X settings.

Console logs

The Console API provides a number of methods that allow developers to test their code in the following ways:

  •    Inspect variables and values by logging those to the screen
  •    Explore the structure and content of multidimensional arrays, maps and similar complex objects in JavaScript/TypeScript
  •    Perform benchmark tests for code execution/performance

Simulator testing

You can also test right in the simulator using the Cordova commands from the previous chapter. For example, to test in the iOS simulator, run:

$ ionic Cordova build ios

$ ionic Cordova emulate ios

Substitute iOS with Android for Android testing. In the event that you need to get propelled, you can likewise open up the undertaking record for a particular stage by opening the required Xcode or Android Eclipse venture in stages/PLATFORM inside the base of your task. At that point, you can fabricate and test from inside the stage particular IDE.

Ionic CLI

When it comes to publishing/running our projects the Ionic CLI, by default, tests our codebase for transpiration errors/warnings such as:

  •    incorrect information composes affirmations
  •    missing suppliers/segments/funnels
  •    access infringement on properties/techniques
  •    duplicate properties/techniques/factors
  •    unused properties
  •    constructor statement mistakes

Despite the fact that it’s baffling to see the framework terminal showing CLI blunders when endeavoring to assemble/run ionic undertakings it’s a gigantic help over the long haul.

Thus, we can include the – verbose banner to perceive what is going on at each phase of an ionic form process like so:

ionic Cordova build ios –prod –verbose

This is useful where we might encounter build related errors as a result of software environment-related issues rather than problems with the code we have written.

 

 

Posted By :Pace Wisdom