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

End To End Test Suite extended #583

Merged

Conversation

SuyDesignz
Copy link
Contributor

@SuyDesignz SuyDesignz commented Aug 10, 2022

Extension Of The End To End Module

The extension of the EndToEnd tests includes the following new features/Fixes:

  • (Fix) Identification in json changed to SHA256 hash
  • (feature) extension of the comparative values as discussed in the issue End to end testing - "comparative values"
  • (Fix) made json more flexible to better store results per test function
  • current json format looks like this :
[...]
 "function_name" : "normalizationLevelTest",
  "test_results" : [ {
    "result_similarity" : 100.0,
    "result_minimal_similarity" : 100.0,
    "result_maximum_similarity" : 100.0,
    "result_matched_token_number" : 56,
    "test_identifier" : "85FF00F531A497F002D40E9C8430CB159EFC40E618925FD757E35EB2A533227E"
  },
[...]
  • (feature) Made adjustments to the use of paths in a mapper to be able to add languages flexibly LanguageToPathMapper.java
  • (feature) Create the memory tests to insert the temporary results into the memory json file. This is necessary to be able to save changes made to languages automatically so that the endToEnd tests run successfully again after a change made to the recognition.
  • (feature) Documentation written to the README.md. Here is a step by step guide how to create new endToEnd tests for languages
  • (feature) The endToEnd test for java extended
  • (feature) Made it possible to create a quick over all test with the help of JPlagTestSuiteHelper.java
[...]
    @Test
    void overAllTests() throws IOException, ExitException, NoSuchAlgorithmException {
        String[] testClassNames = jplagTestSuiteHelper.getAllTestFileNames();
        runJPlagTestSuite(testClassNames);
    }
[...]

For more necessary information please have a look at the README.md file.

Meeting summary

DONE:

  • Make adjustment to identifiktaor and use the test data names instead of the SHA256 hash
  • Remove the "result_similarity" field in the json file as this is composed of the max and min similarity.
  • View JUnit DynamicTest and its use in the OverAllTests cases.
  • Extend with the possibility to run other test configurations
  • Modify the README.md file to add the new endToEndTests

… to be able to create multiple resources folders per language.
…mparativeValueExtension

# Conflicts:
#	jplag.endToEndTesting/src/main/java/de/jplag/end_to_end_testing/helper/JPlagTestSuiteHelper.java
#	jplag.endToEndTesting/src/main/java/de/jplag/end_to_end_testing/helper/JsonHelper.java
#	jplag.endToEndTesting/src/test/java/de/jplag/end_to_end_testing/JavaEndToEndTest.java
@SuyDesignz
Copy link
Contributor Author

Regarding the buidl error I am already looking for the problem. Likewise, I have local problem to build the project, since the module of Scala throws reference error with me

@SuyDesignz
Copy link
Contributor Author

There seems to be problem with comparing the SHA256 hashes created on my windows machine and the one created by the unix build.

@dfuchss
Copy link
Member

dfuchss commented Aug 10, 2022

Thats may be related to line endings (\r\n for windows \n for windows). How did you created the SHA? (In Java or Locally)

@tsaglam tsaglam added enhancement Issue/PR that involves features, improvements and other changes minor Minor issue/feature/contribution/change labels Aug 10, 2022
@tsaglam tsaglam added this to the v4.0.0 milestone Aug 10, 2022
@SuyDesignz
Copy link
Contributor Author

Meeting summary

  • Make adjustment to identifiktaor and use the test data names instead of the SHA256 hash
  • remove the "result_similarity" field in the json file as this is composed of the max and min similarity.
  • Extend with the possibility to run other test configurations.
  • View JUnit DynamicTest and its use in the OverAllTests cases.

@SuyDesignz
Copy link
Contributor Author

@jplag/studdev can someone look over the PR so that this can be completed?

@tsaglam
Copy link
Member

tsaglam commented Aug 23, 2022

can someone look over the PR so that this can be completed?

@robinmaisch maybe you can review this PR and @SuyDesignz reviews your PR 594?

Copy link
Contributor

@robinmaisch robinmaisch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit that I don't get the bigger picture from just this diff, but I tried to refactor the code to be more readable or more "common practice" (based on what I perceive as such), which more often than not was accomplished by working with Collections/Streams. I prefer them over Arrays any day, but again, that's just me.

I typed the code into this website untested, so there might be some parentheses missing or something like that. Hopefully, my suggestions are still helpful. Good job!

@tsaglam
Copy link
Member

tsaglam commented Aug 25, 2022

@SuyDesignz, please finish this PR today so it is ready to merge.

SuyDesignz and others added 6 commits August 25, 2022 20:40
…g/helper/TestSuiteHelper.java

Co-authored-by: Robin Maisch <robinmaisch@users.noreply.github.com>
…g/EndToEndSuiteTest.java

Co-authored-by: Robin Maisch <robinmaisch@users.noreply.github.com>
…g/EndToEndSuiteTest.java

Co-authored-by: Robin Maisch <robinmaisch@users.noreply.github.com>
…g/helper/FileHelper.java

Co-authored-by: Robin Maisch <robinmaisch@users.noreply.github.com>
…g/helper/FileHelper.java

Co-authored-by: Robin Maisch <robinmaisch@users.noreply.github.com>
@SuyDesignz
Copy link
Contributor Author

I currently have problems to implement the new structure with the languages in the endToEnd tests. Since the languages are actually loaded automatically and this has now changed, I must first look at how I can adapt this now.

@SuyDesignz
Copy link
Contributor Author

SuyDesignz commented Aug 25, 2022

Mapper and all other functions have to be adapted now.

My current estimate is that the adjustment will take a little longer.
I did not have the change with the language on the screen.

…tingComparativeValueExtension

# Conflicts:
#	jplag.endToEndTesting/src/main/java/de/jplag/end_to_end_testing/helper/JPlagTestSuiteHelper.java
#	jplag.endToEndTesting/src/main/java/de/jplag/end_to_end_testing/model/TestCaseModel.java
#	jplag.endToEndTesting/src/test/java/de/jplag/end_to_end_testing/JavaEndToEndTest.java
@SuyDesignz
Copy link
Contributor Author

Done with the adjustments and suggested changes.

Copy link
Member

@dfuchss dfuchss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments

Comment on lines 64 to 81
/**
* Creates the permutation of all data contained in the passed parameters and adds it to the given path.
* @param fileNames for which the permutations are needed
* @param path to which the permutations are to be copied
* @return all permutations of the specified files to the path specified
*/
public static List<String[]> getTestCases(String[] fileNames, Path path) {
ArrayList<String[]> testCases = new ArrayList<>();
int outerCounter = 1;
for (String fileName : fileNames) {
for (int counter = outerCounter; counter < fileNames.length; counter++) {
testCases.add(new String[] {Path.of(path.toAbsolutePath().toString(), fileName).toString(),
Path.of(path.toAbsolutePath().toString(), fileNames[counter]).toString()});
}
outerCounter++;
}
return testCases;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree here. Please change that.

@SuyDesignz
Copy link
Contributor Author

I'm not sure right now what I should change in the function?

@dfuchss
Copy link
Member

dfuchss commented Aug 26, 2022

I'm not sure right now what I should change in the function?

What function?

@SuyDesignz
Copy link
Contributor Author

That I should change something about the function "getTestCases" in /helper/TestSuiteHelper.java

 public static List<String[]> getTestCases(String[] fileNames, Path path) {

#583 (comment)

@dfuchss
Copy link
Member

dfuchss commented Aug 26, 2022

That I should change something about the function "getTestCases" in /helper/TestSuiteHelper.java

 public static List<String[]> getTestCases(String[] fileNames, Path path) {

#583 (comment)

It's cleaner to use two for(int i = 0,... ) loops here; instead of using a enhanced for loop with index counter outside.

@sonarcloud
Copy link

sonarcloud bot commented Aug 26, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

86.6% 86.6% Coverage
0.0% 0.0% Duplication

@dfuchss
Copy link
Member

dfuchss commented Aug 26, 2022

@SuyDesignz did you resolved all open conversations? If so, just drop a comment here :)

@SuyDesignz
Copy link
Contributor Author

SuyDesignz commented Aug 26, 2022

@dfuchss Yes I did :) not sure why I can't close #583 (comment) but the other comments have been edited

@dfuchss dfuchss merged commit fa07106 into jplag:master Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue/PR that involves features, improvements and other changes minor Minor issue/feature/contribution/change
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

End to end testing - "comparative values"
5 participants