Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Orthogonal Array Testing Strategy (OATS) to test pairwise combination of (charttype, feature) pairs #11

Open
jzabroski opened this issue Mar 9, 2018 · 1 comment

Comments

@jzabroski
Copy link
Contributor

My previous Issue #10 was getting highly repetitive, and I wanted a way to parameterize my test cases and make them more efficient. Plus, I still haven't bothered learning Pester yet.

Feature 1 - Chart Type

  • AreaChart
  • BarChart
  • BubbleChart
  • ColumnChart
  • DoughnutChart
  • FunnelChart
  • KagiChart
  • LineChart
  • PieChart
  • PointChart
  • PyramidChart
  • SplineChart
  • StackedAreaChart
  • StackedBarChart
  • StackedColumnChart

Feature 2 - With or without legend

  • With combination
  • Without combination
@jzabroski
Copy link
Contributor Author

jzabroski commented Mar 9, 2018

Arrange

Invoke-WebRequest -Uri "http://data.githubarchive.org/2015-01-01-12.json.gz" -OutFile githubarchive2012-01-01-12.json.gz"
Install-Module PS7Zip -Repository PSGallery -Scope CurrentUser
Set-ExecutionPolicy RemoteSigned -CurrentUser
Import-Module PS7Zip
Expand-7Zip .\githubarchive2012-01-01-12.json.gz
$data = Get-Content .\githubarchive2012-01-01-12.json | ConvertFrom-Json
Import-Module .\PoshCharts.psm1
$plottable = $data | group type;
$legend = $plottable | select -ExpandProperty name
$commands = Get-Command Out-*Chart -Module PoshCharts

Act 1 - without legend

foreach ($cmd in $commands) {
    $cmdName = $cmd.Name;
    Invoke-Expression "`$plottable | $cmdName -XField Name -YField Count";
}

Assert 1

# Should not throw any errors

Actual 1

To my surprise, Out-LineChart was the only one to throw an error. @proxb Should we re-design the interface so that YField can take either a single-dimensional array or multi-dimensional array?

Out-LineChart : Parameter cannot be processed because the parameter name 'YField' is ambiguous. Possible matches
include: -YField1 -YField2 -YFieldTitle -YField1Color -YField2Color.
At line:1 char:41
+ $plottable | Out-LineChart -XField Name -YField Count
+                                         ~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-LineChart], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameter,Out-LineChart

Act 2 - with legend

foreach ($cmd in $commands) {
    $cmdName = $cmd.Name;
    Invoke-Expression "`$plottable | $cmdName -XField Name -YField Count -IncludeLegend -LegendText `$legend";
}

Assert 2

# Should not throw errors

Actual 2

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-AreaChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-BarChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-BubbleChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-ColumnChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Out-DoughnutChart : A parameter cannot be found that matches parameter name 'LegendText'.
At line:1 char:74
+ ... utChart -XField Name -YField Count -IncludeLegend -LegendText $legend
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-DoughnutChart], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Out-DoughnutChart

Out-FunnelChart : A parameter cannot be found that matches parameter name 'LegendText'.
At line:1 char:72
+ ... elChart -XField Name -YField Count -IncludeLegend -LegendText $legend
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-FunnelChart], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Out-FunnelChart

Out-KagiChart : A parameter cannot be found that matches parameter name 'LegendText'.
At line:1 char:70
+ ... giChart -XField Name -YField Count -IncludeLegend -LegendText $legend
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-KagiChart], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Out-KagiChart

Out-LineChart : Parameter cannot be processed because the parameter name 'YField' is ambiguous. Possible matches
include: -YField1 -YField2 -YFieldTitle -YField1Color -YField2Color.
At line:1 char:41
+ $plottable | Out-LineChart -XField Name -YField Count -IncludeLegend  ...
+                                         ~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-LineChart], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameter,Out-LineChart

Out-PieChart : A parameter cannot be found that matches parameter name 'LegendText'.
At line:1 char:69
+ ... ieChart -XField Name -YField Count -IncludeLegend -LegendText $legend
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-PieChart], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Out-PieChart

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-PointChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Out-PyramidChart : A parameter cannot be found that matches parameter name 'LegendText'.
At line:1 char:73
+ ... idChart -XField Name -YField Count -IncludeLegend -LegendText $legend
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-PyramidChart], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Out-PyramidChart

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-SplineChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-StackedAreaChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-StackedBarChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-StackedColumnChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex
Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-AreaChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-BarChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-BubbleChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-ColumnChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Out-DoughnutChart : A parameter cannot be found that matches parameter name 'LegendText'.
At line:1 char:74
+ ... utChart -XField Name -YField Count -IncludeLegend -LegendText $legend
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-DoughnutChart], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Out-DoughnutChart

Out-FunnelChart : A parameter cannot be found that matches parameter name 'LegendText'.
At line:1 char:72
+ ... elChart -XField Name -YField Count -IncludeLegend -LegendText $legend
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-FunnelChart], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Out-FunnelChart

Out-KagiChart : A parameter cannot be found that matches parameter name 'LegendText'.
At line:1 char:70
+ ... giChart -XField Name -YField Count -IncludeLegend -LegendText $legend
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-KagiChart], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Out-KagiChart

Out-LineChart : Parameter cannot be processed because the parameter name 'YField' is ambiguous. Possible matches
include: -YField1 -YField2 -YFieldTitle -YField1Color -YField2Color.
At line:1 char:41
+ $plottable | Out-LineChart -XField Name -YField Count -IncludeLegend  ...
+                                         ~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-LineChart], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameter,Out-LineChart

Out-PieChart : A parameter cannot be found that matches parameter name 'LegendText'.
At line:1 char:69
+ ... ieChart -XField Name -YField Count -IncludeLegend -LegendText $legend
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-PieChart], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Out-PieChart

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-PointChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Out-PyramidChart : A parameter cannot be found that matches parameter name 'LegendText'.
At line:1 char:73
+ ... idChart -XField Name -YField Count -IncludeLegend -LegendText $legend
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Out-PyramidChart], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Out-PyramidChart

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-SplineChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-StackedAreaChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-StackedBarChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Index operation failed; the array index evaluated to null.
At C:\source\PoshCharts\PoshCharts\Functions\Public\Out-StackedColumnChart.ps1:172 char:21
+ ...             $chart.Series[$SeriesLabel].LegendText = $LegendText[($i- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant