Test Integration: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:


== Creating TestSpace Containers ==
== Creating TestSpace Containers ==
As a first step, we must create a project and test space into which our test results will be uploaded.
As a first step, we must create a '''Project''' and '''Test Space''' into which our test results will be uploaded.
[[image:TestIntro_Testspace.jpg|thumb||Newly created TestIntro Test Space]]


# Using your web browser, navigate to your company's testspace site and login<ref>Your testspace URL and login credentials are provided by S2 Technologies</ref>
# Using your web browser, navigate to your company's testspace site and login<ref>Your testspace URL and login credentials are provided by S2 Technologies</ref>
# Click on the "All Projects" tab, then click the "Create New Test Space" button at the bottom of the All Projects page.
# Click on the '''All Projects''' tab, then click the '''Create New Test Space''' button.
# Since we don't yet have a ''project'' created to act as a parent to the ''testspace'',  
# If your company's site doesn't have any Projects defined you will be prompted to create a new project. If that is the case, follow these sub-steps:
## Scroll to the bottom or the ''New s2_test_space'' page and click the ''New Project...'' link.
## Fill in the '''Name''' as: Stride Deployment
## In the ''add project'' box that appears, enter the Name as Stride Deployment, and Description as "sandbox for deployment tests".
## Fill in the '''Description''' as: sandbox for deployment tests
## Once the fields are entered, click the Create button in the add project box.
## Ensure that the '''Active''' box is checked
# Back at the top of the New s2_test_space page, enter text as follows:
## Click the '''Create''' button
#* Name: TestIntro
# At the top of the '''New s2_test_space''' page, enter text as follows:
#* Description: testintro sample tests
#* '''Name:''' TestIntro
#* Max results to keep: 10
#* '''Description:''' testintro sample tests
# If you would like to grant access to other users, check the appropriate boxes in the ''additional users''  
#* '''Max results to keep:''' 10
# For now, skip the ''auto compare'' options, you can change these (and other options) later if desired
# If you would like to grant access to other users, check the appropriate boxes in the '''additional users''' section
# In the Project list box, choose "Stride Deployment"
# For now, skip the '''auto compare''' options, you can change these (and other options) later if desired
# Finally, click the "create" button
# In the Project list box, choose ''Stride Deployment''. If this isn't available, click the '''New Project...''' link and enter the project name and description as described earlier
# Finally, click the '''create''' button
# On the subsequent page that is displayed, you will be able to manually upload results data, but leave the browser as it is, we will be automatically uploading results in a later step.
# On the subsequent page that is displayed, you will be able to manually upload results data, but leave the browser as it is, we will be automatically uploading results in a later step.


== Adding the TestIntro Tests to the Target Build ==
== Adding the TestIntro Tests to the Target Build ==
Here we will add the TestIntro sample tests to the target build. We suggest that you continue to include the STRIDE diagnostics in this build and all subsequent builds.
Here we will add the [Test Intro Sample|TestIntro sample tests]] to the target build.<ref>The TestIntro sample is distributed in the [[Package_Installation#Samples|Samples package]].</ref> We will use the same technique used earlier in the [[Test_Integration#Building_the_Target_with_STRIDE_Diagnostics|Test Integration]] to incorporate these tests.


Copy the file <tt>s2_testintro_test.h</tt> to a designated SCL_DIRS directory (or alternative), include the TestIntro source files in the compile/link and perform a target build.
The [[Test Unit Pragmas|SCL pragmas]] that declare the TestIntro test units are in the file <tt>s2_testintro_test.h</tt>, so this file needs to be supplied as input to the STRIDE build tools. If you are using the Makefile technique described in [[Test_Integration#Build_Tool_Inputs|TestIntegration]], you simply need to copy <tt>s2_testintro_test.h</tt> to a designated SCL_DIRS directory so that it will be picked up as input to s2scompile.  


Download the binary to the target and start it running.
In addition, you need to include the TestIntro source files in the target compile/link.
 
Once the build is complete, download the binary to the target in preparation of running the tests.


== Running and Publishing the TestIntro Tests ==
== Running and Publishing the TestIntro Tests ==
Line 34: Line 38:
If not already present, install the appropriate [[Package_Installation#Host_Tools | Host Tools]] package on the host computer.
If not already present, install the appropriate [[Package_Installation#Host_Tools | Host Tools]] package on the host computer.


We will now run [[Stride Runner|stride]] with options instructing it to upload results to your TestSpace site. The command line gets rather long when all this is specified, so it's recommended that you create an options file to submit the command line options.
We will now run [[Stride Runner|stride]] with options instructing it to upload results to your company's [[STRIDE Test Space|TestSpace site]]. The command line gets rather long when all the needed options are specified, so it's recommended that you create an options file to submit the command line options.


Create a text file named TestIntroOpts.txt and add the following text. You will need to fill in your particular argument values where brackets [ ] are shown.
Create a text file named <tt>TestIntroOpts.txt</tt> and add the following text. You will need to fill in your particular argument values where brackets [ ] are shown. Note that the --project and --space argument values must match pre-existing containers on your TestSpace site.


<pre>
<pre>
Line 47: Line 51:
--space TestIntro
--space TestIntro
</pre>
</pre>
To run and upload the tests, ensure that your target system is running and that your host computer is connected to the Internet, then enter the following in a host console:


  stride -O TestIntroOpts.txt
  stride -O TestIntroOpts.txt


 
The text below should be output to your host console as the test progresses.
<pre>
<pre>
Loading database...
Loading database...
Line 69: Line 75:
Uploading to test space...
Uploading to test space...
</pre>
</pre>
Notice that the last line indicates that the results are being uploaded to test space.
== Viewing Results in TestSpace ==
== Viewing Results in TestSpace ==
[[image:TestIntro_spacepage.jpg|thumb||Newly created TestIntro Test Space]]
Returning to your web browser, login to your company's test space site if needed and navigate to the '''All Projects''' page.
You should now see the '''TestIntro''' test space listed under the '''Stride Deployment''' project, and see that TestIntro's '''Result Set Count''' is now 1.
Click on the '''TestIntro''' link to be presented with the '''TestIntro''' space page. At the bottom of the page you will see a table displaying the uploaded result sets for this test space. Click on the '''Sequence_1''' link to show detailed results for this test run.


== Next Steps ==
== Next Steps ==

Revision as of 19:13, 10 June 2009

In this article, we discuss establishment of continuous integration testing using STRIDE.

The starting point of this article assumes that your have completed the steps described in the article Test Integration.

Creating TestSpace Containers

As a first step, we must create a Project and Test Space into which our test results will be uploaded.

File:TestIntro Testspace.jpg
Newly created TestIntro Test Space
  1. Using your web browser, navigate to your company's testspace site and login[1]
  2. Click on the All Projects tab, then click the Create New Test Space button.
  3. If your company's site doesn't have any Projects defined you will be prompted to create a new project. If that is the case, follow these sub-steps:
    1. Fill in the Name as: Stride Deployment
    2. Fill in the Description as: sandbox for deployment tests
    3. Ensure that the Active box is checked
    4. Click the Create button
  4. At the top of the New s2_test_space page, enter text as follows:
    • Name: TestIntro
    • Description: testintro sample tests
    • Max results to keep: 10
  5. If you would like to grant access to other users, check the appropriate boxes in the additional users section
  6. For now, skip the auto compare options, you can change these (and other options) later if desired
  7. In the Project list box, choose Stride Deployment. If this isn't available, click the New Project... link and enter the project name and description as described earlier
  8. Finally, click the create button
  9. On the subsequent page that is displayed, you will be able to manually upload results data, but leave the browser as it is, we will be automatically uploading results in a later step.

Adding the TestIntro Tests to the Target Build

Here we will add the [Test Intro Sample|TestIntro sample tests]] to the target build.[2] We will use the same technique used earlier in the Test Integration to incorporate these tests.

The SCL pragmas that declare the TestIntro test units are in the file s2_testintro_test.h, so this file needs to be supplied as input to the STRIDE build tools. If you are using the Makefile technique described in TestIntegration, you simply need to copy s2_testintro_test.h to a designated SCL_DIRS directory so that it will be picked up as input to s2scompile.

In addition, you need to include the TestIntro source files in the target compile/link.

Once the build is complete, download the binary to the target in preparation of running the tests.

Running and Publishing the TestIntro Tests

To execute the TestIntro tests, use a Windows or Linux host computer that has connectivity with the target system via your configured STRIDE transport (TCP/IP or seral). Additionally, make the generated STRIDE database (.sidb) visible to the host computer via a shared filesystem or a file copy to the host system.

If not already present, install the appropriate Host Tools package on the host computer.

We will now run stride with options instructing it to upload results to your company's TestSpace site. The command line gets rather long when all the needed options are specified, so it's recommended that you create an options file to submit the command line options.

Create a text file named TestIntroOpts.txt and add the following text. You will need to fill in your particular argument values where brackets [ ] are shown. Note that the --project and --space argument values must match pre-existing containers on your TestSpace site.

-r /(*) 
--database [path]/stride.sidb 
--device [arg] 
-u
--testspace [https://mycompany.stridetestspace.com@user:pwd]
--project "Stride Deployment"
--space TestIntro

To run and upload the tests, ensure that your target system is running and that your host computer is connected to the Internet, then enter the following in a host console:

stride -O TestIntroOpts.txt

The text below should be output to your host console as the test progresses.

Loading database...
Connecting to device...
  runtime version: 4.1.01
Executing test units...
  s2_testintro_cclass
    > 1 passed, 1 failed, 0 in progress, 0 not in use.
  s2_testintro_flist
    > 2 passed, 1 failed, 0 in progress, 0 not in use.
  s2_testintro_testdoubles
    > 3 passed, 0 failed, 0 in progress, 0 not in use.
  s2_testintro_testpoints
    > 3 passed, 0 failed, 0 in progress, 0 not in use.
Summary: 9 passed, 2 failed, 0 in progress, 0 not in use.
Disconnecting from device...
Saving result file...
Uploading to test space...

Notice that the last line indicates that the results are being uploaded to test space.

Viewing Results in TestSpace

Newly created TestIntro Test Space

Returning to your web browser, login to your company's test space site if needed and navigate to the All Projects page.

You should now see the TestIntro test space listed under the Stride Deployment project, and see that TestIntro's Result Set Count is now 1.

Click on the TestIntro link to be presented with the TestIntro space page. At the bottom of the page you will see a table displaying the uploaded result sets for this test space. Click on the Sequence_1 link to show detailed results for this test run.


Next Steps

Automated Regression Testing

best to set things up so that you automatically

  • build,
  • load binaries on the hardware,
  • start target running,
  • run Stride tests
  • publish results to test space

Organizing Tests

put test results in suites

develop tests with namespace conventions

Publication of Test Results

Upload to test space

comparison with previously uploaded data

immediately see trends in

  • number of tests in each suite and overall

Best Practices

Use C++ Test Classes if Possible

If possible, use C++ Test Classes to write your test units. Test Classes offer extra features and are the easiest to use for programmers.

Use Namespacing to Organize Tests

Over time, you will end up with lots of test units. Grouping these tests for display or running will become important as the count of test units grows. (You can see an example of C namespacing in the TestIntro tests.)


Notes

  1. Your testspace URL and login credentials are provided by S2 Technologies
  2. The TestIntro sample is distributed in the Samples package.