gliga / ekstazi

Software testing optimization tool
Apache License 2.0
27 stars 15 forks source link

Doubt in a particular edge case. #39

Closed h-ranjan1110 closed 2 years ago

h-ranjan1110 commented 2 years ago

Hi,

Can you please specify how this tool handles this scenario that I have mentioned below?

suppose there are two java classes file FileA and FileB.

FileA has two dependent test methods say TestMethod1, and TestMethod2. FileB has two dependent test methods say TestMethod3, and TestMethod4.

The above information is stored in a dependency coverage file.

Now there is a new commit in FileA which has caused it to depend on TestMethod4. In the next run will TestMethod4 run? If it will then how are we handling this case.

gliga commented 2 years ago

Hello @h-ranjan1110 ,

If I understood, you have the following:

TestMethod1 -> FileA TestMethod2 -> FileA TestMethod3 -> FileB TestMethod4 -> FileB

Then, you are saying that you are modifying TestMethod4 to also depend on FileA? If that is the case, TestMethod4 will be run because you modified it and new dependencies will be collected:

TestMethod1 -> FileA TestMethod2 -> FileA TestMethod3 -> FileB TestMethod4 -> FileB, FileA

Let me know if that does not answer the question and you could provide an example in a format that shows dependencies (like above) and with a few short code snippets.

h-ranjan1110 commented 2 years ago

hi @gliga ,

This is the dependency.

TestMethod1 -> FileA TestMethod2 -> FileA TestMethod3 -> FileB TestMethod4 -> FileB

We added some code in FileA which caused it to depend on TestMethod4. So new dependency would look like.

So FileA = FileA + (Some new code)

TestMethod1 -> FileA TestMethod2 -> FileA TestMethod3 -> FileB TestMethod4 -> FileB, FileA

We have not changed anything in the TestMethods.

So if we run the tool again, How will it know that TestMethod4 needs to be run. Ideally, we would want that TestMethod4 should run to test the new code added in FileA.

gliga commented 2 years ago

The only way TestMethod4 can start depending on FileA is if you change TestMethod4. There is no way (modulo dynamic class loading) to depend on a new file without changing the test. If you change the test, then Ekstazi will run the test in the case that you described.

h-ranjan1110 commented 2 years ago

Yeah, I felt the same. Thanks for your response.