Test Case Subjects

Each Test Case needs at least one subject in Medidata Rave on which to enter data and verify results. TrialGrid will create subjects in Medidata Rave using Rave Web Services when the Test Case is run.

Creating unique subjects per scenario

These steps will create a new subject with a unique subject name. TrialGrid requires that each subject in Rave has a unique subject name because TrialGrid uses Rave Web Services to create subjects in Rave and Rave Web Services will not create a subject if one already exists with that name.

The subject name format can be configured for each project, see Project Test Configuration. The default subject name format for each URL in TrialGrid is configurable by TrialGrid Ltd. The default format is the first 20 characters of the name of the Test Case and the date/time that the step was executed. If you would like a different default format, please contact TrialGrid Ltd.

There is no difference between these steps except for wording, so you may choose whichever you prefer:

Given a subject exists
Given I create a subject
When I create a subject

Tip

We recommend that each Test Scenario is independent and a new subject is created for each scenario. The advantage of this approach is that Test Cases can be run separately, combined, in any order and each Test Case Scenario will pass or fail on its own merits. The above steps guarantee that the subject name is unique and that there is no possibility of mulitple subjects in Medidata Rave with the same name and/or different Test Cases accessing the same subject.

Note

When running this step TrialGrid will first attempt to create the subject in Medidata Rave with the current EDC role specified in the scenario (“Investigator” for example). If that role does not have permission to create subjects in Medidata Rave (“Data Manager” for example) then TrialGrid will attempt to create the subject using the “Subject Admin” role, if one is available.

The other create subject steps listed below will NOT make a second attempt with the subject admin role and will rely on the role specified in the Test Case.

Creating subjects with specified names

If different Test Cases use the same subject in Medidata Rave this might lead to unexpected results, for example if one Test Case enters data which impacts the behaviour of an Edit Check being tested in another Test Case. However it is possible to specify the subject name when creating a subject if you wish to do so:

Given I create subject "TEST1"

Note

This step will fail if subject “TEST1” already exists

You may also use a subject in Rave which already exists:

Given I select the subject named "TEST1"

Note

This step will fail if subject “TEST1” does not already exist. This step will also fail if a subject “TEST1” exists but it is not on the latest CRF Version pushed to that study site in Rave.

Or you can use an existing subject, but if it doesn’t exists then create it:

Given I create or select the subject named "TEST1"

Note

As above, this step will also fail if a subject “TEST1” exists but it is not on the latest CRF Version pushed to that study site in Rave.

To make Test Cases reliable and repeatable you may wish to ensure that and previously created subjects have been inactivated:

Given there are no active subjects named "TEST1"
And I create subject "TEST1"

Note

This step requires a user account with Medidata Rave Subject Admin permission

See also

For a full list of all the commands which Automated Testing understands see Automated Testing Step Reference

Using parameters in subject names

The subject name can include the following parameters which will be replaced with the appropriate values when the Test Case is executed:

  • {testcase_name} - the name of the Test Case which is being executed

  • {timestamp} - the date and time at which the subject is created, in ISO 8601 format, e.g. 2019-08-20T16:32:50.81456

  • {test_username} - the name of the TrialGrid user who executes the Test Case

  • {testcaserun_id} - an internal TrialGrid identifier for the Test Case Run (which might not be consecutive)

  • {testsetrun_iid} - an internal TrialGrid identifier for the Test Set (unique and consecutive within the TrialGrid project)

  • {site} - the Medidata Rave study site in which the subject is created

  • {scenario_name} - the name of the Test Scenario

  • {line_no} - the line number in the Test Case

  • {randint} - a random integer between 100000000 and 999999999

  • {randstr} - the upper case alphabetic characters in random order

Multiple parameters and text characters can be included.

Examples:

Given I create subject "TRIALGRID {testcase_name}"

will create a subject named “TRIALGRID TEST1” if the Test Case name is “TEST1”.

Given I create subject "{test_username}:{timestamp}"

will create a subject named “ATN1:2019-08-20 14:23:31.81765” when run by TrialGrid user “ATN1” at that time.

The format of the timestamp can be specified using Python format codes https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior

Given I create subject "{test_username}:{timestamp:%Y-%m-%d %H:%M:%S}"

will create a subject named “ATN1:2019-08-20 14:23:31” when run by TrialGrid user “ATN1” at that time.

Given I create subject "{testcase_name:10.10} {randint:4.4}"

will create a subject with a name like “Test AE001 8472” if the Test Case name is “Test AE001 - Adverse”. The “:10.10” format specification will take the first 10 characters.

Given I create subject "{testcase_name} SUBJECT_{subject_count:04}"
And I create subject "{testcase_name} SUBJECT_{subject_count:04}"

will create a subject name “TEST1 SUBJECT_0001” and then a second subject “TEST1 SUBJECT_0002”. The “:04” format specification will left pad the number with zeros.

Important

Medidata Rave subject names can be a maximum of 50 characters. If the subject name specified in TrialGrid is longer than 50 characters it will be truncated at the end, on the right. For example if the Test Case name is “TEST CASE ADVERSE EVENT QUERY 001” then a naming pattern (“{testcase_name} {timestamp}” will generate something like:

TEST CASE ADVERSE EVENT QUERY 001 2019-08-01T10:12:34.089118

This is 61 characters long and will be truncated to:

TEST CASE ADVERSE EVENT QUERY 001 2019-08-01T10:1

If the truncated name already exists in Rave this might cause the test case to fail.