Answer
Thank you for all contributions to my issue. I end up my case with the following steps
- Keep same code.
- Create excel file to generate JSON based on specific condition.
- Copy JSON on excel file to script (//TODO: read from Excel)
Question
I'm working a project that transform raw data to a chart to build a report.
I'm using Selenium to automate this site, the ultimate goal of this automation project is checking if data of chart returns correctly or not. Each option on the form will effect to how the data returns (and also chart displays but we just check data, we trust GoogleChart for displaying part).
The issue I face here is that the form is too complex: a lot of options and nested options
Sample form structure (please find an attachment for full structure)
- GeneralInfo
- chartType
- Variable1
- function
- showPercentage
- ...
- categories (2 more nested level here)
- Variable2: same as 1
- Filter
- variableName
- operator
- value
- Option: 10+ options here
My solution
- I implement a method CreateNewChart(string jsonString)
- Create json for each case (e.g sort ASC, DESC, show percentage, ...)
It works but I see it is not a good solution
- Easy to make mistake with json (you always need to take a look at a long long json string :) )
- Hard for maintainance if json structure changes
- ...
I'm looking forward for more easier way to handle this one. Any advice, suggestion, comment are welcome.
Thanks.