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
Add unit tests #5
Comments
@kalicki1, I created a new branch issue-5 for your work. |
I added a placeholder in the readme for the instructions how to perform the testing. @kalicki1, could you add the instructions once you have finalized your unit tests? |
…ractices.py import statement to work with test module
I just updated the instructions for running the current tests, @SebastianZimmeck . I will update them as more tests get added and if the process changes over time. |
Thanks, @kalicki1. I followed your instructions and got the following error:
Perhaps, this error is related to moving the files per your instructions. When I am using Can you look into how to run the tests without moving files around or changing the files of PrivacyFlash Pro (e.g., is this relevant?) |
If anyone else has a solution, please chime in as well. (cc'ing @rgoldstein01) |
@davebaraka and @rgoldstein01, I looked a little bit into this. It seems that we cannot import modules using an absolute path. For example, in privacy_practices.py, when I am changing line 17 from
to
I am not seeing any error. However, when I am running PFP with this change on the AdColony test project, the results are not displayed. Do you have any thoughts? Is there code in the analysis or the UI that needs to be changed as well? |
@kalicki1, as we just discussed, when I am running the tests, five of them are failing. At the moment, I am thinking that we should have passing tests. It seems that you are getting different results, though. I am having some errors. Here is my output:
|
I could not get eel to work when trying to structure the files as a package. The only way I could get eel to work is if it was left as a script. So as a potential solution, I put all the analysis files in a I think everything should still be working. |
…rivacy_practices.py (issue #5)
Thanks, @davebaraka! I just added an init.py file to the src directory because running the tests was not working for me without it. The absolute/relative import point seems to be fixed now. @kalicki1, the problem with the failing tests is still open, though. The output I am getting does not look quite right to me. |
@SebastianZimmeck, I fixed the issue with the last three test errors you had. My tests accounted for the fact that I had extra .DS_Store files on my machine that others may not have, so I made sure the tests did not include them. However I still have not figured out what returned the first two errors, since I would expect the same error to come up under the |
Thanks, @kalicki1. This is what I am currently getting:
|
@kalicki1, can you try fixing the remaining errors by Thursday? If it is not possible, you can just remove the test cases that are throwing errors. Then, open a pull request please. |
We would like to add some testing code. @kalicki1 will add a few unit tests to start. Especially, let's test PFP's analysis functionality in analysis.py and privacy_practices.py.
A good starting point are Python's pytest and unittest frameworks. Here is a tutorial that covers both.
For the time being, we can just focus on passing tests and not worry about failing tests. As @rgoldstein01 mentioned, for example, if you want to test whether a function recognizes certain keywords in files, you can create some dummy input that represents an app file (e.g., a text file with certain keywords).
You can create a new directory
tests
underprivacyflash-pro
and include your files there.(cc'ing @davebaraka, @pakaelbling)
The text was updated successfully, but these errors were encountered: