1

Can we use an automation tool to test the text file created by Java?if yes which one?

The data will be loaded in the oracle DB and then we have to create a text file using that data after applying logic developed in java. There is no UI for this project.

background.

Our client is pharmacy company. They want a report to be generated for a certain type of drugs whenever they are sold. In the report we have to provide the prescriber information, store level detail,patient detail,date etc

8
  • Yes, it is very possible and it is a common practice. But without further details, it is hard to make a recommendation here.
    – Yu Zhang
    Feb 28, 2018 at 21:16
  • @YuZhang Thanks for your response.Can you please let me know what all details do you need?
    – Ankur
    Feb 28, 2018 at 21:18
  • What are your testing scopes? What are your business rules?
    – Yu Zhang
    Feb 28, 2018 at 21:19
  • @YuZhang..I will give you little background.Our client is pharmacy company.They want a report to be generated for a certain type of drugs whenever they are sold.In the report we have to provide the prescriber information, store level detail,patient detail,date etc..
    – Ankur
    Feb 28, 2018 at 21:23
  • 2
    There is no tool that you can directly use, but you can code a test case in any language of your choosing. Simply read this generated file, parse it, compare it against a known reference.
    – Yu Zhang
    Feb 28, 2018 at 21:26

4 Answers 4

1

This seems to be a good use case for Golden Master Testing:

Characterization Testing (aka Golden Master Testing) is a means to characterize the behavior of the test object to protect it against unintended changes, regardless of its correctness. In order to do so, the results of a previous (typically stable) version—the golden master—serve as the oracle for the tests (also known as consistency oracle since it compares the consistency between two versions).

If you also write your tests in Java, you can use Approval Tests (which also has ports for C#, Python, JavaScript etc.). It will help to create, manage, and compare the golden master—in your case the created text file. Afterwards, your test(s) will be as simple as this (readFileToString is from Apache Commons):

String fileContent = FileUtils.readFileToString(new File("path/to/file"));
Approvals.verify(fileContent);
1

I believe, all you need is a programming language and test logic.

Do you have any specific problem implementing your test algorithm?

1
  • 1
    as simple as that, no need for fancy tooling
    – Rsf
    Mar 12, 2018 at 12:00
0

You can consider using Apache JMeter tool, it is free and open source so there are no any costs and it has everything you need, to wit:

  1. JDBC Request sampler to fetch the data from Oracle database
  2. HTTP Request sampler to fetch the data from the text file on a file system (use file as "protocol")
  3. Response Assertion - to verify the integrity of data in DB and in the file.

JMeter User Manual and JMeter Academy should help you to get started very quickly.

0

This sounds like it should start at the unit test layer of the test pyramid, then perhaps a simple integration test (if one doesn't already exist) to assert the mocked data from the db is returned as expected in the unit test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.