Skip to content
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

Implement All XPath Patterns Described in the Referenced Journal Paper #6

Open
gkapfham opened this issue Aug 24, 2023 · 18 comments
Open
Assignees

Comments

@gkapfham
Copy link
Collaborator

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:

  • Support the execution of one or more mutation testing tools for Python,
    thereby supporting the study of the correlation between anti-patterns and
    mutation score
  • Support the execution of test coverage monitoring and the collection of
    per-test coverage information with pytest-cov and coverage.py to support
    the study of the correlation between anti-patterns and coverage score
  • Ensure that all of these data sources are completely integrated and available
    for statistical analysis and/or machine learning prediction
@MilesF25
Copy link
Collaborator

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?

@VitalJoseph VitalJoseph self-assigned this Oct 31, 2023
@MilesF25
Copy link
Collaborator

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

@MilesF25
Copy link
Collaborator

I have finished finding most of the patterns from the pdf, but they need testing. Chatgpt sometimes gives me two different answers.

@MilesF25
Copy link
Collaborator

MilesF25 commented Nov 1, 2023

More descriptive TODO
-We need to test our XPATHS on small python samples.(This could be a small function that iterates through a word)

  • @gkapfham will make a public repo with all the python samples we can test the XPATHS on, we can also add our own samples
  • We will need to leave comments on the python samples explaining what XPATH pattern the sample is
    -We also need to make XPATHS patterns for the symbols shown in the symbex repo. https://github.com/simonw/symbex
    -We Also need a MacOS user to test our XPATHS. @VitalJoseph

@VitalJoseph
Copy link
Collaborator

@MilesF25 hey miles can you send the command to access the xml document of subject data?

@MilesF25
Copy link
Collaborator

MilesF25 commented Nov 6, 2023

@VitalJoseph it's pyastdump filename

@VitalJoseph
Copy link
Collaborator

@MilesF25 thanks

@MilesF25
Copy link
Collaborator

MilesF25 commented Nov 7, 2023

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)

@MilesF25
Copy link
Collaborator

MilesF25 commented Nov 7, 2023

I was able to get one XPATH pattern to work. '//FunctionDef//If/following-sibling::If'. This looks for nested if statements.

@boulais01
Copy link
Collaborator

@VitalJoseph @Finley8 @MilesF25 Was this completed in a merged PR?

@simojo
Copy link
Collaborator

simojo commented Nov 28, 2023

@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.

@MilesF25
Copy link
Collaborator

Google doc to hopefully working xpaths. https://docs.google.com/document/d/12OVwJkJBG0KB90UbGjfpXwtau2iXV_cV_7-KlGkPfKo/edit

@VitalJoseph
Copy link
Collaborator

@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/*)"

@VitalJoseph
Copy link
Collaborator

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']

@Finley8
Copy link
Collaborator

Finley8 commented Dec 5, 2023

@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

@Finley8
Copy link
Collaborator

Finley8 commented Dec 12, 2023

123

@simojo
Copy link
Collaborator

simojo commented Dec 13, 2023

@VitalJoseph does PR #125 close this issue? @gkapfham was asking if it implements all of the checks.

@VitalJoseph
Copy link
Collaborator

@simojo yes

@VitalJoseph VitalJoseph removed the in-progress Work is actively happening on this issue label Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants