TestProject Forum
Powered by leading experts in the test automation community

How can I use existing addon in the addon that I am creating

Hi,

I am creating an addon to perform a restapi post action for different data for my application. Since test project execution does not support csv file for each test/step, I am following this approach for data driven tests.

I want to use RESTful API Client addon. I downloaded the proxy jar but I am not able to understand how to use it in my addon for development. I am using maven build.

Can anyone help me with this

Thanks,
Nirupama

Hello @nirupamav,

TestProject does indeed support data driven testing via CSV files.
You can parameterize your API calls by doing the following:

  1. Create parameters for the required fields in the API call:

image

image

Save it and then select it for the field:
image

You can create more parameters for the other fields or you can hard-code them in the test.

  1. When you’re done setting up the parameters, you can exit the test, and find it in your project, and from there generate a data source template, this will download a CSV file for you including your parameters as headers:

image

You can fill in the rows in the CSV file, each row will be a single execution of the test, and each parameter will receive the value you have given it in the row for that execution.
e.g. if row 1 has the values A,B,C, during that execution, the EXPECTED_STATUS will be A, MY_QUERY will be B and MY_URI will be C.
Remember, more rows will be more executions.

Once you’re done save the file and move to the next part.

  1. You can upload the CSV file to TestProject and attach it to a test in a job or use it when executing a singular test.

You can upload the file from here:

Or when executing a test case:

And to attach them to test cases in jobs, just select the data sources icon:

image

And select one from the list or add a new one.

**
To answer your original question, you cannot use the proxy jars inside other addons, you can use them if you create tests (not addons) using the original TestProject SDK which is now classified specifically as the addon SDK:
https://app.testproject.io/#/integrations/develop-addon

If you would like to view a usage example, you can record a test with an addon and generate it’s code.

Thank you for guiding me through the process David.

Actually the problem is the only one csv file is supported per job. I need to create jobs with different tests. For e.g. smoke test job, regression test job
And each test has different sets of data which I cannot manage in same csv file. I am looking for someway to create data driven tests at test level under a job and not at job level

Let me explain one of my scenario. I have a permission validation. I have 30 users with 30 different roles. For now I have 60 endpoints (The count will increase as and when new features are added). Behavior of each endpoint is different for different users. and for few endpoints I don’t need to test with all 30 users.

With current features in test project, there is no way to loop a test with certain input data. I have to repeat same steps for each endpoint test.
So I was planning to write an addon to perform different httpmethods based on my input. I was planning to pass josn object with httpmethod, uri, payload, expected response code and response so that the addon is reusable.

Is there any way for me to achieve this in testproject

You can add a CSV file per test in a job, as in, if you have 3 tests within a job, each one of those can have it’s own CSV file.
If you need to run the same test multiple times with different data sets, you can even insert that same test multiple times into a job, and have each copy have it’s own data source file.

1 Like

Thank you David. I will try it out