Open gkapfham opened 1 year ago
So far I think I have found a few of the xpath patterns in the journal, but I have some questions on which xpath pattern we want to use. this is an xpath for a double nested for loop in a function. : //FunctionDef//For[.//For] this is just for a double nested for loop: //For[.//For] and this is for a for loop that is nested directly underneath a for loop: //For/For which one's should we use?
Things TODO
-Find examples, to test our xpaths expressions on. -Have Kapfhammer make a public repo that has projects -Add our programs to repos for testing -Add comment to functions to let user know what pattern should match -Catch everyone one up on our progress -We Need a macOS user to test the xpaths -try to add xpaths for the things in https://github.com/simonw/symbex
I have finished finding most of the patterns from the pdf, but they need testing. Chatgpt sometimes gives me two different answers.
More descriptive TODO -We need to test our XPATHS on small python samples.(This could be a small function that iterates through a word)
@MilesF25 hey miles can you send the command to access the xml document of subject data?
@VitalJoseph it's pyastdump filename
@MilesF25 thanks
We don't need to add count to the XPATH patterns, Chasten already does the counting. We also don't need the function name for now. So instead of doing count(//FunctionDef[@name='my_function']//If/descendant::If). You can do something like this instead //FunctionDef//If/descendant::If). (This is not a proper XPATH)
I was able to get one XPATH pattern to work. '//FunctionDef//If/following-sibling::If'. This looks for nested if statements.
@VitalJoseph @Finley8 @MilesF25 Was this completed in a merged PR?
@VitalJoseph @MilesF25 just confirmed that work is actively happening on this issue, but in a Google doc rather than in a branch. The plan is to get this documented on our GitHub wiki by 2023-11-05. If this is not done in time, we will set this issue to the side.
Google doc to hopefully working xpaths. https://docs.google.com/document/d/12OVwJkJBG0KB90UbGjfpXwtau2iXV_cV_7-KlGkPfKo/edit
@MilesF25 here is the xpath pattern for the (assertion_density) check that i have tried. Im having trouble with this one if ypu want to take a look at it.
"count(//FunctionDef[@type='str']/body/Asserts) idiv count(//FunctionDef[@type='str']/body/*)"
Also having trouble with the (direct_test_no) check. Here is the pattern I used.
//FunctionDef[@type='str' and starts-with(@name, 'test_')]/body//Call/Name[@id='test_function']
@VitalJoseph The following are some solutions that do not immediately break the program when run.
- name: "assertion-density" code: "ASD" id: "ASD001" pattern: "/testSuite/directTest[assertions div linesOfCode > 0.2]" count: min: null max: null
- name: "direct-test-no" code: "DTN" id: "DTN001" pattern: "//FunctionDef[@type='str' and starts-with(@name, 'test_')]/body//Call/Name[@id='test_function']" count: min: null max: null
@VitalJoseph does PR #125 close this issue? @gkapfham was asking if it implements all of the checks.
@simojo yes
The following paper:
https://www.researchgate.net/publication/347335615_How_to_kill_them_all_An_exploratory_study_on_the_impact_of_code_observability_on_mutation_testing
describes a number of "mutation score anti-patterns" that limit the achievement of a high mutation score for a test suite.
This project should come with XPath expressions that can scan a Python project for all of the anti-patterns mentioned in this paper. The project should also:
pytest-cov
andcoverage.py
to support the study of the correlation between anti-patterns and coverage score