# Software testing kit One can develop the apps and test it using the testing kit. Through the testing kit, one can check the packaging, test the update path for an app, and test how the app reacts for multiple users with various permissions. How does it work? ----------------- The testing kit runs as a virtual machine. One has to download a `.iso image from [here](https://www.dropbox.com/s/75xa0iznigy35xt/aalam-sdk.iso?dl=0). This iso image boots a linux kernel and a test bed for packaging and running the apps and managing certain aspects for testing. Features -------- ### App management You can create multiple provider accounts and manage their respective apps. For each app, you can submit packages for multiple versions and choose a version to be the current runnable version. You can also test the upgradation from one version to others. Following is the summary - Create/delete multiple provider accounts - Create/delete multiple apps for each of the providers - Submit/delete versions to each app - Choose a version of an app to run at any time - Update/Migrate the app from one version to another ### User management Sinces the apps expose multiple permissions the app might want to present a different set of user interfaces for user holding specific permissions. The toolkit offers a way to do that. User can add multiple user email ids and choose one among them or be `anonymous`. Each user can be assigned multiple permissions chosen from the permissions listed by all the apps. You can as well configure multiple users to be administrator and choose any one user to be logged in at any time. In summary - Create/delete multiple users - Login any one user at any time - Make a user an administrator - Assign permissions for a user - A user account for every app as well How to access? -------------- The toolkit consist of two parts. 1. Manager The manager program listens on port 8080 on the IP alloted to your virtual machine. This is where you can manage your providers and the users 2. Apps The Apps will be listening on port 80 on your virtual machine's IP address. How to setup? ------------- There are various hypervisor programs that you could use to launch a virtual machine as a guest in your host machine. Some popular programs are - [Oracle virtual box](https://www.virtualbox.org/wiki/Downloads) - [Qemu](http://www.qemu-project.org/download/) The testing is just a mere bootable ISO file roughly about 50MB. The testing kit expects that there will be a backup storage volume where it will store the persistent data and also a network connection so that it can access the outer world and you can access the testing kit from the host machine. After starting the virtual machine, the ISO image prepares the disk and downloads the latest software packages needed for the SDK from the internet. Depending on your internet connection, the time taken for this varies. It should probably vary from about 4-5 mins to 20-30 mins for a bandwidth of 12 Mbps to 1Mbps. This happens only the first time you start the virtual machine. The second time onwards, if there are no updates, it will start very quick. When the virtual machine is booted and ready it will display the URLs to access the `Manager` and the `Apps`. Setting up SDK using Oracle virtual box --------------------------------------- 1. Download and install the oracle virtual box from [here](https://www.virtualbox.org/wiki/Downloads). 2. Open the virtual box and create a 'New' VM. In the 'Create Virtual Machine' dialog box, you have to input the following - Give some `Name` to the virtual machine liek "Aalam SDK" - `Type` should be `Linux` - 'Version should be `Other Linux (64-bit)` 3. In the guided moded, you would have to press the 'Next' button which would let you select the amount of memory that you need to allocate for the virtual machine. We have tested the SDK by with a minimum RAM of `768 MB`. Higher memory than `768 MB` will not hurt. After allocating memory, press 'Next' button. 4. Now the wizard will prompt for a hard disk creation. Choose `Create a new virtual hard disk` option and then press 'Create' button. - Now it will prompt you to choose the file type for the hard disk. Choose `VDI (VirtualBox Disk Image)` - The next menu will ask you to choose a size for the hard disk. It's better to choose `Dynamically allocated`. - After pressing 'Next' it will ask you for the size of the hard disk to initialize it. Keep it `8.00 GB` 5. By pressing `Create` a virtual machine configuration will be created for you and it should be listed in the left panel. 6. Now *right click* on the virtual machine name that you just created and select `Settings` from the menu. You should be seeing a new dialog box. 7. Click on the `Network` option in the right panel of the Settings dialog. The left panel should show a list of tabs with `Adapter `. - Click on the `Adapter 1` tab and see if `Enable Network Adapter` checkbox is checked. If not do check it. - In the same tab click on the `Attached to: ` dropdown and choose `Bridged Adapter` option from it. 8. Now that we have configured the network settings, now we need to configure the media the virtual machine boots from. To do this, click on the `Storage` option from the left panel of the 'Settings' dialog. 9. In the `Storage tree` panel, click on the `Controller: IDE` list-group header. You should be seeing two icons to the right of this header. If you move your mouse pointer on those icons it will show a tool tip. - Click on the icon that says `Adds optical drive`. - In the dialog box show, select `Choose disk` option. By this time you should have downloaded the tool kit's ISO image as described above - Choose the downloaded ISO image in the file selector dialog box. 10. Press `OK` in the Settings dialog box. Now your virtual machine setup is done. You can now `Start` the new virtual machine. Setting up a Qemu virtual machine --------------------------------- If you are developing on a Linux platform, QEMU is a great option to be used with KVM acceleration. QEMU is a great command line utility to start a virtual machine. You could use some manager programs which helps in easing the certain pain points in using QEMU. In linux, you could use [libvirt](https://libvirt.org/). ](https://libvirt.org/). Libvirt helps manage the networking part and all the configurations can be given in an XML format. 1. Install libvirt and QEMU through your package manager. 2. Ensure that `kvm` module is installed in your kernel. 3. Create a virtual hard disk image using the following command ``` $ sudo qemu-img create -f raw /var/lib/libvirt/images/sdk.img 10G ``` 3. You can download a sample libvirt configuration file from the below link ```eval_rst | :download:`aalam-sdk-libvirt.xml ` ``` - You need to replace `PATH_TO_SDK_ISO_IMAGE` to the actual path of the ISO image in the xml file ``` $ sed -i "s/PATH_TO_SDK_ISO_IMAGE//g" aalam-sdk-libvirt.xml ``` 4. Run the following command to start the virtual machine whenever you want ``` $ sudo virsh create aalam-sdk-libvirt.xml ``` 5. The VM created just now has both a serial terminal and graphics display. - The graphics display can be accessed by a VNC client. The VNC server port for the VM can be accessed by ``` $ sudo virsh vncdisplay "Aalam-SDK" ``` - The serial console can be accessed using the following command ``` $ sudo virsh console "Aalam-SDK" ``` 6. To shutdown the VM you need to run the following command ``` $ sudo virsh destroy "Aalam-SDK" ```