TestProject Forum

Upload coded test

Hi there, im trying to upload coded test into my testproject job/project.

I’m unable to do it, all i can do is run it locally, see the report in monitor, rerun the test from monitor and thats all.

Test runned locally is marked and named as JOB i cannot add it as test to job/project and make proper scheduled job etc. with it.

Is there any way i can upload my code as test?
Or edit it on web from job to test?

Hi @kamil.mach ,
First of all welcome to our community :slight_smile:

it depends on which project language you want to upload, to upload a Java project, you need to compile your project to .jar file. You can use Gradle, Maven or any build tool that you like.

To upload a C# project, you will need to get the .dll file of the project.
Right-click on your project in the Solution Explorer and click on build. Once the build is done, right-click again on the project and open it in file explorer. To get the .dll file: bin/Debug/netcoreappX.X upload the .dll file in that folder. If you have more than one .dll file, it means that you used addons proxy in your test and you need to include them too.

For more information I will put this link here:
https://intercom.help/testprojectio/en/articles/3603571-how-can-i-upload-a-coded-test-to-testproject

If you want to upload a Python project, Python coded tests do not need to be uploaded to the platform, and neither do tests written using the Java and C# with the V2 SDK, reports are automatically generated for you on the platform:

Please see here for our SDK versions and their differences:

If you’re looking to upload your code to the platform and execute it alongside your recorded tests, you can use SDK V1.

Please let me know if it helped you, and if you have any other questions please feel free to ask :slight_smile:

Hi Alex, thank you for your reply.

Im trying to upload python, which is marked as job in the monitor page when i run it locally… And thats the problem, im not able to do proper jobs with tests. All i can do is record them (not my preference), and then add them to the job.

Is there any other way to add python tests into job beside recording?

Hi @kamil.mach ,

The SDK will attempt to infer Project and Job names when you use pytest or unittest. For example:

  1. when using pytest , tests in the my_tests.py module in the e2e_tests/chrome package will be reported with a project name e2e_tests.chrome and job name my_tests
    .
  2. when using unittest , tests in the my_tests.py module in the e2e_tests/chrome package will be reported with a project name chrome and job name my_tests

Examples using inferred project and job names:

Pytest:

Unitest:

.Project and Job names can be also specified explicitly using this constructor:

def test_specify_project_and_job_names_in_driver_constructor():
    driver = webdriver.Chrome(projectname='My custom project', jobname='My custom job')
    # Your test code goes here
    driver.quit()

Let me know if you managed :slight_smile:

Hi there, i did not, everything is still the same. I tried lots of varieties, nothing changed. No test uploaded in Tests in project, tests and job have only recorded tests in folder :frowning:

All i see is job runned with tests which is named by my function:

def test_name(driver):

So i see in monitor job named from decorator, but its job, not test. I want work with test only, duplicate it, work with it with multiple jobs. Is that possible?

Or i will be forced to do 1 epic big script which is loaded from my local as JOB covering my tests.
And then copypasta lots of code to do varieties or for using same test multiple times.

Hi @kamil.mach,
First python coded test can’t be uploaded to TestProject account.
Test that you run locally form your ide will be shown as job in monitor.
If you want to schedule the test to run at a certain time without uploading you can do this using windows task scheduler.
First create a bat file with this commend

@echo off
pytest Path where your Python script is stored\script name.py
pause

for example in my case -

After that open task scheduler and create a task

Give a name to the task and then navigate to Triggers and create a new trigger

mmc_eXSku2oQn9

set to schedule at the time you want and click ok then navigate to action and click new.

mmc_T3pPgcMSKZ

Chose action as start program and on program script chose the bat file created
After that you can click ok and approve task.

Now your test will start automatically at time you chose in the task.

If you want to do that in the TestProject account under job you can use Java and c# TestProject SDK
The upload coded test of python sdk will be implemented in the future.

Please let me know if you managed to implement this

That could be handy, thank you very much.

But problem is not solved, im not able to do proper action with test suites… so i will make big job with my selenium script :confused: All i can see is job with 0 tests, which is also little bit weird, but it will work, just little bit confusing :slight_smile:
Thank you guys! :slight_smile:

Hi @kamil.mach,
What do you mean by showing 0 test in job?
You can create multiple test script in python as part of the the same python project.
Then you can run from your ide all the tests you want. to make it automatic and scheduled you can do as explained before.

This is not related to a job you don’t need to create an empty job in testproject account

When im trying to run test, its called job in monitor, and the job shows 0 tests (did not recognized any steps as tests.) It does same thing when i download recorded test, and run it from my PC.

Job should execute tests, not be test himself, or not?

All i can do is execute test as job, and pretend its test, so to run many test in job, i had to add them all to the one job. if i want few tests in more then one job, i have to copypasta. :slight_smile:

Also im not able to share the job, only recorded tests can be shared, or project i thing, did not manage to share project, link in email was expired in few dozen secs :smiley: and then i cannot see any invited team members to cancel it, and if i try add team member, it says email already in use.