-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streamline the process of adding new apps #88
Comments
Right now the design for the config files looks solid, 75% of the swift file is being generated (The app's actions are not being generated yet), generating the readme would be relatively easy along with the pod specs. The python scripts should be tested right? (if so I need directions with what library or method should I use) Also, I'm thinking generating tests is a risky thing to do, what do you think @Mazyod ? |
😄 Great question! .. I've been thinking about generating unit tests for the swift code, but that would simply useless, since a bug in those files would mean a bug in the script! So, yeah, testing the scripts would be our priority. Regarding the library to use, I love using py.test, but if you want to keep dependencies to minimum, we can use As for a general direction, we need some integration tests and perhaps some unit tests, as described below: File StructureGeneral file structure.
Unit TestingUnit testing is optional. You can do it for tricky functions. For example, if you have a function that does a complicated string transformation, you can write a unit test for that function and test different input. I looked at your approach, and I think Jinja is doing all the complicated stuff, so unit tests are probably not needed. Integration TestingThis is very tricky, but super important, especially for testing the swift files generation. I will use that as an example of how to write the integration test. So, let's say you prepared the Jinja template, and fed it some JSON config, and a swift file was generated. How can we know that this whole process, from start to finish, worked well? That is what an integration tests helps us do. So, in the case of the swift files, we need to simply compile the file and execute another swift file which uses the generated swift file! e.g. JSON -> Twitter actions app.open(Applications.Twitter(), action: .status("1")) So, a python test script would possibly use subprocess call to prepare the swift files, compile them, and simply make sure everything compiles correctly. We can go further to run the final swift file and see if the output works, but that's even more tricky. In all cases, I think the testing part is very challenging, I don't even know if it will simply work as described. I can give you a hand and work on the tests in parallel (on Saturday), and then we can simply run the tests against your output. |
Thank you for the comprehensive response, once I finish from the code generation code I will try to get a head start with testing and compiling swift files. 👍 |
Swift files are being generated now perfectly, Although I will refactor some of the code later since it doesn't follow theDRY (don't repeat yourself) principle. |
awesome, will check them out as soon as I can. You can always open a PR, and we can keep it open till it's ready. |
Instead of manually writing new Swift classes, tests, pod specs, and modifying the readme, we can have a configuration file with all the apps specs we have, and then a script that generates all the files needed. This will help us move much faster and adapt to future changes more quickly.
Tasks
The text was updated successfully, but these errors were encountered: