{"id":25776970,"url":"https://github.com/EaseTech/easytest-core","last_synced_at":"2025-02-27T06:07:04.951Z","repository":{"id":5546708,"uuid":"6750733","full_name":"EaseTech/easytest-core","owner":"EaseTech","description":"The core module of EasyTest Framework. This includes the core classes for performing Data Driven Testing in Java","archived":false,"fork":false,"pushed_at":"2022-12-02T08:39:03.000Z","size":1549,"stargazers_count":67,"open_issues_count":13,"forks_count":19,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-04-23T11:19:53.413Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EaseTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-18T20:09:27.000Z","updated_at":"2024-03-31T14:13:12.000Z","dependencies_parsed_at":"2023-01-13T13:35:39.751Z","dependency_job_id":null,"html_url":"https://github.com/EaseTech/easytest-core","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EaseTech%2Feasytest-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EaseTech%2Feasytest-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EaseTech%2Feasytest-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EaseTech%2Feasytest-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EaseTech","download_url":"https://codeload.github.com/EaseTech/easytest-core/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240987435,"owners_count":19889335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-27T06:01:33.564Z","updated_at":"2025-02-27T06:07:04.941Z","avatar_url":"https://github.com/EaseTech.png","language":"Java","funding_links":[],"categories":["测试"],"sub_categories":[],"readme":"EasyTest is an actively maintained project. If you have any questions/queries please either log an issue or mail anujkumar@easetech.org\n\nEasyTest Core Module: A Data Driven Testing approach to JUnit\n------------------------------------------------------------------------------------------------------\nAn updated version of EasyTest Core(1.4.0) module is now available in [Maven Central Repository](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.easetech%22%20AND%20a%3A%22easytest-core%22)\n\n### [Some of the users of Easytest](https://github.com/EaseTech/easytest-core/wiki/Users-of-EasyTest-Framework)\n\nQuick Links to EasyTest Documentation\n-----------------------\n\n#### [EasyTest Introduction](https://github.com/EaseTech/easytest/wiki/EasyTest-:-An-Introduction) \n#### [Load data using CSV](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Loading-Data-using-CSV-file)\n#### [Load data using XML](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Loading-Data-using-XML)\n#### [Load data using Excel](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Loading-Data-using-Excel)\n#### [EasyTest Spring Support](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Spring-Integration)\n#### [Intercepting method calls](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Understanding-@Intercept-and-@SpringIntercept-annotation)\n#### [@Param annotation and passing parameters to test method](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Understanding-@Param-annotation)\n#### [Complex objects as parameters and Converters support](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Understanding-Converters-Support)\n#### [Property Editors Support](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Understanding-Property-Editor-Support)\n#### [JSON Support in EasyTest](https://github.com/EaseTech/easytest-core/wiki/Passing-JSON-Object-in-test-data)\n\nWhat's new in Version 1.4.0\n---------------------------\nVersion 1.4.0 is compatible with JUnit 4.12. All the versions previous to 1.4.0 are compatible with JUnit 4.10\n\nWhat's new in Version 1.3.2\n---------------------------\n* [appendData](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/DataLoader.java) attribute in DataLoader annotation to optionally specify whether data specified in two different files for the same method be appended or replaced.\n* A complete rewrite of the Framework to be faster and easier to work with. Advanced Users can now easily debug the source code as it is modularized and separated out cleanly.\n* [Intercept](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/Intercept.java) annotation. A field level annotation that can be used to intercept calls to methods within the class that is under test.\n* [PreserveContext](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/PreserveContext.java) Method level annotation tat can be used to specify whther the context of the test should be preserved between test runs. The default value is true.\n* Bug fixes\n\nFor a more indepth into the new features or for any queries, please contact anujkumar@easetech.org\n\nWhat's new in Version 1.2.7\n---------------------------\n* [Display](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/Display.java) \nannotation is introduced to limit the input key=value pair that is displayed as part of the test method name. \nUntil now, all the test data that is used to run the test method was displayed in the IDE, in the form : testMethodName{paramName=paramVal,paramName=paramVal}\nNow a user can choose to show only certain fields in the test method name.\nLook at [Display annotation Usage](https://github.com/EaseTech/easytest-core/blob/master/src/test/java/org/easetech/easytest/example/TestExcelDataLoaderPolicy.java) to see how it can be used at class level \nand [Display at method level](https://github.com/EaseTech/easytest-core/blob/master/src/test/java/org/easetech/easytest/example/TestExcelDataLoader.java) to see how it can be overridden at method level.\n\n* [Format](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/Format.java) annotation is introduced \nfor the user to specify the date, datetime and time format to be used to convert date/datetime/time values. \nInitially EasyTest was parsing the date strings randomly and it was not efficient. \nThe specified date/datetime/time formats are also available to the custom converters.\nLook at [Format annotation usage ](https://github.com/EaseTech/easytest-core/blob/master/src/test/java/org/easetech/easytest/example/TestDatesPolicy.java) \nand [Test class where it is applied](https://github.com/EaseTech/easytest-core/blob/master/src/test/java/org/easetech/easytest/example/TestDates.java).\n\n* New attribute [convertEmptyToNull](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/Param.java)\nadded to the @Param annotation. \nThis attribute specifies whether the empty values (specified using \"\")in the test data be converted by EasyTest to Null values or not. Default value is false.\nExample usage [here](https://github.com/EaseTech/easytest-core/blob/master/src/test/java/org/easetech/easytest/example/TestExcelDataLoader.java).\n\n* New Attribute [writeData](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/DataLoader.java) \nadded to the DataLoader annotation. This attribute tells EasyTest whether the test data be written to the file or not. Default value is true. \nA new System property to specify whether data should be written or not(using boolean true or false) is also added and is named : \"easytest.writeData\".\nExample usage [here](https://github.com/EaseTech/easytest-core/blob/master/src/test/java/org/easetech/easytest/example/TestExcelDataLoader.java).\n\n* A new and extremely powerful annotation [TestPolicy](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/TestPolicy.java) is now added. \nThis annotation lets the user define a Policy for his test in a separate file and then reuse this policy in multiple tests. \nThis annotation takes a single argument of type class that defines the policy class that this test method should use. \nThe main benefit of TestPolicy is that it gives user an opportunity to reuse a lot of existing annotations and also de-clutters the main test. \nHere is the [javadoc for TestPolicy annotation](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/TestPolicy.java ) to see what all annotations it supports.\n\n* [EasyTestSuite](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/runner/EasyTestSuite.java) class along with [ParallelSuite](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/ParallelSuite.java) annotation \nis now available that is an extension of Suite Junit class and provides the user with the ability to run the suite classes in parallel as well as the methods inside the testclasses in parallel. \nYou can see it in action [here](https://github.com/EaseTech/easytest-core/blob/master/src/test/java/org/easetech/easytest/example/TestSuiteFunctionality.java).\n\nBesides the above major enhancements, there have been few bug fixes as well as code refactoring that went into this major release.\n\nWhat's new in Version 1.2.5\n---------------------------\nVersion 1.2.5 is mostly some bug fixes and code cleaning release. Importantly, from a user's perspective, anyone writing their own custom loaders\ncan now convert the data into specific Object during read time itself, which simplifies their test cases further in the sense that they dont need to write/register specific converters.\nAlthough this practice is not encouraged as it may lead to coupled, hard to refactor code, but in certain scenarios it is also useful.\nOne of the clients of EasyTest had this requirement and so it has now been supported.\n\nWhat's new in Version 1.2.4\n---------------------------\nA new method level annotation [Repeat](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/Repeat.java).\nThis annotation can be used to repeat the same test multiple times. This annotation is useful in scenarios where you may quickly want to load test your application.\nHere is how this annotation can be used.\n\n        public class TestRepeat {\n        \n            @Test\n            @Repeat(times=20)\n            public Item findItemTest(@Param(name='itemId')String itemId) {\n               Item result = testSubject.findItem(itemId)\n                 Assert.notNull(result);\n                 return result;\n            }\n          \nNotice the Repeat annotation at the method level. When EasyTest sees this annotation, it creates \"n\" different instances \nof the test method, where \"n\" is defined by the \"times\" attribute of the Repeat annotation. In the above case, EasyTest \nwill create 20 unique instances of the above test method.\n\nThere is also a System Property \u003cB\u003etest.repeatCount\u003c/B\u003e that can be used while running tests from command line.\nWhen this property is set, EasyTest simply creates \"n\" instances of each test defined in the test class, where \"n\" is defined \nby the value of the above System Property. System Property takes precedence over Repeat annotation. It means that if \nboth annotation and system property is present, then System Property's value will be used.\n\nAnother important addition to EasyTest is a new interface for Converter called [ParamAwareConverter](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/converter/ParamAwareConverter.java)\nThis interface introduces a new convert method that is now aware of the Parameter name that it is trying to convert.\nUsers of the original [Converter](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/converter/Converter.java)\nwill not be affected and can continue to use it like before. If you are using [AbstractConverter](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/converter/AbstractConverter.java)\nclass to define your converters then you are in luck. You now get the name parameter for free by calling the getParamName method\nof the [AbstractConverter](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/converter/AbstractConverter.java) class.\nThanks to [Josef Sustacek](https://github.com/sustacek) for his contribution.\n\nYet another addition to the library is the support for global/default input test data in the XML file. So a user can now \nspecify the repeatable input data globally once, instead of defining the same test data again and again for each test method.\nThanks again to [Josef Sustacek](https://github.com/sustacek) for his contribution. You can have a look at an example [here.](https://github.com/EaseTech/easytest-core/blob/master/src/test/resources/input-data.xml)\n\nYou can always refer the [WIKI pages](https://github.com/EaseTech/easytest/wiki) of EasyTest project for a general idea and more indepth detail, or can directly mail me at \nanujkumar@easetech.org for any questions/clarifications/suggestions.\n\n\nWhat's new in Version 1.2.3\n---------------------------\nA new annotation [Duration](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/Duration.java) is introduced.\nThis annotation is introduced to capture the time taken by the method under test and assert it with the user specified maximum time.\nThus a user can now say that the test should fail if the method it is trying to test takes more than \"x\"milliseconds.\n\u003cbr\u003eLet's look at an example\n\n        public class TestDuration {\n        \n        @Duration(timeInMillis=20)\n        ItemService testSubject;\n        \n        @Test\n        public Item findItemTest(@Param(name='itemId')String itemId) {\n        Item result = testSubject.findItem(itemId)\n          Assert.notNull(result);\n          return result;\n        }\n        \nIn the above case, if the method \u003cB\u003efindItem\u003c/B\u003e of class \u003cB\u003eItemService\u003c/B\u003e took more than 20 milli seconds, then the test method \nwill fail specifying that the method took more time than expected.\n\nA second use of this annotation is if a user wants to override the value of \u003cB\u003etimeInMillis\u003c/B\u003e attribute of Duration annotation for a specific Test. In such a case,\nhe can specify the Duration annotation at the Test Method level and EasyTest will override the value of timeInMillis only for that test.\nLets look at an example :\n   \n        public class TestDuration {\n        \n        @Duration(timeInMillis=20)\n        ItemService testSubject;\n        \n        @Test\n        public Item findItemTest(@Param(name='itemId')String itemId) {\n        Item result = testSubject.findItem(itemId)\n          Assert.notNull(result);\n          return result;\n          \n        @Test\n        @Duration(timeInMillis=50 , forClass=ItemService.class)\n        public List\u003cItem\u003e getItemsTest(@Param(name='itemType')String itemType) {\n        List\u003cItem\u003e result = testSubject.getItems(itemType)\n          Assert.notNull(result);\n          return result;\n        }\n        \nIn the above case, we are telling EasyTest that method \u003cB\u003egetItems\u003c/B\u003e of class \u003cB\u003eItemService\u003c/B\u003e should not take more than 50 milliseconds\nwhen run inside the test method with name \u003cB\u003egetItemsTest\u003c/B\u003e. \n\nIn order to get the complete picture, have a look at the Java docs of [Duration](https://github.com/EaseTech/easytest-core/blob/master/src/main/java/org/easetech/easytest/annotation/Duration.java) annotation.\n\nWhat's new in Version 1.2.2\n-------------------------------\n* A user can now specify a variable value as part of the DataLoader's filePaths attribute.\nThus it is now possible to use DataLoader annotation like this :\n\n          @DataLoader(filePaths = {\"${my.data.file}\" , \"${my.second.data.file}\"})\n    \nUsing the above way, a user can specify properties of the above variables \"my.data.file\" and \"my.second.data.file\" as System property using -D option of Java System Properties.\n\n* A new System Property \u003cB\u003e\"testDataFiles\"\u003c/B\u003e to provide a comma separated list of input test data files at runtime.\nIn order to use this option simply specify @DataLoader annotation at the top of your class without any input data. \nThus in such a case DataLoader annotation acts as a marker annotation telling the EasyTest \nsystem that it has to fetch the value of filePaths attribute from the system property \"testDataFiles\".\n\n* \u003cB\u003eNOTE\u003c/B\u003e If a user has specified both \u003cB\u003e\"testDataFiles\" System Property AND a value for \"dataFiles\" attribute\u003c/B\u003e, then the System Property files(specified using testDataFiles System Property) \nwill override the files specified using the \"dataFiles\" attribute of DataLoader annotation.\n\nWhat's new in Version 1.2.1\n------------------------------\nBesides regular clean up stuff, one of the important things that changed in 1.2.1 is the way Test methods are now instantiated and their data handled.\nUntil version 1.2, all the test methods were running in a single test class instance, which, normally was not a problem, but caused\nsome concern with JUnit Rules, especially with Rules that depended on a new instance for each test method (ErrorCollector for eg.)\nWith 1.2.1 that has changed and each test method now runs in its own test instance.\n\nYou can download the latest version of EasyTest Core from [Maven Central Repository](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.easetech%22%20AND%20a%3A%22easytest-core%22)  \n\nWhats new in Version 1.2\n------------------------\n* Run Your tests in Parallel using @Parallel annotation. Heres an example :\n\n        @RunWith(DataDrivenTestRunner.class)\n        @DataLoader(filePaths = { \"getItemsData.csv\" })\n        @Parallel(threads=2)\n        public class TestConditionsSupportedByEasyTestRunner {\n\n        \n         @Test\n         public void testGetItems(@Param(name=\"inputData\")\n        Map\u003cString, String\u003e inputData) {\n            System.out.println(\"library Id : \" + inputData.get(\"LibraryId\") + \" and item type : \"\n                + inputData.get(\"itemType\") + \" and search text array :\" + inputData.get(\"searchText\"));\n\n         }\n    \n        @Test\n        public void testAnotherItem(@Param(name=\"inputData\") \n          Map\u003cString, String\u003e inputData) {\n               // your test condition\n\n          }\n         }\n    \nNote the annotation @Parallel at the class level. This annotation is all you need to run your tests in Parallel.\n\n* The code is a lot cleaner and is known to support all the known features of JUnit.\n\nDownload EasyTest simply by including the latest version of easytest-core and easytest-spring modules from Maven in your pom file.\n   \n        \u003cgroupId\u003eorg.easetech\u003c/groupId\u003e\n        \n        \u003cartifactId\u003eeasytest-core\u003c/artifactId\u003e\n        \n        \u003cversion\u003e1.2\u003c/version\u003e\n        \nAnd for Spring module simply include :\n\n        \u003cgroupId\u003eorg.easetech\u003c/groupId\u003e\n        \n        \u003cartifactId\u003eeasytest-spring\u003c/artifactId\u003e\n        \n        \u003cversion\u003e1.1\u003c/version\u003e\n        \nEasyTest is a framework that lets you write Data Driven Tests using simple and intuitive annotations.\nBut it does not just provide you the ability to write Data Driven Tests. \nInstead it provides you with the facility to write sleek tests that are maintainable, easy to write and can be generated automatically using easytest-codegen library.\n\n\n\u003cbr\u003eFor a more detailed and up to date introduction, look at the wiki page: https://github.com/EaseTech/easytest/wiki/EasyTest-:-An-Introduction\u003cbr\u003e\nFor using EasyTest in your project, look at the WIKI page : https://github.com/EaseTech/easytest/wiki/EasyTest-:-Getting-Started-%7C-Maven-Dependency\nHere are some quick links:\n\n#### [EasyTest Introduction](https://github.com/EaseTech/easytest/wiki/EasyTest-:-An-Introduction) \n#### [Load data using CSV](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Loading-Data-using-CSV-file)\n#### [Load data using XML](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Loading-Data-using-XML)\n#### [Load data using Excel](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Loading-Data-using-Excel)\n#### [EasyTest Spring Support](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Spring-Integration)\n#### [Intercepting method calls](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Understanding-@Intercept-and-@SpringIntercept-annotation)\n#### [@Param annotation and passing parameters to test method](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Understanding-@Param-annotation)\n#### [Complex objects as parameters and Converters support](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Understanding-Converters-Support)\n#### [Property Editors Support](https://github.com/EaseTech/easytest/wiki/EasyTest-:-Understanding-Property-Editor-Support)\n####[JSON Support in EasyTest](https://github.com/EaseTech/easytest-core/wiki/Passing-JSON-Object-in-test-data)\n\nIntroduction:\n-------------\nThe EasyTest Core Module is built as an extension of Junit, and has taken the approach of providing test data to the test classes/methods at the whole new level. \nto how the test data is provided to the test method by the JUnit Runner.\n\nBefore describing the changes proposed in this repository, let us walk through what JUnit provides us for performing Data Driven Testing.\nJUnit, in its experimental package provides us two options:\n\n1) Parameterized Runner, in which we provide test data to the test method with @Parameters annotation\n\n2) Theories Runner, in which we provide test data to the test method using either @DataPpoint(s) annotations \nor by using @ParametersSuppliedBy and DataSupplier extension.\n\nBoth of the above approach requires the user to write boilerplate code in their test classes. Even though the data now resides outside the test case,\nit still is coupled with the test class. Finally, the ease of use that JUnit has been synonymous with for so long appears to be missing in the above experimental Runners.\n\nYou can find the detailed examples of Parameterized Runner and its limitations here:\nhttp://www.kumaranuj.com/2012/08/junits-parameterized-runner-and-data.html\n\nand for Theories runner here :\nhttp://www.kumaranuj.com/2012/08/junit-theories-and-data-driven-testing.html\n\nAll this and more, inspired me to write a test framework that is simple to use, is flexible in its approach and can be extended by the user in a consistent manner.\nFinally I wanted to bring back the same ease of use to the testing world, like we had few years ago(annotate methods with @Test and relax).\n\nWhat this code base consists of:\n---------------------------------\n\nThis code base consists of :\n\n1) A customized JUnit Runner that gives its user ability to provide test data in a consistent and user controlled manner. It is called DataDrivenTestRunner. \nThis Runner works on our favorite annotation @Test from JUnit and also supports passing parameters to the test method. And this is not its only selling point.\n\n2) DataDrivenTestRUNNER gives its users the ability to inspect the testMethod and its associated test data in the IDE. \nFor example, when a user runs the test method with name : getTestData with the following test data:\n\n\u003cB\u003e \"libraryId=1 and itemId=2\"\u003c/B\u003e\n \n \u003cB\u003e \"libraryId=2456 and itemId=789\"\u003c/B\u003e\n \n then, DataDrivenTest, will provide the details of the executing test method in the JUnit supported IDEs like this: \n \n \u003cB\u003egetTestData{libraryId=1 ,itemId=2}\n \n \u003cB\u003egetTestData{libraryId=2456 ,itemId=789}\u003c/B\u003e\n \n NOTE: In case the user has simple test methods(without parameters), DataDrivenTest runner supports that implicitly.\n \n3) A Data Loading Strategy consisting of interface Loader and classes LoaderFactory and CSVDataLoader and an Enum LoaderType. \nEasyTest supports four different ways for the user to load Data:\n  + CSV\n  + XECEL\n  + XML\n  + CUSTOM\n  \n  CSV, EXCE,XML data loader implementation is already available and the users can use it out of the box.\n  To give an example of the design, CSVDataLoader is an implementation of Loader interface and provides a mechanism to load test data from a CSV file.\nLoaderFactory is a Factory class that is responsible for returning the right type of Loader based on the loaderType.\n\n3) Param annotation that is an extension of ParametersSuppliedBy annotation and provides a lot of useful features to its user. Some of them include:\n + A mechanism to provide custom Objects to the test method. For eg. if a test method requires a user defined object LibraryId, then the Param annotation \n can automatically convert the string data(provided in the CSV file) to the LibraryId Object.This is based on Java RegistryEditorsSupport. In case the standard PropertyEditor find mechanism does not apply to your project, \n you can always register your own custom editors in your test class and the Framework will take care of the rest. For example look in the test package at LibraryId and LibraryIdEditor.\n \n + Another way to provide custom objects to the test method is by using ConverterManager and AbstractConverter. \n A user can provide its own implementation of converting a Map (containing the key value pair) to an object that is expected by the test method and the extension framework will take care of the rest.\n See \u003cB\u003eCASE 4 \u003c/B\u003ebelow \n\n4) DataLoader annotation to be used by the user in the test to provide information about the test data like:\n   + The list of files from which to load the input test data. This is a OPTIONAL field whose type is a String[]\u003c/li\u003e\n   \n   + The type of loader to load the files, identified by loaderType.\u003c/li\u003e\n   + The custom loader that is used by users to provide custom data loaders. It is an OPTIONAL field. \n \n DataLoader annotation can be used both at the class level as well as at the method level.\n In case the annotation is applied at both places, then method level takes precedence over Class level.\n    \n   Currently the framework supports CSV , XML, Excel and Custom loader Type.\n   \n5)DataContext class that contains thread-local variables that stores test data as well as the name of the currently executing test method.\n\n6)Finally, EasyTest also supports DataPoint, DataPoints and ParameterSuppliedBy annotations as well.\n\n\nSome Examples of using EasyTest\n---------------------------------------------------\n\u003cB\u003eCASE 1\u003c/B\u003e: Provides input test data in the form of CSV file at the class level, that is used by the test methods.\n\n    @RunWith(DataDrivenTestRunner.class)\n    @DataLoader(filePaths = { \"getItemsData.csv\" }, loaderType = LoaderType.CSV)\n    public class TestConditionsSupportedByEasyTestRunner {\n\n\n    /**\n     * A Simple test that uses data provided by TestData annotation present at the Class level\n     * @param inputData a generic map of input test data that contains all the required parameters for the test data.\n     */\n    @Test\n    public void testGetItems(@Param(name=\"inputData\") //@Param annotation is optional and can be omitted when the class name of the parameter is the same as the input parameter name\n    Map\u003cString, String\u003e inputData) {\n        System.out.println(\"library Id : \" + inputData.get(\"LibraryId\") + \" and item type : \"\n            + inputData.get(\"itemType\") + \" and search text array :\" + inputData.get(\"searchText\"));\n\n    }\n    \n\u003cB\u003eCASE 2\u003c/B\u003e: User provides input test data in the form of EXCEL file at the method level only.\n\n    @RunWith(DataDrivenTestRunner.class)\n    public class TestConditionsSupportedByEasyTestRunner {\n\n\n    /**\n     * A Simple test that uses data provided by TestData annotation present at the Method level\n     * @param inputData a generic map of input test data that contains all the required parameters for the test data.\n     */\n    @Test\n    @DataLoader(filePaths = { \"getItemsData.xls\" }, loaderType = LoaderType.EXCEL)\n    public void testGetItems(@Param(name=\"inputData\")\n    Map\u003cString, String\u003e inputData) {\n        System.out.println(\"library Id : \" + inputData.get(\"LibraryId\") + \" and item type : \"\n            + inputData.get(\"itemType\") + \" and search text array :\" + inputData.get(\"searchText\"));\n\n    }\n    \n\u003cB\u003eCASE 3\u003c/B\u003e: User provides input test data in the form of XML file at the Class level and as CSV file at method level. In this case method level test data takes priority over class level test data.\n\n    @RunWith(DataDrivenTestRunner.class)\n    @DataLoader(filePaths = { \"getItemsData.xml\" }, loaderType = LoaderType.XML)\n    public class TestConditionsSupportedByEasyTestRunner {\n\n\n    /**\n     * A Simple test that uses data provided by TestData annotation present at the Method level\n     * @param inputData a generic map of input test data that contains all the required parameters for the test data.\n     */\n    @Test\n    @DataLoader(filePaths = { \"getCustomData.csv\" }, loaderType = LoaderType.CSV)\n    public void testGetItems(@Param(name=\"items\")\n    List\u003cItemId\u003e inputData) {\n        .........\n\n    }\n\n\n    \n\u003cB\u003eCASE 4\u003c/B\u003e: User can also use their custom defined Objects as parameters in the test case. In this case LibraryId and ItenmId will be resolved using RegsitryEditorSupport of java:\n\n    @RunWith(DataDrivenTestRunner.class)\n    @DataLoader(filePaths = { \"getItemsData.csv\" }, loaderType = LoaderType.CSV)\n    public class TestConditionsSupportedByEasyTestRunner {\n\n    @BeforeClass\n    public static void before(){\n      //This is optional in case your editors follow Java Editor definition convention    \n      RegistryEditorManager.registerEditor(ItemId.class , ItemIdEditor.class);\n      }\n\n    /**\n     * A Simple test that uses data provided by TestData annotation present at the Method level\n     * @param inputData a generic map of input test data that contains all the required parameters for the test data.\n     */\n    @Test\n    @DataLoader(loader = MyDataLoader.class, loaderType = LoaderType.CUSTOM)\n    public void testGetItems(\n    LibraryId id , @Param(name=\"itemid\") ItemId itemId) {\n        System.out.println(\"library Id : \" + id.getValue() + \" and item type : \"\n            + itemId.getValue());\n            # Param annotation tells the framework that the parameter's value should be provided by the framework.\n               It can also take an optional name attribute which gives more control over the data to the user.\n\n    }\n    \n    \n\u003cB\u003eCASE 5\u003c/B\u003e: User can also use their custom defined objects when RegistryEditor support is not enough. The user simply has to either extend AbstractConverter class or implement the Converter interface and register it with the framework using ConverterManager class.\n\n    @RunWith(DataDrivenTestRunner.class)\n    @DataLoader(filePaths = { \"getItemsData.csv\" }, loaderType = LoaderType.CSV)\n    public class TestConditionsSupportedByEasyTestRunner {\n\n    @BeforeClass\n    public static void before(){   \n      ConverterManager.registerConverter(ItemConverter.class);\n      }\n      \n    @Test\n    @DataLoader(filePaths = { \"getItemsData.csv\" })\n    public void testConverter(@Param(name=\"item\") Item item){\n        Assert.assertNotNull(item);\n        System.out.println(item.getDescription() + item.getItemId() + item.getItemType());\n        \n    }\n    \n    \nAnd the framework supports many more functionalities. To review the functionalities supported, please visit :https://github.com/EaseTech/easytest/wiki    \n    \nConclusion\n-----------\nThis extension to JUnit focuses on bringing back the simplicity back to JUnit in JUnit way.\nThis extension also focuses mainly on performing Data Driven Testing within your system with ease and at the same time giving Flexibility and Extensibility to the user to use their custom behavior.\nThis extension is meant for people who want to write Test cases once and then reuse them again and again.\nA single test can act both as a Unit Test and an integration test. Nothing in the test case should or will change. \nOnly the test data and the tesSubject will change. This saves a lot of developers time and in turn of the project.\n\n[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/f9493f386883ce202a74100a0cd78f4c \"githalytics.com\")](http://githalytics.com/EaseTech/easytest-core)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEaseTech%2Feasytest-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEaseTech%2Feasytest-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEaseTech%2Feasytest-core/lists"}