About the BI Plug-In
Industry: Business Intelligence
BI Plugin is a plugin which basically converts SQL queries into different charts/table format. The plugin converts SQL query results into JSON format and shows the values on screen as columns/rows. It also gives the facility to download those charts/tables in the desired format.
The requirement was to automate these features using Selenium.

Key Challenges
The requirement was to check whether the values returned by web service are shown correctly on screen or not. Sometimes application downloads corrupted file for one of the features. The challenge was to check whether the downloaded file was corrupted or not through automation script only.
- The application allowed to access page only after valid login. So the challenge was to retrieve the data from Web Service response through automation script with authentication
- The response was in JSON format so we need to parse the JSON format
- Yet another difficult task was to get the latest downloaded file and its location

Our Solution
Proposed solution
We have used Java for writing automation scripts with Selenium. The Java code gets a response from the request provided. It then parses the JSON received according to the requirement and fetches required values.
We get the download preference (the folder where all downloaded files are stored) for the browser on which the script is being executed. From that directory, we get the latest downloaded file and check if it is corrupted or not.
Implementation
- Get Response: Using Base64 encoding, we get authorization token for a user who has logged in. On passing the token in HttpURLConnection, the response is fetched in JSON format.
- Parsing JSON: We have used JSONParser for parsing JSON and retrieving values.
- Checking downloaded file: We get the last downloaded file from download location and then check the extension of the downloaded file. If it does not match with selected/provided list, the script throws an exception as a corrupted file. If the extension matches, we read that file with a different class for different extensions. If there is an exception while reading the file, we consider it as corrupted file and script throws an exception.

Tools & Technologies

Business Benefits
- Reduce chances of human error and give accurate output
- Check multiple combinations in less time compared to the manual execution
- Find bugs at an early stage
- Ensures cost-savvy, time-savvy automated testing at every step