All websites and applications, and I mean all, once delivered to the client — needs to be proven for performance standards. Performance orbenchmark testing is an always ongoing function of software quality assurance that extends throughout the life cycle of the project. To build standards into the architecture of a system — the stability and response time of an application is extensively tested by applying a load or stress to the system.
Essentially, ‘load’ speaks to the number of users using the application while ‘stability’ refers to the ability of the system to withstand the load created by the intended number of users,whereas ‘response time’ hints at the time taken to send a request, run the program, and receive a response from a server.
Testing can be a challenging ordeal, if a performance testing strategy is not predetermined. The tasks involved in testing requires multifaceted skill-sets from writing test scripts, monitoring and analyzing test results, to tweaking custom codes and scripts, and developing automated test scenarios for the actual testing.
So, is testing really necessary? An important outcome of quality testing is to ensure that the system is reliable, built for capacity and scalable. In order to achieve this, there are several stakeholders involved who decide how much budget needs to be invested based on business impact.
This brings to question — how do we predict traffic based on past trends? and how can we make the system more efficient to handle traffic without any dropouts? Also, if and when we hit peak loads, then how are we going to address the additional volume? For this, a performance testing strategy needs to be outlined beforehand.
When performance testing is done right, it..
1.Identifies issues early on, before they become too costly to resolve. 2.Reduces development cycles, produces better quality and more scalable code. 3.Prevents revenue and credibility loss due to poor web site performance.
4.Enables intelligent planning for future scaling. 5.Ensures that the system meets performance expectations (response time, throughput, etc.) under designed levels of load.
6.Exposes bugs that do not surface in cursory testing, such as memory management bugs, memory leaks, buffer overflows, etc.
More importantly, manual testing is usually not a preferred approach because it can be quite expensive, requiring large amounts of personnel and hardware, quite complex to co-ordinate and synchronise multiple testers, and repeatability is quite limited.
In order to find the stability and response time of each API, we can test different scenarios by varying the load at different time intervals on the application. We can then automate the application by using any performance testing tool.
Performance Testing Tools There are a varied bunch of tools available to testers, such as Open Source Tools — Open STA Diesel Test TestMaker Grinder LoadSim Jmeter Rubis. Commercial — LoadRunner Silk Performer Qengine Empirix e-Load.
Among these, the most commonly used tool is J-Mmeter because it is a 100% Java desktop application with a graphical interface that uses the Swing graphical API. It can therefore run on any environment / workstation that accepts a Java virtual machine, for example: Windows, Linux, Mac, etc.
We can automate the application by integrating the ‘selenium scripts’ in J-Meter tool. (The software that can perform load tests, performance-functional tests, regression tests, etc. on different technologies.)
If the project is large in scope and the number of users keeps increasing day-by-day then the load on the server side will be greater. In order to test such situations — Performance testing is used to identify at what point, will the application crash. To find the number of errors and warnings in the code, we use the J-meter tool.
How J-Meter Works J-Meter simulates a group of users sending requests to a target server, and returns statistics that show the performance/functionality of the target server/application via tables, graphs, etc.
Take a look at the following figure that depicts how J-Meter works:
The J-Meter performance testing tool can be used to find the performance of any application (no matter whatever the language used to build the project).
First, a test plan is needed – which describes a series of steps that the J-Meter will execute when run. A complete test plan will consist of one or more thread groups, samplers, logic controllers, listeners, timers, assertions and configuration elements.
The ‘thread’ group elements are the beginning of any test plan. Thread group element controls the number of threads, the J-Meter will use during the test run. We can also control the following via thread group: setting the number of threads, setting the ramp-up time, and setting the loop count. The number of threads implies the number of users to the server application, while ramp-up period defines the time taken by J-Meter to get all the threads running. Loop count identifies the number of times to execute the test.
Once the ‘thread’ group is created and we define the number of users, iterations and ramp-up time (or usage time), we can create virtual servers depending on the number of users defined in the thread group and start performing the action based on the parameters defined. Internally J-Meter will record all the results like response code, response time, throughput, latency, etc. and produces the results in the form of graphs, trees and tables.
The J-Meter has two types of controllers: Samplers and Logic controllers Samplers allow the J-Meter to send specific requests to a server, while the latter controls the order of processing of samplers in a thread. They can change the order of requests coming from any of their child elements. Listeners, are then used to view the results of samplers in the form of reporting tables, graphs, trees or simple text in some log files.
It is important to remember, performance testing should always be done by changing one parameter at a time, so that response and throughput metrics can be monitored and discrepancies corrected accordingly. The real purpose of testing is to ensure that the application or site is functional for businesses to deliver real value to their users — so test practically, and think like a real user.
Ratemaking, or insurance pricing, is the process of fixing the rates or premiums that insurers charge for their policies. In insurance parlance, a unit of insurance represents a certain monetary value of coverage. Insurance companies usually base these on risk factors such as gender, age, etc. The Rate is simply the price per ‘unit of insurance’ for each unit exposed to liability.
Typically, a unit of insurance (both in life and non-life) is equal to $1,000 worth of liability coverage. By that token, for 200 units of insurance purchased the liability coverage is $200,000. This value is the insurance ‘premium’. (This example is only to demonstrate the logic behind units of exposure, and is not an exact method for calculating premium value)
The cost of providing insurance coverage is actually unknown, which is why insurance rates are based on the predictions of future risk.
Actuaries work wherever risk is present
Actuarial skills help measure the probability and risk of future events by understanding the past. They accomplish this by using probability theory, statistical analysis, and financial mathematics to predict future financial scenarios.
Insurers rely on them, among other reasons, to determine the ‘gross premium’ value to collect from the customer that includes the premium amount (described earlier), a charge for covering losses and expenses (a fixture of any business) and a small margin of profit (to stay competitive). But insurers are also subject to regulations that limit how much they can actually charge customers. Being highly skilled in maths and statistics the actuary’s role is to determine the lowest possible premium that satisfies both the business and regulatory objectives.
Actuaries are essentially experts at managing risk, and owing to the fact that there are fewer actuaries in the World than most other professions — they are highly in demand. They lend their expertise to insurance, reinsurance, actuarial consultancies, investment, banking, regulatory bodies, rating agencies and government agencies. They are often attributed to the middle office, although it is not uncommon to find active roles in both the ‘front and middle’ office.
Recently, they have also found greater roles in fast growing Internet startups and Big-Tech companies that are entering the insurance space. Take Gus Fuldner for instance, head of insurance at Uber and a highly sought after risk expert, who has a four-member actuarial team that is helping the company address new risks that are shaping their digital agenda. In fact, Uber believes in using actuaries with data science and predictive modelling skills to identify solutions for location tracking, driver monitoring, safety features, price determination, selfie-test for drivers to discourage account sharing, etc., among others.
Within the General Actuarial practice of Insurance there are 3 main disciplines — Pricing, Reserving and Capital. Pricing is prospective in nature, and it requires using statistical modelling to predict certain outcomes such as how much claims the insurer will have to pay. Reserving is perhaps more retrospective in nature, and involves applying statistical techniques for identifying how much money should be set aside for certain liabilities like claims. Capital actuaries, on the other hand, assess the valuation, solvency and future capital requirements of the insurance business.
New Product Development in Insurance
Insurance companies often respond to a growing market need or a potential technological disruptor when deciding new products/ tweaking old ones. They may be trying to address a certain business problem or planning new revenue streams for the organization. Typically, new products are built with the customer in mind. The more ‘benefit-rich’ it is, the easier it is to push on to the customer.
Normally, a group of business owners will first identify a broader business objective, let’s say — providing fire insurance protection for sub-urban, residential homeowners in North California. This may be a class of products that the insurer wants to open. In order to create this new product, they may want to study the market more carefully to understand what the risks involved are; if the product is beneficial to the target demographic, is profitable to the insurer, what is the expected value of claims, what insurance premium to collect, etc.
There are many forces external to the insurance company — economic trends, the agendas of independent agents, the activities of competitors, and the expectations and price sensitivity of the insurance market — which directly affect the premium volume and profitability of the product.
Dynamic Factors Influencing New Product Development in Insurance
To determine insurance rate levels and equitable rating plans, ratemaking becomes essential. Statistical & forecasting models are created to analyze historical premiums, claims, demographic changes, property valuations, zonal structuring, and regulatory forces. Generalized linear models, clustering, classification, and regression trees are some examples of modeling techniques used to study high volumes of past data.
Based on these models, an actuary can predict loss ratios on a sample population that represents the insurer’s target audience. With this information, cash flows can be projected on the product. The insurance rate can also be calculated that will cover all future loss costs, contingency loads, and profits required to sustain an insurance product. Ultimately, the actuary will try to build a high level of confidence in the likelihood of a loss occurring.
This blog is a two-part series on new product development in insurance. In the next part, we will take a more focused view of the product development actuary’s role in creating new insurance products.
This is huge, isn’t it? But, this also raises a question — are desktop/web applications dying?
Developers frequently face this dilemma of which platform to learn for web/mobile app development. Fortunately, hybrid app development platforms and frameworks answer this question. Let me quickly walk you through hybrid mobile app creation before delving deeper into Ionic Framework.
What is a hybrid mobile app?
On the contrary, native apps are the ones that are developed on android/iOS technologies specifically. However, an external user cannot figure out whether an app is a hybrid or native.
Many platforms and frameworks allow building impressive hybrid applications like Ionic, React Native, Xamarin, Onsen UI, PhoneGap, and Mobile Angular UI. In this article, we’ll discuss the Ionic Framework in depth. I’ll also explain why we’re choosing Ionic for hybrid app development. After reading this, you’ll be able to install Ionic SDK, build and run your apps from scratch.
Why Ionic Framework?
Ionic is one of the most popular frameworks for developing hybrid apps available today. Its complete source code is available on GitHub. With the Ionic framework, anyone can start creating effective android apps just with an idea, a computer, and an internet connection.
Did you notice — I didn’t mention pricing?
That’s true. You need not buy a license for Ionic. Thus, you can start developing apps for free.
Developers community: With a vast and active community, you’ll always find help at hand for any problem you face while developing apps on Ionic.
Cordova plugins: This is one of the best parts of Ionic app development. It opens the doors to native device capabilities beyond pure web applications. With Cordova, you get access to logs, battery, geolocation, camera, etc. to enhance your app performance. And you can avail these all by adding just a few simple codes.
Code reusability: Once you’ve developed an app, you can use the same code with slight changes to build an entirely new app. This will help you a lot in improving your TAT (Turn around time).
Testing: Testers can easily run the script using Cordova commands for both iOS and Android.
Now let’s get started with Ionic Framework!
Quick Installation Guide for Ionic & Components
Let’s start with minimum basic requirements for building your app with the current release of Ionic. Currently, Ionic targets iPhone and Android devices supporting iOS 7+ and Android 4.1+. However, you’ll find some old Android devices, where Ionic apps might not work.
If you’re on Windows, make sure you download and install Git for Windowsand optionally Console2. In this guide, you’ll be executing commands in Git Bash or Console2 windows.
First, we need to install the most recent version of Apache Cordova. It will take your app and bundle it into a native wrapper to turn it into a traditional native app.
To install Cordova, make sure you have Node.js installed and then run the command –
$ sudo npm install -g cordova
Special Notes: Linux Android Note:If you’re using a 64-bit version of Ubuntu, install 32-bit libraries. It is because Android is only 32-bit at the moment. You can use the following command-
$ sudo apt-get install ia32-libs
If you’re on Ubuntu 13.04 or greater, ‘ia32-libs’ has been removed. You can use the following packages instead-
Windows note on Java, Ant, and Android: Install the most recent Java 8 JDK and not just the JRE. Currently, Cordova doesn’t support JDK 9.
Next, create an environment variable for JAVA_HOME. It should point to the root folder where the Java JDK is installed. For example, if you’ve installed the JDK into C:\Program\Files\Java\jdk7, set JAVA_HOME at this path. Post this, add the JDK’s bin directory to the PATH variable as well. As per previous assumption, it should be either %JAVA_HOME%\bin or the full path: C:\Program Files\Java\jdk7\bin
To install Ant, download the zip file (here), extract it, and move the first folder in the zip to a safe place. After this, update your PATH to include the bin folder in that folder. For example, if you moved the Ant folder to C:/, you’d want to add this to your PATH:
It is important to install the Android SDK. Android SDK provides you API libraries and developer tools which are necessary to build, test, and debug Android apps.
You’ll need to set the ANDROID_HOME environment variable. Point this to [ANDROID_SDK_DIR]\android-sdk directory. For example,
Next, you’ll need to update your PATH to include the tools/ and platform-tools/ folder in that folder. Therefore, using ANDROID_HOME, add both %ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools.
Run the following command to install ionic:
$ sudo npm install -g ionic
Create the project
$ ionic start todo blank –type ionic1
This will create a ‘todo’ folder in the directory where the command was run. Next, go into this directory and list the contents. This is how the outer structure of your ionic project will look like:
$ cd todo && ls
├── bower.json // bower dependencies ├── config.xml // cordova configuration ├── gulpfile.js // gulp tasks ├── hooks // custom cordova hooks to execute on specific commands ├── ionic.project // ionic configuration ├── package.json // node dependencies ├── platforms // iOS/Android specific builds will reside here ├── plugins // where your cordova/ionic plugins will be installed ├── scss // scss code, which will output to www/css/ └── www // application – JS code and libs, CSS, images, etc.
Next inform ionic that you want to enable iOS and Android platforms. Please note, unless you’re on macOS, leave out the iOS platform. So, run the following commands.
Let’s now walk through the anatomy of an Ionic app. Inside the folder (we just now created), we’ve a typical Cordova project structure where we can install native plugins, and create platform-specific project files.
src/index.html is the main entry point for the app, though its purpose is to set up scripts, CSS includes, and bootstrap, or start running our app. We won’t spend much of our time in this file.
For your app to function, Ionic looks for the <ion-app> tag in your HTML. In this example we have:
and the following scripts near the bottom:
<!– Ionic’s root component and where the app will load –> <ion-app></ion-app> <!– The polyfills js is generated during the build process –> <script src=”build/polyfills.js”></script> <!– The vendor js is generated during the build process It contains all of the dependencies in node_modules –> <script src=”build/vendor.js”></script> <!– The main bundle js is generated during the build process –> <script src=”build/main.js”></script>
These scripts are all generated by the build system, so no need to worry about them.
src/app/app.module.ts is the entry point for our app.
You’ll notice that every app has a root module, which controls the rest of the applications. You’ll find this very similar to ng-app from Ionic 1 and AngularJS. We’ll also bootstrap our app (using ionicBootstrap) from here.
Here we’ll discuss the main template for the app in src/app/app.html.
First, set the root component to MyApp in src/app/app.component.ts. This will be the first component to load in your app. Typically, it is an empty shell for other components to load into it. We’ll set our app.component.ts template to src/app/app.html. This is how it will look.
Enable USB debugging and Developer Mode on your Android device. Then run ionic cordova run android — device from the command line. This will produce a debug build of your app, both in terms of Android and Ionic’s code.
Please note that enabling USB debugging and Developer Mode may vary from device to device. However, it is easy to look up with a simple Google search. For details, you can check out – Enabling On-device Developer Options in the Android docs.
To run or build your app for production, run
ionic cordova run android –prod –release
ionic cordova build android –prod –release
This command will minify your app’s code as an ionic source. It will also remove any debugging capabilities from the APK. People generally use this while deploying an app to the Google Play Store.
Sign Android APK
For releasing your app in the Google Play Store — sign your APK file. For this, create a new certificate/keystore.
Let’s generate your private key using the keytool command that comes with the JDK:
If you want to verify that your apk is signed, run apksigner. You can find this in the same path as the zipalign tool:
apksigner verify HelloWorld.apk
Now we have our final release binary called HelloWorld.apk and we can release this on the Google Play Store for all the world to enjoy!
iOS developers need to generate a provisioning profile for code signing their apps for testing. However, the good news is that you can develop and test your apps on your iOS device without a paid Apple Developer account in iOS9. This is particularly great for developers who want to try mobile development using the Ionic Framework.
Xcode 7 or higher
Creating a Provisioning Profile
First of all, you’ll need to set up a provisioning profile for code signing your apps.
Using an Apple ID
Open Xcode preferences (Xcode > Preferences…)
Click the ‘Accounts’ tab
Log in with your Apple ID (+ > Add Apple ID…)
Once you’ve logged in successfully, you’ll find a new ‘Personal team’ with the role ‘Free’ appearing beneath your Apple ID.
Running Your App
Run a production build of your app with ionic cordova build ios –prod
Open the .xcodeproj file in platforms/ios/ in Xcode
Then connect your phone with USB. Select your phone as the run target.
Click the play button in Xcode
Oops, code signing error! No problem.
Code Signing Your App
It totally depends on whether you’re using Xcode 8 or an earlier version…
Xcode 7 and Earlier
For this, you’ll get a code signing error. It will look like the following image when you try to run the app.
To fix this, click the “Fix Issue” button and then select your “Personal Team” profile.
In Xcode 8, the code signing error will appear as a build-time error instead of a pop-up.
To select the certificate to sign your app with, do the following:
Go to the ‘Project Editor’ by clicking the name of your project in the ‘Project Navigator’
Select the ‘General’ section
Select the team associate with your signing certificate from the ‘Team’ dropdown in the ‘Signing’ section
Trusting the Certificate
After code signing, you’ll get a launch error that looks like the following image. On Xcode 7 and below versions, you’ll see this automatically. On Xcode 8, it appears next time when you try to run the app.
To remove this error, you’ll have to tell the iOS device to trust the certificate. You can do this in the following steps-
On your iOS device, open the ‘Settings’ app
Then, go to General>Device Management. Here, you’ll find the email address associated with your Apple ID or Apple Developer account, which you used while code signing your app.
Tap the email address
Tap ‘Trust <your_email>’:
After this, go back to Xcode and hit the play button. Or you can run ionic cordova run ios –device from the command line to install and launch your app on your iOS device.
Additional tips while using the Ionic Framework
1. Use or create a yeoman generator
Yeoman is a scaffolding tool that allows you to quickly deploy pre-configured projects. A place to start is exploring some of the Ionic Yeoman generators to see if they meet your requirements.
2. Just put styles in www?
It may be tempting to rush into things and throw new scss files into the www folder; somewhere near the code for the Ionic styles and then add a reference to your CSS file within the index.html.
This won’t work with the Ionic Gulp set up. It’s a safe practice to not to add things in there.
3. Put your custom app styles into their own folder
Today, your app might be small and simple. But, it will eventually grow and you might want it to remain manageable. You might be concerned especially when a team of developers will be involved in the project.
Hence, I recommend splitting your app’s custom styles into a neater set of files. It should mirror Ionic’s sass files whenever we’re specifically overriding Ionic itself. You can put these custom app styles into their own sub folder, which will be easy to change/update later.
Now that you know that Ionic is the dominant hybrid mobile development framework, installing it, and using it is also easier as compared to other platforms. Do let me know if you have queries, I’ll be happy to help.
About the author: Anand Nanavaty is a Software Engineer at Mantra Labs. He has been involved in mobile app development for the company’s B2B clients. Apart from coding and experimenting with different application development frameworks, Anand likes trekking and hiking into the greens.